182d4cc46d
random build host.
54 lines
1.2 KiB
Bash
Executable File
54 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# pdispatch <arch> <branch> <command> <package.tgz> [<args> ...]
|
|
#
|
|
# Choose a random machine from ${buildroot}/ulist and dispatch the
|
|
# job to it via the ptimeout script.
|
|
|
|
pb=/var/portbuild
|
|
arch=$1
|
|
shift
|
|
. ${pb}/${arch}/portbuild.conf
|
|
. ${pb}/scripts/buildenv
|
|
|
|
# wait 8 hours maximum
|
|
timeout=28800
|
|
|
|
branch=$1
|
|
command=$2
|
|
shift 2
|
|
|
|
buildenv ${pb} ${arch} ${branch}
|
|
|
|
# ssh -x doesn't work on some machines
|
|
unset DISPLAY
|
|
|
|
pkgname=$(basename $1 ${PKGSUFFIX})
|
|
|
|
if grep -qxF $pkgname ${pb}/${arch}/${branch}/duds; then
|
|
echo "skipping $pkgname"
|
|
exit 1
|
|
fi
|
|
|
|
args=${1+"$@"}
|
|
num=$(wc -w ${pb}/${arch}/ulist | awk '{print $1}')
|
|
random=$(jot -r 1 1 ${num})
|
|
mach=$(cat ${pb}/${arch}/ulist | cut -f ${random} -d ' ' )
|
|
set $mach
|
|
flags=""
|
|
if [ "x$NOCLEAN" != "x" ]; then
|
|
flags="${flags} -noclean"
|
|
fi
|
|
if [ "x$NO_RESTRICTED" != "x" ]; then
|
|
flags="${flags} -norestr"
|
|
fi
|
|
if [ "x$PLISTCHECK" != "x" ]; then
|
|
flags="${flags} -plistcheck"
|
|
fi
|
|
if [ "x$NODUMMY" != "x" ]; then
|
|
flags="${flags} -nodummy"
|
|
fi
|
|
|
|
echo "dispatching: ssh -a -t -n root@$1 ${command} ${arch} ${branch} $flags $args at $(date)"
|
|
${pb}/scripts/ptimeout.host $timeout ssh -a -t -n root@$1 ${command} ${arch} ${branch} ${flags} $args
|