1998-12-28 08:27:27 -05:00
|
|
|
#!/bin/sh
|
2002-02-10 21:43:14 -05:00
|
|
|
#
|
2003-01-23 23:49:09 -05:00
|
|
|
# pdispatch <arch> <branch> <command> <package.tgz> [<args> ...]
|
2002-02-10 21:43:14 -05:00
|
|
|
#
|
|
|
|
# Choose a random machine from ${buildroot}/ulist and dispatch the
|
|
|
|
# job to it via the ptimeout script.
|
1999-06-22 06:18:40 -04:00
|
|
|
|
2002-03-09 18:14:41 -05:00
|
|
|
pb=/var/portbuild
|
2003-01-23 23:49:09 -05:00
|
|
|
arch=$1
|
|
|
|
shift
|
|
|
|
. ${pb}/${arch}/portbuild.conf
|
2002-09-15 17:57:52 -04:00
|
|
|
. ${pb}/scripts/buildenv
|
|
|
|
|
2003-01-23 23:49:09 -05:00
|
|
|
# wait 8 hours maximum
|
|
|
|
timeout=28800
|
1999-06-22 06:18:40 -04:00
|
|
|
|
2000-08-29 04:25:14 -04:00
|
|
|
branch=$1
|
|
|
|
command=$2
|
|
|
|
shift 2
|
1998-12-28 08:27:27 -05:00
|
|
|
|
2003-01-23 23:49:09 -05:00
|
|
|
buildenv ${pb} ${arch} ${branch}
|
2002-09-15 17:57:52 -04:00
|
|
|
|
1998-12-28 08:27:27 -05:00
|
|
|
# ssh -x doesn't work on some machines
|
|
|
|
unset DISPLAY
|
|
|
|
|
2002-09-15 17:57:52 -04:00
|
|
|
pkgname=$(basename $1 ${PKGSUFFIX})
|
1998-12-28 08:27:27 -05:00
|
|
|
|
2003-01-23 23:49:09 -05:00
|
|
|
if grep -qxF $pkgname ${pb}/${arch}/${branch}/duds; then
|
1998-12-28 08:27:27 -05:00
|
|
|
echo "skipping $pkgname"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
args=${1+"$@"}
|
2003-02-14 04:26:20 -05:00
|
|
|
num=$(wc -w ${pb}/${arch}/ulist | awk '{print $1}')
|
|
|
|
random=$(jot -r 1 1 ${num})
|
|
|
|
mach=$(cat ${pb}/${arch}/ulist | cut -f ${random} -d ' ' )
|
1998-12-28 08:27:27 -05:00
|
|
|
set $mach
|
2000-08-29 04:25:14 -04:00
|
|
|
flags=""
|
1999-01-22 05:00:08 -05:00
|
|
|
if [ "x$NOCLEAN" != "x" ]; then
|
2000-08-29 04:25:14 -04:00
|
|
|
flags="${flags} -noclean"
|
|
|
|
fi
|
|
|
|
if [ "x$NO_RESTRICTED" != "x" ]; then
|
|
|
|
flags="${flags} -norestr"
|
|
|
|
fi
|
2002-03-09 18:14:41 -05:00
|
|
|
if [ "x$PLISTCHECK" != "x" ]; then
|
|
|
|
flags="${flags} -plistcheck"
|
2000-08-29 04:25:14 -04:00
|
|
|
fi
|
|
|
|
if [ "x$NODUMMY" != "x" ]; then
|
|
|
|
flags="${flags} -nodummy"
|
1999-01-22 05:00:08 -05:00
|
|
|
fi
|
2002-03-09 18:14:41 -05:00
|
|
|
|
2003-01-23 23:49:09 -05:00
|
|
|
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
|