summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParabola git <git@parabola.nu>2020-11-12 07:00:02 +0000
committerParabola git <git@parabola.nu>2020-11-12 07:00:02 +0000
commit97c53d0ee05d79be8542a2be8002d45a4056385e (patch)
tree0910be53c290336c4cdfbb60c9dd993c4336a787
parent5488a5d2f8f04b32660c14d64cbb45c299393ea2 (diff)
Update from cron
-rwxr-xr-xabslibre/abslibre.git/hooks/commit-msg25
1 files changed, 16 insertions, 9 deletions
diff --git a/abslibre/abslibre.git/hooks/commit-msg b/abslibre/abslibre.git/hooks/commit-msg
index 30a4595..139c4d6 100755
--- a/abslibre/abslibre.git/hooks/commit-msg
+++ b/abslibre/abslibre.git/hooks/commit-msg
@@ -4,19 +4,26 @@ set -e
#readonly REBUILD_PKGS=(
# libre/lxappearance-obconf-gtk3
#)
-
-
-# rebuild/sign per autobuilder
#for pkg in ${REBUILD_PKGS[@]}
#do echo '==> Rebuilding ${pkg} ...'
# ~autobuilder/.local/bin/autobuild ${pkg}
#done
-commit_msg_file="$@"
-if [[ "$(cat ${commit_msg_file})" =~ ^\[([^/]*/[^/]*)\]: *autobuild$ ]]
-then pkg=${BASH_REMATCH[1]}
- if git ls-tree --name-only -r master | grep "${pkg}/PKGBUILD"
+
+
+commit_msg_file="$1"
+commit_msg="$(cat ${commit_msg_file})"
+autobuild_rx='^\[([^/]*/[^/]*)\]: *autobuild$' # eg: '[pcr/foo]:autobuild'
+
+# auto-rebuild and reject push
+[[ "${commit_msg}" =~ "${autobuild_rx}" ]] || exit 0
+
+if [[ "${commit_msg}" =~ "${autobuild_rx}" ]]
+then repo_pkg="${BASH_REMATCH[1]}"
+ if git ls-tree --name-only -r master | grep "^${repo_pkg}/PKGBUILD$" # &> /dev/null
then echo '==> Rebuilding ${pkg} ...'
- ~autobuilder/.local/bin/autobuild ${pkg}
- exit 1
+ if ~autobuilder/.local/bin/autobuild ${repo_pkg}
+ then exit 1
+ else echo "${commit_msg} - autobuild failed" > ${commit_msg_file}
+ fi
fi
fi