NetBSD Problem Report #34839

From kre@munnari.OZ.AU  Tue Oct 17 10:17:18 2006
Return-Path: <kre@munnari.OZ.AU>
Received: from ( [])
	by (Postfix) with ESMTP id 49CEA63B874
	for <>; Tue, 17 Oct 2006 10:17:18 +0000 (UTC)
Message-Id: <>
Date: Tue, 17 Oct 2006 17:16:01 +0700 (ICT)
From: kre@munnari.OZ.AU
Subject: pkgtools/pkg_comp suggested enhancement to leave it dirty
X-Send-Pr-Version: 3.95

>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
>Last-Modified:  Thu Jul 24 15:09:24 +0000 2014
>Originator:     Robert Elz
>Release:        NetBSD 3.99.15  (pkgsrc current as of a few hours ago)
	Prince of Songkla University

System: NetBSD 3.99.15 NetBSD 3.99.15 (GENERIC-1.696-20060125) #8: Wed Jan 25 04:59:39 ICT 2006 i386
Architecture: i386
Machine: i386
	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.

	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...)

	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).


---	2006-06-17 19:18:24.000000000 +0700
@@ -172,7 +172,7 @@ warn()
-    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
+    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`
-make clean
+	$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
     chmod +x $script
@@ -888,13 +890,14 @@ pkg_removeroot()

 # Parse options
-args=`getopt c:C:n $*`
+args=`getopt c:C:nd $*`
 if [ $? != 0 ]; then
 set -- $args
 while [ $# -gt 0 ]; do
     case "$1" in
@@ -910,6 +913,9 @@ while [ $# -gt 0 ]; do
+	-d)
+	    cleanup=false
+	    ;;
             shift; break

--- pkg_comp.8	2006-02-11 06:41:20.000000000 +0700
+++ pkg_comp.8-UPDATED
@@ -41,6 +41,7 @@
 .Ar conf_file
 .Op Fl n
+.Op Fl d
 .Ar target
 .Op Ar pkg_name ...
@@ -78,6 +79,13 @@ Avoid installation of
 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.
 .Ss What to use it for?
 You can use



Responsible-Changed-From-To: pkg-manager->jmmv
Responsible-Changed-When: Thu, 19 Oct 2006 00:14:56 +0000
Assigned to package maintainer, jmmv.

Responsible-Changed-From-To: jmmv->pkg-manager
Responsible-Changed-When: Thu, 24 Jul 2014 15:09:24 +0000


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.