diff options
author | linimon <linimon@FreeBSD.org> | 2010-06-25 22:49:56 +0000 |
---|---|---|
committer | linimon <linimon@FreeBSD.org> | 2010-06-25 22:49:56 +0000 |
commit | f235bbeb782e41477d3c1f6d8439905dc8c2fb1f (patch) | |
tree | 802ca188d15bcc1217c005789010a7b11d073d86 | |
parent | b3f38f8c739e898894ffb7a2bb27af4269c645dd (diff) | |
download | FreeBSD-ports-f235bbeb782e41477d3c1f6d8439905dc8c2fb1f.zip FreeBSD-ports-f235bbeb782e41477d3c1f6d8439905dc8c2fb1f.tar.gz |
Generalize the packge building scripts to be able to be run on more than
one 'head' node, rather than just pointyhat itself.
Constants are factored out into installation-specific files known as
portbuild/conf/server.conf and portbuild/conf/client.conf. There is
only one server.conf file. Individual <arch> directories may have
their own client.conf files, or may symlink to ../conf/client.conf.
This first set of files only gets the *.conf files and some cleanup.
Feature safe: yes
-rwxr-xr-x | Tools/portbuild/scripts/buildfailure | 1 | ||||
-rwxr-xr-x | Tools/portbuild/scripts/buildsuccess | 1 | ||||
-rwxr-xr-x | Tools/portbuild/scripts/claim-chroot | 6 | ||||
-rwxr-xr-x | Tools/portbuild/scripts/cleanup-chroots | 8 | ||||
-rwxr-xr-x | Tools/portbuild/scripts/client-metrics | 4 | ||||
-rwxr-xr-x | Tools/portbuild/scripts/flushsquid | 5 | ||||
-rwxr-xr-x | Tools/portbuild/scripts/keeprestr | 7 | ||||
-rwxr-xr-x | Tools/portbuild/scripts/makeduds | 1 | ||||
-rwxr-xr-x | Tools/portbuild/scripts/mkbindist | 3 | ||||
-rwxr-xr-x | Tools/portbuild/scripts/prunefailure | 2 | ||||
-rwxr-xr-x | Tools/portbuild/scripts/reportload | 8 |
11 files changed, 34 insertions, 12 deletions
diff --git a/Tools/portbuild/scripts/buildfailure b/Tools/portbuild/scripts/buildfailure index 75d3cf4..50e295a 100755 --- a/Tools/portbuild/scripts/buildfailure +++ b/Tools/portbuild/scripts/buildfailure @@ -28,6 +28,7 @@ shift 4 builddir=${pb}/${arch}/${branch}/builds/${buildid} +. ${pb}/conf/server.conf . ${pb}/${arch}/portbuild.conf . ${pb}/scripts/buildenv diff --git a/Tools/portbuild/scripts/buildsuccess b/Tools/portbuild/scripts/buildsuccess index e98201a..ba4b882 100755 --- a/Tools/portbuild/scripts/buildsuccess +++ b/Tools/portbuild/scripts/buildsuccess @@ -22,6 +22,7 @@ shift 4 builddir=${pb}/${arch}/${branch}/builds/${buildid} +. ${pb}/conf/server.conf . ${pb}/${arch}/portbuild.conf . ${pb}/scripts/buildenv diff --git a/Tools/portbuild/scripts/claim-chroot b/Tools/portbuild/scripts/claim-chroot index f5a73a5..faab2ae 100755 --- a/Tools/portbuild/scripts/claim-chroot +++ b/Tools/portbuild/scripts/claim-chroot @@ -1,5 +1,7 @@ #!/bin/sh +# client-side script to claim a chroot + # usage: claim-chroot ${arch} ${branch} ${pkgname} ${buildid} # Care needs to be taken with the output of this script, it cannot @@ -62,11 +64,9 @@ if [ ! -f ${builddir}/.ready ]; then exit 1 fi +. ${pb}/${arch}/client.conf . ${pb}/${arch}/portbuild.conf . ${pb}/${arch}/portbuild.$(hostname) -. ${pb}/scripts/buildenv - -buildenv ${pb} ${arch} ${branch} ${builddir} buildroot=${scratchdir} pkgname=${pkgname%.${PKGSUFFIX}} diff --git a/Tools/portbuild/scripts/cleanup-chroots b/Tools/portbuild/scripts/cleanup-chroots index 3286687..ffa735b 100755 --- a/Tools/portbuild/scripts/cleanup-chroots +++ b/Tools/portbuild/scripts/cleanup-chroots @@ -1,11 +1,14 @@ #!/bin/sh -# +# $FreeBSD$ + # To be run on the client, this script looks for chroot directories # that have not been used in 60 minutes, as well as directories listed # as 'in use' that have not been touched in 5 days (corresponding to # port builds that have timed out or shut down uncleanly) and prunes # them to reclaim space. +pb=/var/portbuild + kill_procs() { dir=$1 @@ -38,9 +41,10 @@ cleanup_mount() { fi } -pb=/var/portbuild +# note: uname is not being overridden (should not need client.conf here) arch=$(uname -m) +. ${pb}/${arch}/client.conf . ${pb}/${arch}/portbuild.conf . ${pb}/${arch}/portbuild.$(hostname) diff --git a/Tools/portbuild/scripts/client-metrics b/Tools/portbuild/scripts/client-metrics index 34867a3..55ecb0e 100755 --- a/Tools/portbuild/scripts/client-metrics +++ b/Tools/portbuild/scripts/client-metrics @@ -1,6 +1,7 @@ #!/bin/sh +# $FreeBSD$ -# Collect metrics for ganglia: +# Client script to collect metrics for ganglia: # - current vnodes # - max vnodes # - number of packages built in the past hour @@ -16,6 +17,7 @@ gmetric --name="maxvnodes" --value=`sysctl -n kern.maxvnodes` --tmax=120 --dmax= gmetric --name="vnodes" --value=`sysctl -n vfs.numvnodes` --tmax=120 --dmax=0 --type=uint32 --units="# vnodes" if [ -f ${pb}/${arch}/portbuild.conf -a -f ${pb}/${arch}/portbuild.${me} ]; then + . ${pb}/${arch}/client.conf . ${pb}/${arch}/portbuild.conf . ${pb}/${arch}/portbuild.${me} else diff --git a/Tools/portbuild/scripts/flushsquid b/Tools/portbuild/scripts/flushsquid index d76b2aa..8bd1857 100755 --- a/Tools/portbuild/scripts/flushsquid +++ b/Tools/portbuild/scripts/flushsquid @@ -1,7 +1,12 @@ #!/bin/sh +# $FreeBSD$ +# client script to be manually run to flush squid cache, whenever needed + +# note: uname is not being overridden arch=$(uname -m) pb=/var/portbuild +. ${pb}/${arch}/client.conf . ${pb}/${arch}/portbuild.conf host=$(hostname) diff --git a/Tools/portbuild/scripts/keeprestr b/Tools/portbuild/scripts/keeprestr index 22b72ca..e5a1b0a 100755 --- a/Tools/portbuild/scripts/keeprestr +++ b/Tools/portbuild/scripts/keeprestr @@ -1,4 +1,7 @@ -#!/bin/sh -x +#!/bin/sh +# $FreeBSD$ + +# server-side script to save off RESTRICTED files usage () { echo "usage: keeprestr arch branch buildid" @@ -15,6 +18,7 @@ buildid=$3 pb=/var/portbuild +. ${pb}/conf/server.conf . ${pb}/scripts/buildenv buildid=$(resolve ${pb} ${arch} ${branch} ${buildid}) @@ -30,3 +34,4 @@ rm -rf bak/restricted mkdir -p bak/restricted (tr ';' '\n' < restricted.sh | grep "/bin/rm -f" | awk '{print $3}' | grep packages/ | sed -e "s,${builddir}/,," -e 's,)$,,' | xargs ls -1 2>/dev/null) | cpio -dumpl bak/restricted/ + diff --git a/Tools/portbuild/scripts/makeduds b/Tools/portbuild/scripts/makeduds index b1c330e..efbfc1e 100755 --- a/Tools/portbuild/scripts/makeduds +++ b/Tools/portbuild/scripts/makeduds @@ -18,6 +18,7 @@ shift 3 builddir=${pb}/${arch}/${branch}/builds/${buildid} +. ${pb}/conf/server.conf . ${pb}/${arch}/portbuild.conf . ${pb}/scripts/buildenv diff --git a/Tools/portbuild/scripts/mkbindist b/Tools/portbuild/scripts/mkbindist index 9191d3d..d2d70ba 100755 --- a/Tools/portbuild/scripts/mkbindist +++ b/Tools/portbuild/scripts/mkbindist @@ -26,6 +26,7 @@ buildid=$3 shift 3 pb=/var/portbuild +. ${pb}/conf/server.conf . ${pb}/${arch}/portbuild.conf . ${pb}/scripts/buildenv @@ -48,7 +49,7 @@ cleandir ${tmpdir} mkdir -p ${tmpdir} # Copy the files into the tmpdir from an existing built world -destdir=${worlddir}/${arch}/${branch} +destdir=${WORLDDIR}/${arch}/${branch} cd ${destdir}; find -dx . | \ grep -v -E '^./usr/(local|obj|opt|ports|src)' | \ grep -v '^./home' | \ diff --git a/Tools/portbuild/scripts/prunefailure b/Tools/portbuild/scripts/prunefailure index 93da403..a7a0e68 100755 --- a/Tools/portbuild/scripts/prunefailure +++ b/Tools/portbuild/scripts/prunefailure @@ -28,10 +28,10 @@ branch=$2 buildid=$3 shift 3 +. ${pb}/conf/server.conf . ${pb}/${arch}/portbuild.conf . ${pb}/scripts/buildenv - builddir=${pb}/${arch}/${branch}/builds/${buildid} buildenv ${pb} ${arch} ${branch} ${builddir} diff --git a/Tools/portbuild/scripts/reportload b/Tools/portbuild/scripts/reportload index 56ec0df..1d18043 100755 --- a/Tools/portbuild/scripts/reportload +++ b/Tools/portbuild/scripts/reportload @@ -1,12 +1,14 @@ #!/bin/sh -# -# This is run on the clients to report their loads to the server. +# $FreeBSD$ + +# client script to report load to the server. -# configurable variables pb=/var/portbuild +# note: uname is not being overridden arch=$(uname -m) osver=$(sysctl -n kern.osreldate) +. ${pb}/${arch}/client.conf . ${pb}/${arch}/portbuild.conf if [ -f ${pb}/${arch}/portbuild.$(hostname) ]; then . ${pb}/${arch}/portbuild.$(hostname) |