pkgsrc-Bugs archive

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

pkg/34839: pkgtools/pkg_comp suggested enhancement to leave it dirty



>Number:         34839
>Category:       pkg
>Synopsis:       pkgtools/pkg_comp suggested enhancement to leave it dirty
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 17 10:20:00 +0000 2006
>Originator:     Robert Elz
>Release:        NetBSD 3.99.15  (pkgsrc current as of a few hours ago)
>Organization:
        Prince of Songkla University
>Environment:
        
        
System: NetBSD jade.coe.psu.ac.th 3.99.15 NetBSD 3.99.15 
(GENERIC-1.696-20060125) #8: Wed Jan 25 04:59:39 ICT 2006 
kre%jade.coe.psu.ac.th@localhost:/usr/obj/current/kernels/JADE_ASUS i386
Architecture: i386
Machine: i386
>Description:
        pkg_comp always does "make clean" when it is done, successful or not.
        That's fine for keeping everything nice and clean, when everything
        is working, or when you simply don't really care why something does
        not correctly build.   But if you're attempting to debug a package
        build problem, always cleaning is perhaps not the bext choice
        (and yes, I know it is possible to "pkg_comp chroot", and then
        "cd /usr/pkgsrc/whatever && make" but that isn't always convenient.

        So, I am suggesting/requesting a minor enhancement that will allow
        pkg_comp to skip the "make clean" when instructed.   (As a side
        effect of the way pkgsrc works. this allows "pkg_comp build" to continue
        from where it failed, if the problem is corrected, in the sandbox,
        rather than needing to correct things the "right way" and start
        all over again - which is great when you're still experimenting to
        try and work out what the 'right way' really is.

>How-To-Repeat:
        Build any package with pkg_comp, using "pkg_comp build", particularly
        one where the build is going to fail for some reason, durig
        compilation.   Attempt to find a simple way to keep the
        extracted/patched work files around so the problem can be diagnosed.
        Find instead just anicely cleaned sandbox (nb: I do not recommend
        interrupting the "pkg_comp build" when the error is detected,
        before the "make clean" gets a chance to run - NetBSD's union
        filesystems have bugs that can crash the kernel, and do it fr me
        repeatedly when I get viscious with the interrupt key...)

>Fix:
        Apply the following (fairly simple) patch (to the script and doc)
        in the pkgtools/pkg_comp/files directory.   This adds a "-d" flag
        to pkg_comp which simply causes it to skip all instances of
        "make clean".  A command to actually perform the "make clean" later
        might be useful - but for me, "removeroot" does that well enough
        (and is necessary to keep the sandbox truly clean anyway).


$NetBSD$

--- pkg_comp.sh 2006-06-17 19:18:24.000000000 +0700
+++ pkg_comp.sh-UPDATED
@@ -172,7 +172,7 @@ warn()
 #
 usage()
 {
-    echo "usage: $ProgName [-(c|C) conf_file] [-n] target [pkg_names]" 1>&2
+    echo "usage: $ProgName [-(c|C) conf_file] [-n] [-d] target [pkg_names]" 
1>&2
     exit 1
 }
 
@@ -223,6 +223,8 @@ EOF
 #
 fsmount()
 {
+    test -w "${DESTDIR}" || err "Unable to write to ${DESTDIR}"
+
     echo "PKG_COMP ==> Mounting sandboxed filesystems"
     if [ -f $fsstate ]; then
         count=`cat $fsstate`
@@ -734,8 +736,8 @@ make $BUILD_TARGET
 if [ \$? != 0 ]; then
     touch /pkg_comp/tmp/`basename $statfile`
 fi
-make clean
 EOF
+       $cleanup && echo make clean >> "$script"
         chmod +x $script
         chroot $DESTDIR /pkg_comp/tmp/`basename $script`
         rm $script
@@ -779,7 +781,7 @@ fail=\$(make show-var VARNAME=PKG_FAIL_R
 if echo \$fail | grep "package tools installed on this system are out of date" 
>/dev/null; then
     echo "PKG_COMP ==> pkg_install is out of date; rebuilding"
     cd /usr/pkgsrc/pkgtools/pkg_install
-    make && make install && make clean
+    make && make install && $cleanup && make clean
 fi
 EOF
     chmod +x $script
@@ -888,13 +890,14 @@ pkg_removeroot()
 confdir="$HOME/pkg_comp"
 
 # Parse options
-args=`getopt c:C:n $*`
+args=`getopt c:C:nd $*`
 if [ $? != 0 ]; then
     usage
 fi
 set -- $args
 conffile=
 nflag=no
+cleanup=true
 while [ $# -gt 0 ]; do
     case "$1" in
         -c)
@@ -910,6 +913,9 @@ while [ $# -gt 0 ]; do
         -n)
             nflag=yes
             ;;
+       -d)
+           cleanup=false
+           ;;
         --)
             shift; break
             ;;
$NetBSD$

--- pkg_comp.8  2006-02-11 06:41:20.000000000 +0700
+++ pkg_comp.8-UPDATED
@@ -41,6 +41,7 @@
 .Ar conf_file
 .Oc
 .Op Fl n
+.Op Fl d
 .Ar target
 .Op Ar pkg_name ...
 .Sh DESCRIPTION
@@ -78,6 +79,13 @@ Avoid installation of
 and
 .Va BUILD_PACKAGES
 during the creation of the chroot.
+.It Fl d
+Enable package debug mode
+by not running
+.Ql "make clean
+after building a package.
+This allows the package work directory to be inspected
+to help locate build problems.
 .El
 .Ss What to use it for?
 You can use

>Unformatted:
        
        



Home | Main Index | Thread Index | Old Index