aboutsummaryrefslogtreecommitdiffstats
path: root/Tools/portbuild
diff options
context:
space:
mode:
authorerwin <erwin@FreeBSD.org>2008-01-01 21:25:01 +0800
committererwin <erwin@FreeBSD.org>2008-01-01 21:25:01 +0800
commit15cbfe051b14714e8838225afb86e7f366899110 (patch)
treea16b939ec3822b322f96cedd92fced3e96e7acce /Tools/portbuild
parentab234622a5bdad6f17b24242a006d729d2499ac6 (diff)
downloadfreebsd-ports-gnome-15cbfe051b14714e8838225afb86e7f366899110.tar.gz
freebsd-ports-gnome-15cbfe051b14714e8838225afb86e7f366899110.tar.zst
freebsd-ports-gnome-15cbfe051b14714e8838225afb86e7f366899110.zip
Change homebrew locking routines with lockf(1) based locking.
Diffstat (limited to 'Tools/portbuild')
-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