freebsd-ports/Tools/portbuild/scripts/pdispatch
Satoshi Asami 45f51c8307 Timeout port builds after 4 hours. This will prevent ports that get
stuck indefinitely in fetch or configure from hanging up the entire
build process.
1999-06-22 10:18:40 +00:00

39 lines
870 B
Bash
Executable file

#!/bin/sh
# wait 4 hours maximum
timeout=14400
command=$1
shift
if pwd | grep -qF 2.2; then
branch=2.2
elif pwd | grep -qF 3; then
branch=3
else
branch=4
fi
# ssh -x doesn't work on some machines
unset DISPLAY
pkgname=$(basename $1 .tgz)
buildroot=$(dirname $(dirname $0))
if grep -qxF $pkgname ${buildroot}/${branch}/duds; then
echo "skipping $pkgname"
exit 1
fi
args=${1+"$@"}
mach=$(cat ${buildroot}/ulist)
num=$(echo $(echo $mach | wc -w))
set $mach
shift $(echo "$$ $num" | awk '{srand($1); print(int(rand()*$2))}')
if [ "x$NOCLEAN" != "x" ]; then
echo "dispatching: ssh -a $1 ${command} ${branch} -noclean $args"
${buildroot}/scripts/ptimeout $timeout ssh -a $1 ${command} ${branch} -noclean $args
else
echo "dispatching: ssh -a $1 ${command} ${branch} $args"
${buildroot}/scripts/ptimeout $timeout ssh -a $1 ${command} ${branch} $args
fi