Skip to content

Commit

Permalink
Merge branch 'autotools'
Browse files Browse the repository at this point in the history
  • Loading branch information
CtrlZmaster committed Dec 4, 2024
2 parents 5c4b494 + 5bbe104 commit 319c995
Show file tree
Hide file tree
Showing 57 changed files with 14,360 additions and 805 deletions.
34 changes: 34 additions & 0 deletions .bin/bump-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const fs = require("fs");

if (process.argv.length !== 3) {
throw Error(`Usage: ${process.argv[0]} ${process.argv[1]} <version>`);
}

const version = process.argv[2];

const updateVersion = packageFile => {
const original = JSON.parse(fs.readFileSync(packageFile, "utf8"));

const updated = {
...original,
version,
...(original.packages
? {
packages: {
...original.packages,
"": {
...original.packages[""],
version,
},
},
}
: {}),
};

return fs.writeFileSync(packageFile, JSON.stringify(updated, null, 2));
};

updateVersion("./package.json");
updateVersion("./package-lock.json");
updateVersion("./packages/app/package.json");
updateVersion("./packages/app/package-lock.json");
22 changes: 22 additions & 0 deletions .bin/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

destdir=$1
pcsd_webui_dir=$2
cockpit_dir=$2

if [ "$pcsd_webui_dir" = "" ] && [ "$cockpit_dir" = "" ]; then
echo "No install location found, skipping installation"
exit 0
fi

if [ ! "$pcsd_webui_dir" = "" ]; then
standalone_dir="$destdir"/"$pcsd_webui_dir"
mkdir -p "$standalone_dir"
cp -r build/for-standalone/* "$standalone_dir"
fi

if [ ! "$cockpit_dir" = "" ]; then
cockpit_ha_cluster_dir="$destdir"/"$cockpit_dir"/ha-cluster
mkdir -p "$cockpit_ha_cluster_dir"
cp -r build/for-cockpit/* "$cockpit_ha_cluster_dir"
fi
24 changes: 21 additions & 3 deletions .bin/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
#!/bin/sh

# Change all nexus occurrences in package-lock.json files to standard npm paths.
fix_lock() {
lock_file=$1

sed -i "s#repository.engineering.redhat.com/nexus/repository/##g" "$lock_file"
git add "$lock_file"
}

for lockDir in \
"./" \
"./packages/app" \
"./packages/dev" \
"./packages/dev-backend" \
"./packages/test"; do

lock="$lockDir"/package-lock.json
sed -i "s#repository.engineering.redhat.com/nexus/repository/##g" "$lock"
git add "$lock"
fix_lock "$lockDir"/package-lock.json
done

# Deal with reduced packages (for building process).
app=packages/app
package_build="$app"/.bin/package-build

packages_build="$app"/$("$package_build"/fname.sh)
packages_build_lock="$app"/$("$package_build"/fname.sh -l)

"$package_build"/generate.sh "$app"
git add "$packages_build" "$packages_build_lock"

fix_lock "$packages_build_lock"
50 changes: 50 additions & 0 deletions .bin/render-spec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh

spec_template=$1
version=$2
date="$3"
pcsd_webui_dir="$4"
cockpit_dir="$5"
pcsd_unix_socket="$6"

expressions="s/@date@/$date/g"
delete_global() {
expressions="${expressions};/^%glo.*${1}.*$/d"
}
replace() {
expressions="${expressions};s|@${1}@|${2}|g"
}

replace pcsd-webui-dir "$pcsd_webui_dir"
replace cockpit-dir "$cockpit_dir"
replace pcsd-unix-socket "$pcsd_unix_socket"

if echo "$version" | grep '-' --quiet; then
# The version structure (modified `git describe`, e.g. 0.1.20+34-89788-dirty):
# git tag (e.g. 0.1.20)
# +commits ahead last tag (git-version-gen made "+" from first "-" e.g. -34)
# -hash of the current commit (e.g. -8978888c)
# -dirty (optional)
replace version "${version%%+*}"
replace current_commit "$(echo "$version" | sed 's/[^-]*-\([^-]*\).*/\1/')"
replace commits_ahead_tag "$(echo "$version" | sed 's/[^+]*+\([^-]*\).*/\1/')"
else
# If the current commit is annotated tag, the version is the tag, e.g. 0.1.20
replace version "$version"
delete_global current_commit
delete_global commits_ahead_tag
fi

if echo "$version" | grep '\-dirty$' --quiet; then
replace dirty dirty
else
delete_global dirty
fi

if [ -z "$CI_BRANCH" ]; then
delete_global cibranch
else
replace cibranch "$CI_BRANCH"
fi

sed --expression "$expressions" "$spec_template"
1 change: 1 addition & 0 deletions .gitarchivever
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref names:$Format:%d$
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
configure.ac export-subst
.gitarchivever export-subst
17 changes: 16 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,24 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

pcs-web-ui-node-modules-*.tar.xz
pcs-web-ui-*
pcs-web-ui.spec
.npmrc
.eslintcache

stamps*

Makefile
Makefile.in
aclocal.m4
autom4te.cache/
config.log
config.status
configure
configure~
missing
install-sh
.version

/.dev
/.tmp
94 changes: 0 additions & 94 deletions Makefile

This file was deleted.

Loading

0 comments on commit 319c995

Please sign in to comment.