freebsd-ports/Tools/portbuild/scripts/dopackages.wrapper
Kris Kennaway 89c8fd897f * 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.
2008-07-26 14:52:05 +00:00

39 lines
792 B
Bash
Executable file

#!/bin/sh
# 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 2
. ${pb}/scripts/buildenv
if ! validate_env ${arch} ${branch} ; then
echo "Invalid environment: ${arch}/${branch}"
exit 1
fi
buildid=$(resolve ${pb} ${arch} ${branch} ${buildid})
if [ -z "${buildid}" ]; then
echo "Invalid build ID ${buildid}"
exit 1
fi
# XXX move to per-build
lock=${pb}/${arch}/${branch}/lock
date=$(date '+%Y%m%d%H%M%S')
dorun() {
lockf -k -t 0 ${lock} ${pb}/scripts/dopackages ${arch} ${branch} ${buildid} ${date} $@ 2>&1 \
| tee ${pb}/${arch}/archive/buildlogs/log.${branch}.${date}
}
dorun $@ || (echo "Build failed."; exit 1)