aboutsummaryrefslogtreecommitdiffstats
path: root/Tools/portbuild
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2006-02-15 15:42:30 +0800
committerkris <kris@FreeBSD.org>2006-02-15 15:42:30 +0800
commitf6354b6c1a704752e5a7a2df05c63fdaabd24f45 (patch)
tree695a3d9b00903c8851758460554de6e699b19b0a /Tools/portbuild
parent30daf21d31afea214e68711ca692f5971c7f101d (diff)
downloadfreebsd-ports-gnome-f6354b6c1a704752e5a7a2df05c63fdaabd24f45.tar.gz
freebsd-ports-gnome-f6354b6c1a704752e5a7a2df05c63fdaabd24f45.tar.zst
freebsd-ports-gnome-f6354b6c1a704752e5a7a2df05c63fdaabd24f45.zip
Add some sanity checking of the build environment:
* Test whether squid is running. If not, try to kick off the rc script in the background in case it can be restarted cleanly. * Test for at least 100MB of free space on the scratch partition. If either condition fails, set an exception flag and bail out. This will be reported back to the server via reportload.
Diffstat (limited to 'Tools/portbuild')
-rwxr-xr-xTools/portbuild/scripts/claim-chroot31
1 files changed, 30 insertions, 1 deletions
diff --git a/Tools/portbuild/scripts/claim-chroot b/Tools/portbuild/scripts/claim-chroot
index 52bf12bbb4d7..c04c3866d523 100755
--- a/Tools/portbuild/scripts/claim-chroot
+++ b/Tools/portbuild/scripts/claim-chroot
@@ -2,6 +2,12 @@
# usage: claim-chroot ${arch} ${branch} ${pkgname}
+# This script cannot output anything except the name of the successfully
+# claimed chroot. In case of error, just exit.
+
+# XXX Return the string "chroot=*" and look for that in pdispatch to make
+# this more robust
+
# configurable variables
pb=/var/portbuild
@@ -13,7 +19,6 @@ shift
. ${pb}/scripts/buildenv
buildroot=${scratchdir}
-error=0
branch=$1
shift
@@ -24,6 +29,30 @@ pkgname=$(basename $1 ${PKGSUFFIX})
chrootdir=${buildroot}/${branch}/chroot
+# Perform initial sanity check
+
+if [ ! -z "${squid_dir}" ]; then
+ /usr/local/sbin/squid -k check 2> /dev/null
+ status=$?
+ if [ "${status}" != "0" ]; then
+ touch ${scratchdir}/.squid
+ /usr/local/etc/rc.d/squid.sh start > /dev/null &
+ exit 1
+ else
+ rm -f ${scratchdir}/.squid
+ fi
+fi
+
+# Check for enough disk space
+df=$(df -k ${scratchdir} | tail -1 | awk '{print $4}')
+
+if [ ${df} -lt 102400 ]; then
+ touch ${scratchdir}/.disk
+ exit 1
+else
+ rm -f ${scratchdir}/.disk
+fi
+
found=0
# Look for pre-existing chroot directories that are populated and unused
for dir in ${chrootdir}/*; do