pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/50987: Support setting real work directory in pkg_comp



>Number:         50987
>Category:       pkg
>Synopsis:       Support setting real work directory in pkg_comp
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 20 17:35:01 +0000 2016
>Originator:     Jan Danielsson
>Release:        current
>Organization:
La Cosa Nostra
>Environment:
NetBSD gauss 7.0_STABLE NetBSD 7.0_STABLE (GAUSS) #0: Sat Dec 19 16:31:59 CET 2015  jan@gauss:/home/jan/tmp/sysbuild/obj.amd64/usr/src/sys/arch/amd64/compile/GAUSS amd64
>Description:
I have a tmpfs mounted and plenty of ram to spare, and I'd like to use it for storing intermediate build files while building packages in a pkg_comp chroot.
>How-To-Repeat:
Read sources/manpage and realize there is no way to set "real" location of pkg_comp/obj.
>Fix:
Perhaps something along the line of:

Index: pkg_comp.8
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_comp/files/pkg_comp.8,v
retrieving revision 1.41
diff -u -r1.41 pkg_comp.8
--- pkg_comp.8	21 Nov 2015 23:10:27 -0000	1.41
+++ pkg_comp.8	20 Mar 2016 17:23:06 -0000
@@ -440,6 +440,9 @@
 Mount options.
 Defaults to
 .Sy -t null -o ro .
+.It REAL_WORKDIR
+Where to store intermediate build targets while building packages.
+Defaults to nothing.
 .It MAKEROOT_HOOKS
 A whitespace separated list of functions or external scripts to be executed
 after the sandbox is created.
Index: pkg_comp.sh
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh,v
retrieving revision 1.43
diff -u -r1.43 pkg_comp.sh
--- pkg_comp.sh	21 Nov 2015 23:10:27 -0000	1.43
+++ pkg_comp.sh	20 Mar 2016 17:23:07 -0000
@@ -51,7 +51,8 @@
                 REAL_PACKAGES REAL_PACKAGES_OPTS REAL_PKGVULNDIR \
                 NETBSD_RELEASE MAKEROOT_HOOKS MOUNT_HOOKS UMOUNT_HOOKS \
                 SYNC_UMOUNT AUTO_TARGET AUTO_PACKAGES BUILD_PACKAGES \
-                REAL_CCACHE LIBKVER_STANDALONE_PREFIX GENERATE_PKG_SUMMARY"
+                REAL_CCACHE LIBKVER_STANDALONE_PREFIX GENERATE_PKG_SUMMARY \
+                REAL_WORKDIR"
 
 _BUILD_RESUME=
 
@@ -126,6 +127,7 @@
     : ${SYNC_UMOUNT:=no}
     : ${REAL_CCACHE:=}
     : ${GENERATE_PKG_SUMMARY:=yes}
+    : ${REAL_WORKDIR:=}
 
     if [ -n "${MAKE_PACKAGES}" ]; then
         warn "MAKE_PACKAGES is deprecated; use {AUTO,BUILD}_PACKAGES instead."
@@ -280,6 +282,15 @@
         mount -t null -o rw ${REAL_CCACHE} ${DESTDIR}/pkg_comp/ccache
     fi
 
+    if [ -n "${REAL_WORKDIR}" ]; then
+        if [ ! -d "${REAL_WORKDIR}" ]; then
+            echo " failed."
+            fsumount
+            err "REAL_WORKDIR ${REAL_WORKDIR} disappeared"
+        fi
+        mount -t null -o rw ${REAL_WORKDIR} ${DESTDIR}/pkg_comp/obj
+    fi
+
     touch $fsstate
 
     if [ -n "${MOUNT_HOOKS}" ]; then
@@ -340,6 +351,10 @@
         umount ${DESTDIR}/pkg_comp/ccache || fsfailed=yes
     fi
 
+    if [ -n "${REAL_WORKDIR}" -a -d "${REAL_WORKDIR}" ]; then
+        umount ${DESTDIR}/pkg_comp/obj || fsfailed=yes
+    fi
+
     if [ "$SYNC_UMOUNT" != "no" ]; then
         printf "Syncing: 1"
         sync ; sleep 1



Home | Main Index | Thread Index | Old Index