summaryrefslogtreecommitdiff
path: root/bin/autobuild.sh
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2014-07-27 21:26:33 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2014-07-27 21:26:33 -0400
commite7940fef7a26a125cf333cd47c7290c54992568f (patch)
tree8fb9bc01eff2437d940e5dee25751c98bc1a5366 /bin/autobuild.sh
parent5c3c38b46b93efae12b576c421c8016cc733756d (diff)
Relying on the git directory to be writable for the lockfile is broken
Diffstat (limited to 'bin/autobuild.sh')
-rwxr-xr-xbin/autobuild.sh29
1 files changed, 16 insertions, 13 deletions
diff --git a/bin/autobuild.sh b/bin/autobuild.sh
index fdcfb3d..eeeaae8 100755
--- a/bin/autobuild.sh
+++ b/bin/autobuild.sh
@@ -33,13 +33,18 @@ main() {
# merge could easily break things if we get the git time.
newpkgver_date=$(LC_ALL=C date -u +%Y%m%d)
- # Confirm that we are in a valid directory, and lock it.
- if [[ $PWD != *.git ]]; then
- die "%q should be run as a hook from a git repository" "$0"
- fi
- lock 9 "$PWD/autobuild.lock" "Waiting for previous run of %q to finish" "$0"
+ # Configuration parsing ################################################
+
+ . "$(librelib conf)"
+ load_files libretools
+ check_vars libretools WORKDIR ABSLIBRERECV ABSLIBRESEND
+
+ # Lock to pevent conflicting runs ######################################
+
+ mkdir -p "${WORKDIR}/lockdir"
+ lock 9 "$HOME/packages/lockdir/${PWD//\//%2F}" "Waiting for previous run of %q to finish" "$0"
- # Option parsing ###############################################################
+ # Option/usage parsing #################################################
if [[ $# -lt 1 ]]; then
error "%q takes at least 1 argument" "$0"
@@ -56,15 +61,13 @@ main() {
fi
unset package_re
- newgitver=$(git log -n1 --format='%H' master -- "${@:2}")
-
- # Configuration parsing ########################################################
+ if [[ $PWD != *.git ]]; then
+ die "%q should be run as a hook from a git repository" "$0"
+ fi
- . "$(librelib conf)"
- load_files libretools
- check_vars libretools WORKDIR ABSLIBRERECV ABSLIBRESEND
+ newgitver=$(git log -n1 --format='%H' master -- "${@:2}")
- # The real work begins! ########################################################
+ # The real work begins! ################################################
# Get the ABSLibre tree
gitget -f -p "$ABSLIBRESEND" checkout "$ABSLIBRERECV" "$WORKDIR/abslibre"