From 1b3b024af8e69dc532c4db72c10946b0571e1bdf Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 21 Aug 2012 23:46:58 -0700 Subject: [PATCH] fastbulk - Adjustments to fix various issues (2) * Use tmpfs for /usr/obj, this speeds up builds by a lot. make w/ -DNOTMPFS will use the hard drive if your tmpfs isn't big enough. * Cleanup {chroot}/tmp/logs/run/* when restarting * When restarting handle the case where the correct package has already been installed. * When restarting handle the case where the binary package already exists. * Use pkg_add -f when adding existing packages. --- test/fastbulk/Makefile | 12 +++++++++++- test/fastbulk/dobuild | 32 ++++++++++++++++++++++++++++---- test/fastbulk/mk.conf.add | 8 ++++++++ 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 test/fastbulk/mk.conf.add diff --git a/test/fastbulk/Makefile b/test/fastbulk/Makefile index 7d0cf3d..4f40c8e 100644 --- a/test/fastbulk/Makefile +++ b/test/fastbulk/Makefile @@ -10,6 +10,7 @@ SYSPKGSRC=/usr/pkgsrc SYSROOT=/ CHROOTENV=chroot ${BUILDROOT} /bin/sh -c NPARALLEL?= 8 +# -DNOTMPFS all: @echo "fastbulk build options" @@ -30,6 +31,9 @@ all: @echo "NOTE: ${BUILDBASE}/{distfiles,packages} are normally retained" @echo " to avoid having to re-pull and for incremental operation" @echo "" + @echo "NOTE: When building with 'make build' the current progress" + @echo " is in ${BUILDROOT}/tmp/logs/{run,good,bad}, each build" + @echo " has its own log file named after the pkgsrc path" scratch: cleanup rm -rf ${BUILDBASE}/var.db @@ -82,13 +86,17 @@ setup: cleanup mount_null ${BUILDBASE}/etc ${BUILDROOT}/etc mount_null ${BUILDBASE}/usr.pkg ${BUILDROOT}/usr/pkg mount_null ${BUILDBASE}/usr.pkgsrc ${BUILDROOT}/usr/pkgsrc +.if defined(NOTMPFS) mount_null ${BUILDBASE}/usr.obj ${BUILDROOT}/usr/obj +.else + mount_tmpfs dummy ${BUILDROOT}/usr/obj +.endif mount_null ${BUILDBASE}/var.db ${BUILDROOT}/var/db mount_null ${BUILDBASE}/var.db.pkg ${BUILDROOT}/var/db/pkg mount_null ${BUILDBASE}/var.db.pkg.refcount \ ${BUILDROOT}/var/db/pkg.refcount mount_null ${SYSROOT}/dev ${BUILDROOT}/dev - cpdup -v -s0 -i0 -X ${.CURDIR}/pkgsrc.ign \ + cpdup -s0 -i0 -X ${.CURDIR}/pkgsrc.ign \ ${SYSPKGSRC} ${BUILDROOT}/usr/pkgsrc find ${BUILDROOT}/usr/pkgsrc -name work | xargs rm -rf mkdir -p ${BUILDROOT}/usr/pkgsrc/packages @@ -134,6 +142,7 @@ bootstrap: rm -rf ${BUILDBASE}/usr.obj/work ${CHROOTENV} "cd /usr/pkgsrc/bootstrap; ./bootstrap --workdir=/usr/obj/work" resident ${BUILDROOT}/usr/pkg/bin/bmake + cat mk.conf.add >> ${BUILDROOT}/usr/pkg/etc/mk.conf # Figure out what has changed and deinstall the related packages # @@ -164,6 +173,7 @@ changes: ${PRESTAGE} build: ${PRESTAGE} rm -rf ${BUILDBASE}/usr.obj/work mkdir -p ${BUILDBASE}/usr.obj/work + -rm ${BUILDROOT}/tmp/logs/run/* ${CHROOTENV} "cd /tmp/track; ./fastbulk -j ${NPARALLEL} /usr/pkgsrc" ${BUILDBASE}/bin/getpkgsrcdir: getpkgsrcdir.c diff --git a/test/fastbulk/dobuild b/test/fastbulk/dobuild index 9ee34f7..2f007a9 100755 --- a/test/fastbulk/dobuild +++ b/test/fastbulk/dobuild @@ -8,11 +8,30 @@ # set pkgname = "`bmake show-var VARNAME=PKGNAME`" set logname = $argv[1] -if ( -f /usr/pkgsrc/packages/All/${pkgname}.tgz ) then - rm -f /tmp/logs/run/$logname +unsetenv PKG_PATH + +# Check if already installed, prevent overwrite of +# previous run's logfile if it exists, else put in +# a simple logfile. +# +pkg_info -q -e $pkgname +if ( $status == 0 ) then + if ( -f /tmp/logs/good/$logname ) then + rm -f /tmp/logs/run/$logname + endif + echo "(already installed from previous run)" exit 0 endif +if ( -f /usr/pkgsrc/packages/All/${pkgname}.tgz ) then + echo "(found in /usr/pkgsrc/packages)" + bmake deinstall DEINSTALLDEPENDS=ALL SKIP_LICENSE_CHECK=yes + setenv PKG_PATH /usr/pkgsrc/packages/All + echo "pkg_add -f ${pkgname}" + pkg_add -f ${pkgname} + exit $status +endif + # We have to remove any conflicting packages or the one we # are trying to build will refuse to build. Note that we # leave the related packages intact. @@ -31,5 +50,10 @@ end # bmake deinstall DEINSTALLDEPENDS=ALL SKIP_LICENSE_CHECK=yes bmake repackage clean SKIP_LICENSE_CHECK=yes -bmake bin-install -exit $status +if ( $status == 0 ) then + setenv PKG_PATH /usr/pkgsrc/packages/All + echo "pkg_add -f ${pkgname}" + pkg_add -f ${pkgname} + exit $status +endif +exit 1 diff --git a/test/fastbulk/mk.conf.add b/test/fastbulk/mk.conf.add new file mode 100644 index 0000000..36a0dc2 --- /dev/null +++ b/test/fastbulk/mk.conf.add @@ -0,0 +1,8 @@ + +# Fastbulk additions to /usr/pkg/etc/mk.conf +# +.ifdef BSD_PKG_MK + +WRKOBJDIR= /usr/obj/work + +.endif -- 1.7.7.2