diff options
author | kris <kris@FreeBSD.org> | 2008-07-26 22:52:05 +0800 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2008-07-26 22:52:05 +0800 |
commit | 2b173b3c22e4c3ff166fab69c18ef09a0cd17636 (patch) | |
tree | 289ed141c533991b11aa10aebc11c945f9051bc9 | |
parent | 1aa762af7d4eb4abfcc0d6e4a199304d93ade25d (diff) | |
download | freebsd-ports-gnome-2b173b3c22e4c3ff166fab69c18ef09a0cd17636.tar.gz freebsd-ports-gnome-2b173b3c22e4c3ff166fab69c18ef09a0cd17636.tar.zst freebsd-ports-gnome-2b173b3c22e4c3ff166fab69c18ef09a0cd17636.zip |
* Cleanup
* Catch up to build ID directory changes
* Make it easier to kill a build by not running dopackages in the background
where it is detached from shell job control. Now, sending a termination
signal to this process (e.g. ^C) will also kill off the dopackages script
and in turn the processes created by it. Some background processes
spawned by dopackages, pdispatch, etc, may still remain and need to be
killed by hand.
-rwxr-xr-x | Tools/portbuild/scripts/dopackages.wrapper | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/Tools/portbuild/scripts/dopackages.wrapper b/Tools/portbuild/scripts/dopackages.wrapper index a6854efe983a..5517ee671ff5 100755 --- a/Tools/portbuild/scripts/dopackages.wrapper +++ b/Tools/portbuild/scripts/dopackages.wrapper @@ -2,43 +2,38 @@ # configurable variables pb=/var/portbuild + +if [ $# -lt 2 ]; then + echo "usage: $0 <arch> <buildid> [<args> ...]" + exit 1 +fi + arch=$1 +buildid=$2 branch=$(echo $(basename $0) | cut -d'.' -f2) -shift - -. ${pb}/${arch}/portbuild.conf +shift 2 -lock=${pb}/${arch}/${branch}/lock -status=${pb}/${arch}/status -date=$(date '+%Y%m%d%H') -shortdate=$(date '+%Y%m%d') +. ${pb}/scripts/buildenv +if ! validate_env ${arch} ${branch} ; then + echo "Invalid environment: ${arch}/${branch}" + exit 1 +fi -if [ -e ${lock} ]; then - echo "Already locked." - exit 1 +buildid=$(resolve ${pb} ${arch} ${branch} ${buildid}) +if [ -z "${buildid}" ]; then + echo "Invalid build ID ${buildid}" + exit 1 fi -rm -f ${status} -mkdir -p ${pb}/${arch}/archive/buildlogs +# XXX move to per-build +lock=${pb}/${arch}/${branch}/lock -trap "exit 1" 1 2 3 9 10 11 15 +date=$(date '+%Y%m%d%H%M%S') dorun() { - branch=$1 - shift 1 - - 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} - 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}) - exit ${error} - fi + lockf -k -t 0 ${lock} ${pb}/scripts/dopackages ${arch} ${branch} ${buildid} ${date} $@ 2>&1 \ + | tee ${pb}/${arch}/archive/buildlogs/log.${branch}.${date} } -dorun ${branch} $@ & -wait - -exit 0 +dorun $@ || (echo "Build failed."; exit 1) |