aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorErwin Lansing <erwin@FreeBSD.org>2008-01-01 13:25:01 +0000
committerErwin Lansing <erwin@FreeBSD.org>2008-01-01 13:25:01 +0000
commitd32d4753c35521342d06152ab03d77bfb188f56c (patch)
tree11bf05f7917400bb59544308fb79e04ed16b204f /Tools
parentea55be816a4321875e25f40716e305fef5a568fe (diff)
downloadports-d32d4753c35521342d06152ab03d77bfb188f56c.tar.gz
ports-d32d4753c35521342d06152ab03d77bfb188f56c.zip
Change homebrew locking routines with lockf(1) based locking.
Notes
Notes: svn path=/head/; revision=204795
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/portbuild/scripts/dopackages.wrapper18
1 files changed, 4 insertions, 14 deletions
diff --git a/Tools/portbuild/scripts/dopackages.wrapper b/Tools/portbuild/scripts/dopackages.wrapper
index cde459aade42..a6854efe983a 100755
--- a/Tools/portbuild/scripts/dopackages.wrapper
+++ b/Tools/portbuild/scripts/dopackages.wrapper
@@ -1,14 +1,5 @@
#!/bin/sh
-cleanup() {
- lock=$1
- error=$2
-
- rm -f ${lock}
-
- exit ${error}
-}
-
# configurable variables
pb=/var/portbuild
arch=$1
@@ -27,11 +18,10 @@ if [ -e ${lock} ]; then
exit 1
fi
-touch ${lock}
rm -f ${status}
mkdir -p ${pb}/${arch}/archive/buildlogs
-trap "cleanup ${lock} 1" 1 2 3 9 10 11 15
+trap "exit 1" 1 2 3 9 10 11 15
dorun() {
branch=$1
@@ -39,11 +29,11 @@ dorun() {
ln -sf ${pb}/${arch}/archive/buildlogs/log.${branch}.${date} ${pb}/${arch}/${branch}/build.log
ln -sf log.${branch}.${date} ${pb}/${arch}/archive/buildlogs/log.${branch}.${shortdate}
- ${pb}/scripts/dopackages ${arch} $@ ${branch} ${date} 2>&1 \
+ lockf -t 0 ${lock} ${pb}/scripts/dopackages ${arch} $@ ${branch} ${date} 2>&1 \
> ${pb}/${arch}/archive/buildlogs/log.${branch}.${date}
if [ -f ${status} ]; then
error=$(cat ${status})
- cleanup ${lock} ${error}
+ exit ${error}
fi
}
@@ -51,4 +41,4 @@ dorun() {
dorun ${branch} $@ &
wait
-cleanup ${lock} 0
+exit 0