nrelease: Add pkg(8) to our images and ISOs.
authorSascha Wildner <saw@online.de>
Sun, 21 Apr 2013 09:15:06 +0000 (11:15 +0200)
committerSascha Wildner <saw@online.de>
Sun, 21 Apr 2013 09:15:20 +0000 (11:15 +0200)
'make release' now requires an additional directory with the dports tree.

This commit adds some more steps (such as running 'pkg autoremove').

In-discussion-with: marino

nrelease/Makefile
share/man/man7/release.7

index bf0b525..6da86c1 100644 (file)
@@ -70,6 +70,10 @@ PKGSRC_PACKAGES?=    pkgtools/pkg_leaves \
                        net/csup \
                        ${PKGSRC_EXTRA_PACKAGES}
 
+# dports packages to be built and installed on the release ISO
+#
+DPORTS_PACKAGES+=      ports-mgmt/pkg
+
 # pkgsrc options to use when building packages
 #
 PKGSRC_OPTIONS+=       MAKE_JOBS=${MAKE_JOBS}
@@ -213,12 +217,20 @@ check:
        @echo "package building.  For example /usr/pkgsrc.  See the Makefile"
        @echo "in /usr if you are unfamiliar with pkgsrc."
 .endif
+.if !defined(DPORTS_PATH)
+       @echo "Please set DPORTS_PATH to the dports tree that shall be used for"
+       @echo "package building.  For example /usr/dports.  See the Makefile"
+       @echo "in /usr if you are unfamiliar with dports."
+.endif
 .if !exists (${PKGBIN_MKISOFS})
        @/usr/bin/false
 .endif
 .if !defined(PKGSRC_PATH)
        @/usr/bin/false
 .endif
+.if !defined(DPORTS_PATH)
+       @/usr/bin/false
+.endif
 
 buildworld1 buildworld2:
        cd ${.CURDIR}/..; \
@@ -325,9 +337,11 @@ customizeiso:
        ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
        -@umount ${ISOROOT}/usr/pkgsrc/distfiles
        -@umount ${ISOROOT}/usr/pkgsrc
+       -@umount ${ISOROOT}/usr/dports
        -@umount ${ISOROOT}/dev
        mkdir -p ${ISODIR}/distfiles
        rm -rf ${ISOROOT}/usr/pkgobj
+       rm -rf ${ISOROOT}/usr/obj/dports
        #
        # Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable.
        # Make /usr/pkgsrc read-only for safety, else a failed umount and
@@ -336,7 +350,9 @@ customizeiso:
        mkdir -p ${ISOROOT}/usr/pkgobj
        mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap
        mkdir -p ${ISOROOT}/usr/pkgsrc
+       mkdir -p ${ISOROOT}/usr/dports
        mount_null -o ro ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc
+       mount_null -o ro ${DPORTS_PATH} ${ISOROOT}/usr/dports
        mount_null /dev ${ISOROOT}/dev
        cp /etc/shells ${ISOROOT}/usr/pkgsrc/distfiles/.test > /dev/null 2>&1 \
            || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/pkgsrc/distfiles
@@ -377,6 +393,12 @@ customizeiso:
        ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \
            (bmake check > /dev/null 2>&1 || \
            env USE_DESTDIR=no bmake ${PKGSRC_OPTIONS} clean build install)"
+.endfor
+.for PKG in ${DPORTS_PACKAGES}
+       chroot ${ISOROOT} sh -c "cd /usr/dports/${PKG} && make && make install"
+.endfor
+.for PKG in ${DPORTS_PACKAGES}
+       chroot ${ISOROOT} sh -c "cd /usr/dports/${PKG} && make clean"
 .endfor
        #
        # Remove packages which nothing depends on, add a whatis database
@@ -384,11 +406,21 @@ customizeiso:
        # clean up
        #
        ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
+       ${CHROOT_CMD} "yes | pkg autoremove"
        ${CHROOT_CMD} "makewhatis /usr/pkg/man"
        -umount ${ISOROOT}/usr/pkgsrc/distfiles
        umount ${ISOROOT}/usr/pkgsrc
+       umount ${ISOROOT}/usr/dports
        rm -rf ${ISOROOT}/usr/pkgobj
+       rm -rf ${ISOROOT}/usr/obj/dports
        rm -f ${ISOROOT}/etc/resolv.conf
+       #
+       # Add a pkg.conf
+       #
+       ${CHROOT_CMD} "echo PACKAGESITE: http://avalon.dragonflybsd.org/dports/$$\\{ABI\\}/RELEASE >/usr/local/etc/pkg.conf"
+       #
+       # Finally, update the locate(8) database
+       #
        ${CHROOT_CMD} /etc/periodic/weekly/310.locate
        umount ${ISOROOT}/dev
        #
@@ -463,6 +495,7 @@ mkimg:
 clean:
        -umount ${ISOROOT}/usr/pkgsrc/distfiles > /dev/null 2>&1
        -umount ${ISOROOT}/usr/pkgsrc > /dev/null 2>&1
+       -umount ${ISOROOT}/usr/dports > /dev/null 2>&1
        -umount ${ISOROOT}/dev > /dev/null 2>&1
        -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT};           \
            vnconfig -u `cat ${ISODIR}/vn.which`; fi
index ebd47ab..973f6be 100644 (file)
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man7/release.7,v 1.3.2.6 2003/04/12 20:42:30 murray Exp $
 .\"
-.Dd May 12, 2010
+.Dd April 21, 2013
 .Dt NRELEASE 7
 .Os
 .Sh NAME
@@ -156,6 +156,8 @@ to be added to the ISO.
 Location of
 .Xr pkgsrc 7
 tree to be used for package building.
+.It Va DPORTS_PATH
+Location of dports tree to be used for package building.
 .It Va PKGSRC_PKG_PATH
 Specifies the location where binary
 .Xr pkgsrc 7