summaryrefslogtreecommitdiffstats
path: root/Tools/portbuild
diff options
context:
space:
mode:
authorkris <kris@FreeBSD.org>2003-02-22 22:25:12 +0000
committerkris <kris@FreeBSD.org>2003-02-22 22:25:12 +0000
commitce6fbb6b902a9ec2e54316c2067a3c997102e047 (patch)
tree9a19b3614cbe32098c52cb27a7200409d4fc73c0 /Tools/portbuild
parent8fe1503464ace8516a4f18a07adad9e3e7a5c197 (diff)
downloadFreeBSD-ports-ce6fbb6b902a9ec2e54316c2067a3c997102e047.zip
FreeBSD-ports-ce6fbb6b902a9ec2e54316c2067a3c997102e047.tar.gz
* 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]
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 42b10c0..29bf56b 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
OpenPOWER on IntegriCloud