From e7940fef7a26a125cf333cd47c7290c54992568f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 27 Jul 2014 21:26:33 -0400 Subject: Relying on the git directory to be writable for the lockfile is broken --- bin/autobuild.sh | 29 ++++++++++++++++------------- 1 file 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" -- cgit v1.2.3-54-g00ecf