summaryrefslogtreecommitdiff
path: root/Tools/portbuild
diff options
context:
space:
mode:
authorKris Kennaway <kris@FreeBSD.org>2003-02-22 22:25:12 +0000
committerKris Kennaway <kris@FreeBSD.org>2003-02-22 22:25:12 +0000
commite0d90467e6f06b99590244a936d9ccf3795d8dcb (patch)
tree4d6d29413ce5970baab3b42d70dd5c2d1907ef78 /Tools/portbuild
parentIf ${buildworld}=1 in mkbindist.conf, then use the makeworld script to (diff)
* Allow port builds to be started with a certain niceness ('nice' parameter
in portbuild.conf). [1] * Build stage 2 builds in a jail instead of a chroot. This allows us to detect ports that attempt IP communication during the build, as well as allowing clean termination of the port build (packages built in a chroot can leave processes hanging around after the build finishes). There are some caveats with this approach which will be worked around in a future commit. Requested by: peter [1]
Notes
Notes: svn path=/head/; revision=76205
Diffstat (limited to 'Tools/portbuild')
-rwxr-xr-xTools/portbuild/scripts/portbuild16
1 files changed, 15 insertions, 1 deletions
diff --git a/Tools/portbuild/scripts/portbuild b/Tools/portbuild/scripts/portbuild
index 42b10c0ab780..29bf56beb4f5 100755
--- a/Tools/portbuild/scripts/portbuild
+++ b/Tools/portbuild/scripts/portbuild
@@ -46,6 +46,9 @@ pb=/var/portbuild
arch=$1
shift
+# Default niceness value
+nice=0
+
. ${pb}/${arch}/portbuild.conf
. ${pb}/scripts/buildenv
@@ -152,6 +155,12 @@ if [ ${found} != 1 ]; then
cp -p /usr/bin/killall ${chroot}/usr/bin
fi
+# Figure out jail IP addr
+chrootpid=$(basename ${chroot})
+ip1=$(($chrootpid /(256*256)))
+ip2=$((($chrootpid - ($ip1*256*256)) /256))
+ip3=$((($chrootpid - ($ip1*256*256) - ($ip2*256))))
+
# Set up desired uname version
echo ${OSREL}-${BRANCH} > ${chroot}/usr/bin/UNAME_VERSION
@@ -229,6 +238,7 @@ cp -p ${pb}/scripts/buildscript ${chroot}
cp -p ${pb}/scripts/pnohang.${arch} ${chroot}/pnohang
# phase 1, make checksum
+# Needs to be chroot so that port can be fetched
chroot ${chroot} /buildscript ${dirname} 1 2>&1 | tee -a ${chroot}/tmp/${pkgname}.log
if [ -f ${chroot}/tmp/status ]; then
error=$(cat ${chroot}/tmp/status)
@@ -245,7 +255,11 @@ if [ "${error}" = 0 ]; then
# phase 2, make package
ln -sf ${pkgname}.log2 ${chroot}/tmp/make.log
- chroot ${chroot} /buildscript ${dirname} 2 > ${chroot}/tmp/${pkgname}.log2 2>&1
+
+ ifconfig lo0 alias 10.${ip1}.${ip2}.${ip3}/32
+ jail ${chroot} jail-${chroot} 10.${ip1}.${ip2}.${ip3} /usr/bin/nice -n $nice /buildscript ${dirname} 2 > ${chroot}/tmp/${pkgname}.log2 2>&1
+ ifconfig lo0 delete 10.${ip1}.${ip2}.${ip3}
+
grep pnohang ${chroot}/tmp/${pkgname}.log2
cat ${chroot}/tmp/${pkgname}.log2 >> ${chroot}/tmp/${pkgname}.log
rm ${chroot}/tmp/${pkgname}.log2