pkgsrc-Bugs archive

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

pkg/47427: pkgsrc pkgtools/pkg_comp fixes / enhancements (proposing update: 1.37 -> 1.38) [patch included]



>Number:         47427
>Category:       pkg
>Synopsis:       pkgsrc pkgtools/pkg_comp fixes / enhancements (proposing 
>update: 1.37 -> 1.38) [patch included]
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   unknown
>Arrival-Date:   Wed Jan 09 14:35:06 +0000 2013
>Originator:     Bug Hunting
>Release:        NetBSD 6.0
>Description:

pkgsrc' pkgtools/pkg_comp package can need quite some updates and
corrections; both in the script itself, as in its man page.

A detailed list of proposed changes can be extracted from the top
lines of the patch attached.


>How-To-Repeat:

Install and use pkgsrc' pkgtools/pkg_comp

and

"man -s 1 pkg_comp".


>Fix:

Apply the patch attached.  The top lines of it provide a proposed
commit message, to which a reference to this PR should be added
though.

(If the version change (as in the new Makefile) is indeed made,
please update pkgsrc/doc/CHANGES-2013 accordingly as well.)

Thanks.

--MnLPg7ZWsaic7Fhd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="pkg_comp_1.37.patch"

Changes to pkg_comp.sh (full list):

- fix / alter comments and program output (remove incorrect comment;
  wording; punctuation; white space);
- rename `USE_AUDIT_PACKAGES' variable to `COPY_PKG_VULNERABILITIES'
  (as audit-packages(8) isn't used anymore), and rename the function
  using it to better match the new name;
- provide sensible defaults for `PKGVULNDIR', `DISTRIBDIR', and
  `REAL_PKGVULNDIR';
- sort variable list;
- change `ROOTSHELL' variable from ksh(1) to sh(1);
- make `usage' consistent with man page's `SYNOPSIS' line;
- no longer (bogusly) create `destdir' when `-C' is used;
- sort order in option parsing part.


Changes to pkg_comp.8 (summarized list; most changes are self-explanatory):

- reality corrections, other fixes and enhancements;
- mdoc(7) macro corrections and enhancements;
- introduce ``operand'' operand naming (instead of just ``pkg_name'',
  since it's not always designating a package), and explain which
  targets use it and if so, how;
- provide more examples of cases to use pkg_comp(8) for;
- improve target descriptions;
- remove unneccesary references in `SEE ALSO';
- bump date.


Changes to DESCR:

- update description, again using the (new) man page as a source.


Changes to Makefile:

- update package version.


From Bug Hunting.

---

Index: pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh,v
retrieving revision 1.41
diff -u -r1.41 pkg_comp.sh
--- pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh  19 May 2012 10:54:40 -0000      
1.41
+++ pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh  9 Jan 2013 14:19:56 -0000
@@ -37,11 +37,10 @@
 # Default environment values and functions
 # ----------------------------------------------------------------------
 
-# USE_GCC3, CFLAGS, CPPFLAGS and CXXFLAGS are ommited from _MKCONF_VARS
-# as they require special handling.
+# USE_GCC3 is omitted from _MKCONF_VARS, as it requires special handling.
 _MKCONF_VARS="WRKDIR_BASENAME MKOBJDIRS BSDSRCDIR WRKOBJDIR DISTDIR PACKAGES \
               PKG_DEVELOPER CLEANDEPENDS LOCALBASE PKG_SYSCONFBASE \
-              CFLAGS CPPFLAGS CXXFLAGS USE_AUDIT_PACKAGES PKGVULNDIR \
+              CFLAGS CPPFLAGS CXXFLAGS COPY_PKG_VULNERABILITIES PKGVULNDIR \
               USE_XPKGWEDGE PKGSRC_COMPILER \
               LIBKVER_STANDALONE_PREFIX PKG_DBDIR"
 
@@ -95,19 +94,19 @@
     : ${CPPFLAGS:=}
     : ${CXXFLAGS:=}
     : ${USE_GCC3:=no}
-    : ${USE_AUDIT_PACKAGES:=yes}
-    : ${PKGVULNDIR:=/usr/pkg/share}
+    : ${COPY_PKG_VULNERABILITIES:=yes}
+    : ${PKGVULNDIR:=/var/db/pkg}
+    : ${PKG_DBDIR:=/var/db/pkg}
     : ${USE_XPKGWEDGE:=yes}
     : ${PKGSRC_COMPILER:=gcc}
-    : ${PKG_DBDIR:=/var/db/pkg}
 
     # Default values for global variables used in the script.
     : ${DESTDIR:=/var/chroot/pkg_comp/default}
-    : ${ROOTSHELL:=/bin/ksh}
+    : ${ROOTSHELL:=/bin/sh}
     : ${COPYROOTCFG:=no}
     : ${AUTO_TARGET:=package}
     : ${BUILD_TARGET:=package}
-    : ${DISTRIBDIR:=/var/pub/NetBSD}
+    : ${DISTRIBDIR:=/usr/INSTALL}
     : ${SETS:=base.tgz comp.tgz etc.tgz kern-GENERIC.tgz text.tgz}
     : ${SETS_X11:=xbase.tgz xcomp.tgz xetc.tgz xfont.tgz xserver.tgz}
     : ${REAL_SRC:=/usr/src}
@@ -118,7 +117,7 @@
     : ${REAL_DISTFILES_OPTS:=-t null -o rw}
     : ${REAL_PACKAGES:=/usr/pkgsrc/packages}
     : ${REAL_PACKAGES_OPTS:=-t null -o rw}
-    : ${REAL_PKGVULNDIR:=/usr/pkgsrc/distfiles}
+    : ${REAL_PKGVULNDIR:=/var/db/pkg}
     : ${NETBSD_RELEASE:=no}
     : ${LIBKVER_STANDALONE_PREFIX:=/libkver}
     : ${MAKEROOT_HOOKS:=}
@@ -129,7 +128,7 @@
     : ${GENERATE_PKG_SUMMARY:=yes}
 
     if [ -n "${MAKE_PACKAGES}" ]; then
-        warn "MAKE_PACKAGES is deprecated; use {AUTO,BUILD}_PACKAGES instead."
+        warn "MAKE_PACKAGES is deprecated; use AUTO_PACKAGES/BUILD_PACKAGES 
instead."
         : ${AUTO_PACKAGES:=${MAKE_PACKAGES}}
         : ${BUILD_PACKAGES:=${MAKE_PACKAGES}}
     fi
@@ -143,6 +142,11 @@
         warn "UMOUNT_SCRIPT is deprecated; use UMOUNT_HOOKS instead."
         : ${UMOUNT_HOOKS:=${UMOUNT_SCRIPT}}
     fi
+
+    if [ -n "${USE_AUDIT_PACKAGES}" ]; then
+        warn "USE_AUDIT_PACKAGES is deprecated; use COPY_PKG_VULNERABILITIES 
instead."
+        : ${COPY_PKG_VULNERABILITIES:=${USE_AUDIT_PACKAGES}}
+    fi
 }
 
 # ----------------------------------------------------------------------
@@ -170,22 +174,22 @@
 
 # usage
 #
-#   Shows an usage message and exits.
+#   Shows a usage message and exits.
 #
 usage()
 {
-    echo "usage: $ProgName [-(c|C) conf_file] [-Nn] target [pkg_names]" 1>&2
+    echo "usage: $ProgName [-Nn] [-(C|c) conffile] target [operand ...]" 1>&2
     exit 1
 }
 
-# copy_vulnerabilities
+# copy_pkg_vulnerabilities
 #
-#   If USE_AUDIT_PACKAGES is set to 'yes', this function copies the
+#   If COPY_PKG_VULNERABILITIES is set to 'yes', this function copies the
 #   system-wide pkg-vulnerabilities file inside the sandbox.
 #
-copy_vulnerabilities()
+copy_pkg_vulnerabilities()
 {
-    if [ "$USE_AUDIT_PACKAGES" = "yes" ]; then
+    if [ "$COPY_PKG_VULNERABILITIES" = "yes" ]; then
         echo "PKG_COMP ==> Installing new \`pkg-vulnerabilities' file"
         if [ ! -f "$REAL_PKGVULNDIR/pkg-vulnerabilities" ]; then
             echo "$REAL_PKGVULNDIR/pkg-vulnerabilities not found."
@@ -216,16 +220,16 @@
 }
 
 # ----------------------------------------------------------------------
-# Filesystem functions
+# File system functions
 # ----------------------------------------------------------------------
 
 # fsmount
 #
-#   Mounts all sandboxed filesystems, if they are not mounted yet.
+#   Mounts all sandboxed file systems, if they are not mounted yet.
 #
 fsmount()
 {
-    echo "PKG_COMP ==> Mounting sandboxed filesystems"
+    echo "PKG_COMP ==> Mounting sandboxed file systems"
     if [ -f $fsstate ]; then
         count=`cat $fsstate`
         count=$(($count + 1))
@@ -240,7 +244,7 @@
         if [ ! -d "$REAL_SRC" ]; then
             echo " failed."
             fsumount
-            err "REAL_SRC $REAL_SRC disappeared"
+            err "REAL_SRC $REAL_SRC disappeared."
         fi
         mount $REAL_SRC_OPTS $REAL_SRC $DESTDIR/usr/src
     fi
@@ -249,7 +253,7 @@
         if [ ! -d "$REAL_PKGSRC" ]; then
             echo " failed."
             fsumount
-            err "REAL_PKGSRC $REAL_PKGSRC disappeared"
+            err "REAL_PKGSRC $REAL_PKGSRC disappeared."
         fi
         mount $REAL_PKGSRC_OPTS $REAL_PKGSRC $DESTDIR/usr/pkgsrc
     fi
@@ -258,7 +262,7 @@
         if [ ! -d "$REAL_DISTFILES" ]; then
             echo " failed."
             fsumount
-            err "REAL_DISTFILES $REAL_DISTFILES disappeared"
+            err "REAL_DISTFILES $REAL_DISTFILES disappeared."
         fi
         mount $REAL_DISTFILES_OPTS $REAL_DISTFILES $DESTDIR/pkg_comp/distfiles
     fi
@@ -267,7 +271,7 @@
         if [ ! -d "$REAL_PACKAGES" ]; then
             echo " failed."
             fsumount
-            err "REAL_PACKAGES $REAL_PACKAGES disappeared"
+            err "REAL_PACKAGES $REAL_PACKAGES disappeared."
         fi
         mount $REAL_PACKAGES_OPTS $REAL_PACKAGES $DESTDIR/pkg_comp/packages
     fi
@@ -276,7 +280,7 @@
         if [ ! -d "${REAL_CCACHE}" ]; then
             echo " failed."
             fsumount
-            err "REAL_CCACHE ${REAL_CCACHE} disappeared"
+            err "REAL_CCACHE ${REAL_CCACHE} disappeared."
         fi
         mount -t null -o rw ${REAL_CCACHE} ${DESTDIR}/pkg_comp/ccache
     fi
@@ -293,11 +297,11 @@
 
 # fsumount
 #
-#   Unmounts all sandboxed filesystems, if they are not in use any more.
+#   Unmounts all sandboxed file systems, if they are not in use any more.
 #
 fsumount()
 {
-    echo "PKG_COMP ==> Unmounting sandboxed filesystems"
+    echo "PKG_COMP ==> Unmounting sandboxed file systems"
 
     if [ ! -f $fsstate ]; then
         echo "None mounted."
@@ -352,7 +356,7 @@
     fi
 
     if [ "$fsfailed" = "yes" ]; then
-        err "FATAL: failed to umount all filesystems"
+        err "FATAL: failed to unmount all file systems."
     else
         rm $fsstate
     fi
@@ -370,10 +374,12 @@
 pkg_maketemplate()
 {
     if [ -f "$conffile" ]; then
-        err "$conffile already exists"
+        err "configuration file $conffile already exists."
     fi
 
-    mkdir -p $confdir
+    if [ -n "$confdir" ]; then
+       mkdir -p "$confdir"
+    fi
     cat > $conffile <<EOF
 # -*- sh -*-
 #
@@ -396,7 +402,7 @@
         echo "$var=\"$val\"" >> $conffile
     done
 
-    echo "pkg_comp: $conffile created.  Edit the file by hand now."
+    echo "pkg_comp: configuration file $conffile created.  Edit the file by 
hand now."
 }
 
 # ----------------------------------------------------------------------
@@ -431,35 +437,35 @@
 {
     # Check for directories that will be null mounted.
     if [ -n "$REAL_SRC" -a ! -d "$REAL_SRC" ]; then
-        err "REAL_SRC $REAL_SRC does not exist"
+        err "REAL_SRC $REAL_SRC does not exist."
     fi
 
     if [ -n "$REAL_PKGSRC" -a ! -d "$REAL_PKGSRC" ]; then
-        err "REAL_PKGSRC $REAL_PKGSRC does not exist"
+        err "REAL_PKGSRC $REAL_PKGSRC does not exist."
     fi
 
     if [ -n "$REAL_DISTFILES" -a ! -d "$REAL_DISTFILES" ]; then
-        err "REAL_DISTFILES $REAL_DISTFILES does not exist"
+        err "REAL_DISTFILES $REAL_DISTFILES does not exist."
     fi
 
     if [ -n "$REAL_PACKAGES" -a ! -d "$REAL_PACKAGES" ]; then
-        err "REAL_PACKAGES $REAL_PACKAGES does not exist"
+        err "REAL_PACKAGES $REAL_PACKAGES does not exist."
     fi
 
     if echo ${PKGSRC_COMPILER} | grep ccache >/dev/null 2>&1 && \
         [ -z "${REAL_CCACHE}" ]; then
-        warn "PKGSRC_COMPILER contains 'ccache' but REAL_CCACHE is unset"
+        warn "PKGSRC_COMPILER contains 'ccache' but REAL_CCACHE is unset."
     elif [ -n "${REAL_CCACHE}" -a ! -d "${REAL_CCACHE}" ]; then
-        err "REAL_CCACHE ${REAL_CCACHE} does not exist"
+        err "REAL_CCACHE ${REAL_CCACHE} does not exist."
     fi
 
     # Check for required directories.
     if [ ! -d $DISTRIBDIR ]; then
-        err "DISTRIBDIR $DISTRIBDIR does not exist"
+        err "DISTRIBDIR $DISTRIBDIR does not exist."
     fi
 
     if [ -d $DESTDIR ]; then
-        err "DESTDIR $DESTDIR already exists"
+        err "DESTDIR $DESTDIR already exists."
     fi
 
     if [ "$SETS_X11" = "no" ]; then
@@ -470,7 +476,7 @@
 
     for s in $allsets; do
         if [ ! -f $DISTRIBDIR/binary/sets/$s ]; then
-            err "$DISTRIBDIR/binary/sets/$s does not exist"
+            err "$DISTRIBDIR/binary/sets/$s does not exist."
         fi
     done
 
@@ -532,8 +538,8 @@
 
     echo "PKG_DBDIR=${PKG_DBDIR}" >> ${DESTDIR}/etc/pkg_install.conf
 
-    # From now on, filesystems may be mounted, so we need to trap
-    # signals to umount them.
+    # From now on, file systems may be mounted, so we need to trap
+    # signals to unmount them.
     trap "echo \"*** Process aborted ***\" ; fsumount ; exit 1" INT QUIT
 
     makeroot_libkver
@@ -580,14 +586,14 @@
     if [ -n "$EXTRAMK" ]; then
         for mkfile in $EXTRAMK; do
             if [ ! -f "$mkfile" ]; then
-                err "Cannot find $mkfile"
+                err "cannot find $mkfile."
             else
                 cat $mkfile >> $file
             fi
         done
     fi
 
-    if [ "$USE_AUDIT_PACKAGES" != "yes" ]; then
+    if [ "$COPY_PKG_VULNERABILITIES" != "yes" ]; then
         echo "ALLOW_VULNERABLE_PACKAGES ?= YES" >> $file
     fi
 
@@ -666,15 +672,15 @@
     rfile=${DESTDIR}/pkg_comp/tmp/auto.list
     target="${AUTO_TARGET}"
 
-    [ -z "${REAL_PACKAGES}" ] && err "this is useless without REAL_PACKAGES"
+    [ -z "${REAL_PACKAGES}" ] && err "this is useless without REAL_PACKAGES."
     [ -z "${pkgs}" ] &&
-        err "this is useless without AUTO_PACKAGES nor package names"
+        err "this is useless without AUTO_PACKAGES or package names."
 
     if [ "$1" = resume ]; then
-        [ -f ${rfile} ] || err "there is no auto build to resume"
+        [ -f ${rfile} ] || err "there is no auto build to resume."
         pkgs=`cat ${rfile}`
     elif [ -f ${rfile} ]; then
-        err "there is an stopped auto build; removeroot first or resume it"
+        err "there is a stopped auto build; removeroot first or resume it."
     else
         makeroot
 
@@ -725,12 +731,12 @@
         fi
     done
     if [ -n "$invalid" ]; then
-        err "invalid packages:$invalid"
+        err "invalid packages:$invalid."
     fi
 
     # Build them
     fsmount
-    copy_vulnerabilities
+    copy_pkg_vulnerabilities
     failed=""
     for p in $pkgs; do
         echo "PKG_COMP ==> Building and installing $p"
@@ -843,9 +849,9 @@
 
     pkgs="$*"
 
-    [ -z "$REAL_PACKAGES" ] && err "REAL_PACKAGES is not set"
+    [ -z "$REAL_PACKAGES" ] && err "REAL_PACKAGES is not set."
 
-    copy_vulnerabilities
+    copy_pkg_vulnerabilities
 
     fsmount
     failed=""
@@ -877,9 +883,9 @@
 {
     local prefix script exitstatus
 
-    [ -d $DESTDIR ] || err "$DESTDIR does not exist"
+    [ -d $DESTDIR ] || err "$DESTDIR does not exist."
 
-    copy_vulnerabilities
+    copy_pkg_vulnerabilities
 
     fsmount
     echo "PKG_COMP ==> Entering sandbox \`$DESTDIR'"
@@ -915,7 +921,7 @@
 #
 pkg_removeroot()
 {
-    [ -f $fsstate ] && err "filesystems may still be mounted; cannot remove"
+    [ -f $fsstate ] && err "file systems may still be mounted; cannot remove."
     echo "PKG_COMP ==> Removing sandbox \`${DESTDIR}'"
     rm -rf $DESTDIR
 }
@@ -933,26 +939,27 @@
 fi
 set -- $args
 conffile=
-nflag=no
 Nflag=no
+nflag=no
 while [ $# -gt 0 ]; do
     case "$1" in
-        -c)
+        -C)
             [ -n "$conffile" ] && usage
-            conffile="$confdir/$2.conf"
+            conffile="$2"
+            unset confdir
             shift
             ;;
-        -C)
+        -c)
             [ -n "$conffile" ] && usage
-            conffile="$2"
+            conffile="$confdir/$2.conf"
             shift
             ;;
-        -n)
+        -N)
+            Nflag=yes
             nflag=yes
             ;;
-        -N)
+        -n)
             nflag=yes
-            Nflag=yes
             ;;
         --)
             shift; break
@@ -988,12 +995,12 @@
 readconf()
 {
     if [ -f $conffile ]; then
-        [ `id -u` -ne 0 ] && err "must be run as root"
+        [ `id -u` -ne 0 ] && err "must be run as root."
         env_clean
         . $conffile
         env_setdefaults
     else
-        err "$conffile does not exist"
+        err "configuration file $conffile does not exist."
     fi
 
     fsstate="$DESTDIR/pkg_comp/tmp/mount.stat"
@@ -1010,11 +1017,11 @@
         err "sandbox not initialized; use makeroot first."
     fi
     if [ "$DESTDIR" = "/" ]; then
-        err "DESTDIR cannot be /"
+        err "DESTDIR cannot be /."
     fi
 
-    # From now on, filesystems may be mounted, so we need to trap
-    # signals to umount them.
+    # From now on, file systems may be mounted, so we need to trap
+    # signals to unmount them.
     trap "echo \"*** Process aborted ***\" ; fsumount ; exit 1" INT QUIT
 }
 
@@ -1058,7 +1065,7 @@
         pkg_auto $args
         ;;
     *)
-        err "unknown target \`$target'"
+        err "unknown target \`$target'."
         ;;
 esac
 
Index: pkgsrc/pkgtools/pkg_comp/files/pkg_comp.8
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_comp/files/pkg_comp.8,v
retrieving revision 1.37
diff -u -r1.37 pkg_comp.8
--- pkgsrc/pkgtools/pkg_comp/files/pkg_comp.8   19 May 2012 10:54:39 -0000      
1.37
+++ pkgsrc/pkgtools/pkg_comp/files/pkg_comp.8   9 Jan 2013 14:19:56 -0000
@@ -27,69 +27,50 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 11, 2012
+.Dd January 9, 2013
 .Dt PKG_COMP 8
 .Os
 .Sh NAME
 .Nm pkg_comp
-.Nd build packages inside a sandbox
+.Nd build packages inside a chroot sandbox
 .Sh SYNOPSIS
 .Nm
+.Op Fl Nn
 .Oo Fl Po
-.Cm c Ns \&| Ns Cm C
+.Cm C Ns \&| Ns Cm c
 .Pc
-.Ar conf_file
+.Ar conffile
 .Oc
-.Op Fl Nn
 .Ar target
-.Op Ar pkg_name ...
+.Op Ar operand ...
 .Sh DESCRIPTION
 .Nm ,
 or
-.Em Package Compiler
+.Sy Package Compiler
 in its full name,
-is a tool that makes easy the compilation of packages inside a clean
-sandbox.
-This allows an easy tracking of exact dependencies
-and the correct behavior of a package in a fresh system installation.
+is a tool that makes the compilation of packages inside a clean
+sandbox easy.
+This allows an easy tracking of exact dependencies,
+and the correct behavior of a package, in a fresh system installation.
 .Pp
 The behavior of
 .Nm
-is controlled through a small configuration file and a target (keep
-reading to learn more).
+is controlled through a small configuration file,
+.Ar conffile ,
+and a target,
+.Ar target .
 The configuration file tells
 .Nm
 how to configure the new chroot environment, and the target specifies
 which action to take.
-.Pp
-The following options are recognized:
-.Bl -tag -width XcXconf_file
-.It Fl C Ar conf_file
-Use
-.Ar conf_file
-as configuration file (full path expected).
-.It Fl c Ar conf_file
-Use
-.Ar conf_file
-as configuration file (only base name expected).
-.It Fl N
-With the exception of
-.Pa pkgtools/libkver
-(see
-.Va NETBSD_RELEASE )
-avoid installation of default packages as well as
-.Va INSTALL_PACKAGES
-and
-.Va BUILD_PACKAGES
-during the creation of the chroot.
-.It Fl n
-Avoid installation of
-.Va INSTALL_PACKAGES
-and
-.Va BUILD_PACKAGES
-during the creation of the chroot.
-.El
-.Ss What to use it for?
+In addition, one or more
+.Ar operand
+operands may be given, whose meaning depend on the target specified
+(and if the target in fact uses them or not); see the
+.Sx TARGETS
+section
+below.
+.Ss What To Use \&It For?
 You can use
 .Nm
 to achieve many goals when building packages.
@@ -98,12 +79,23 @@
 .It
 Build packages for other system versions.
 For example, build packages for
-.Nx 4.0
+.Nx 5.0
 while you are running
-.Nx 5.0 .
+.Nx 6.0 ,
+or
+.Nx Ns -current .
+.It
+Prevent the need for deinstallation of installed packages (and possibly
+packages depending on them) on your host system;
+instead, let this be handled in the chroot.
+Also, prevent the risk of leaving your host in an inconsistent state
+in case of potential package build failures.
+.It
+Do package building in the chroot, and use resulting binary packages
+outside of it.
 .It
 Build packages using different
-.Pa mk.conf
+.Xr mk.conf 5
 options than your current system, like changing the threading library,
 .Sy COPTS ,
 placement of configuration files, etc.
@@ -112,10 +104,44 @@
 properly.
 .It
 Avoid autoconf's side effects by keeping a separate chroot for each
-project, like one for GNOME2 and another one for KDE3.
+project, like one for GNOME2, and another one for KDE3.
 .It
 Schedule builds of package sets for several different machines.
 .El
+.Sh OPTIONS
+The following options are available:
+.Bl -tag -width XcXconffile
+.It Fl C Ar conffile
+Use
+.Ar conffile
+as configuration file, specified as a full path.
+.It Fl c Ar conffile
+Use
+.Ar conffile
+as configuration file, given as its base name.
+A
+.Dq .conf
+suffix will be appended to this base name automatically,
+and
+.Pa $HOME/pkg_comp
+will be used as the path to the resulting file name, as described below.
+.It Fl N
+With the exception of
+.Pa pkgtools/libkver
+(see
+.Va NETBSD_RELEASE ) ,
+avoid installation of default packages as well as
+.Va INSTALL_PACKAGES
+and
+.Va BUILD_PACKAGES
+during the creation of the chroot.
+.It Fl n
+Avoid installation of
+.Va INSTALL_PACKAGES
+and
+.Va BUILD_PACKAGES
+during the creation of the chroot.
+.El
 .Sh CONTROL DIRECTORY
 .Nm
 needs to store several pieces of information when it is running.
@@ -131,134 +157,151 @@
 With
 .Nm
 you can maintain several configuration files so you can work with
-different chroot jails easily.
+different chroot environments easily.
 To make this easy, configuration files are stored inside
 .Pa $HOME/pkg_comp ,
-followed by the configuration file name and the .conf suffix.
+followed by the configuration file name and a
+.Dq .conf
+suffix.
 The default configuration file is
 .Pa $HOME/pkg_comp/default.conf ,
-and is always used if you do not specify another one.
-The configuration file name is specified by the argument of the
-.Fl c
-option.
-Alternatively you can specify any pathname as a configuration file
-with the argument of the
+and is used if you do not specify one yourself explicitly using either the
 .Fl C
+or
+.Fl c
 option.
 .Pp
 Configuration files are simple shell scripts that define
 variables.
 The default values shown here are those written in the template when
-issuing a maketemplate.
+issuing a
+.Cm maketemplate .
 .Bl -tag -width indent
-.It AUTO_PACKAGES
+.It Va AUTO_PACKAGES
 A list of packages to automatically build during the
-.Sy auto
-target.
+.Cm auto
+target if no packages are explicitly given using
+.Ar operand .
 A package is in the form
-.Sq section/name ,
+.Dq section/name ,
 like
-.Sq misc/colorls ,
-or a plain name like
-.Sq colorls .
+.Dq misc/colorls ,
+or a plain name, like
+.Dq colorls .
 Defaults to nothing.
-.It AUTO_TARGET
+.It Va AUTO_TARGET
 The pkgsrc target to use when building packages in an automated fashion
 (using the
-.Ql auto
+.Cm auto
 target).
 Should be set to
-.Ql package
+.Dq package
 or
-.Ql bin-install ,
+.Dq bin-install ,
 as other values are useless.
 Defaults to
-.Ql package .
-.It BUILD_PACKAGES
-A list of packages to automatically build after the
-.Sy makeroot
+.Dq package .
+.It Va BUILD_PACKAGES
+A list of packages to automatically build (and install) after the
+.Cm makeroot
 target.
 A package is in the form
-.Sq section/name ,
+.Dq section/name ,
 like
-.Sq misc/colorls ,
-or a plain name like
-.Sq colorls .
+.Dq misc/colorls ,
+or a plain name, like
+.Dq colorls .
 Defaults to nothing.
-.It BUILD_TARGET
+.It Va BUILD_TARGET
 The pkgsrc target to use when building packages.
 It can contain any target supported by the pkgsrc system, but
 reasonable values are:
-.Ql install ,
-.Ql package
+.Dq install ,
+.Dq package
 and
-.Ql bin-install .
+.Dq bin-install .
 Defaults to
-.Ql package .
-.It COPYROOTCFG
+.Dq package .
+.It Va COPYROOTCFG
 If set to
-.Ql yes ,
+.Dq yes ,
 all configuration files (not directories) that reside inside
 .Pa /root
 are copied to
-.Sy $DESTDIR/root .
+.Pa $DESTDIR/root .
 Defaults to
-.Ql no .
-.It DESTDIR
-The chroot jail directory.
+.Dq no .
+.It Va COPY_PKG_VULNERABILITIES
+If set to
+.Dq yes ,
+let
+.Nm
+handle the
+.Pa pkg-vulnerabilities
+file automatically.
+This means that it will install the system-wide
+.Pa pkg-vulnerabilities
+file inside the chroot, keeping both in sync.
+Defaults to
+.Dq yes .
+.It Va DESTDIR
+The chroot environment directory.
 Defaults to
 .Pa /var/chroot/pkg_comp/default .
-.It DISTRIBDIR
-This is the directory which holds
-.Nb
-binary sets and X sets.
-Its structure is the same as official release
-distributions, that is, tgz files must reside inside
+.It Va DISTRIBDIR
+This is the directory which holds the
+.Nx
+distribution sets.
+Its structure should be the same as official release
+distributions, that is,
+.Dq .tgz
+files must reside inside
 .Pa $DISTRIBDIR/binary/sets .
 Defaults to
-.Pa /var/pub/NetBSD .
-.It EXTRAMK
-Specifies a whitespace-separated list of files that must be appended to
+.Pa /usr/INSTALL .
+.It Va EXTRAMK
+Specifies a white space separated list of files that must be appended to
 .Pa $DESTDIR/etc/mk.conf .
 This is useful to add special items to this configuration file.
 Defaults to nothing.
-.It INSTALL_PACKAGES
-A list of packages to automatically install after the
-.Sy makeroot
-and before installing
-.Sy BUILD_PACKAGES .
+.It Va INSTALL_PACKAGES
+A list of packages to automatically install after creation of the chroot,
+and before building and installing (optional)
+.Va BUILD_PACKAGES  .
 These are also installed within the sandbox created by the
-.Sy auto
+.Cm auto
 target, but before anything is built.
-Each name must be the full package name, including the tgz suffix.
+Each name must be the full package name, including the
+.Dq .tgz
+suffix.
 Packages are searched inside
 .Pa $REAL_PACKAGES/All .
 Defaults to nothing.
-.It GENERATE_PKG_SUMMARY
+.It Va GENERATE_PKG_SUMMARY
 If set to
-.Sq yes ,
+.Dq yes ,
 generate a new
 .Pa $REAL_PACKAGES/pkg_summary.gz
 file at the end of every package build by both the
-.Sq auto
+.Cm auto
 and
-.Sq build
+.Cm build
 targets.
-.It LOCALBASE
+.It Va LOCALBASE
 Where binary packages get installed.
 Defaults to
 .Pa /usr/pkg .
-.It MKCONF_VARS
+.It Va MKCONF_VARS
 A list of variable names that will be appended to the generated
 .Pa /etc/mk.conf
 file, together with their values set in the configuration file.
 Its default value contains all variables listed here.
-.It NETBSD_RELEASE
+.It Va NETBSD_RELEASE
 Specifies which version number of
 .Nx
 is installed inside the chroot.
 If set to
-.Ql no ,
+.Dq no ,
 no special action is taken (this is useful if the system version inside
 the chroot matches the outside one).
 Otherwise, the package
@@ -273,104 +316,91 @@
 The libkver library will be configured inside the chroot, with the symbolic 
link
 .Pa $DESTDIR/libkver_osrelease
 and
-.Va LD_PRELOAD
-in default shells environments,
+.Ev LD_PRELOAD
+in default shell's environments,
 so that the
 .Nx
 version specified in
 .Va NETBSD_RELEASE
-overrides the host system version.
-See
+overrides the host system version
+(see the
 .Xr kver 3
-for more information.
+man page from the named package for more information).
 Defaults to
-.Ql no .
-.It PKG_DBDIR
+.Dq no .
+.It Va PKG_DBDIR
 Location of the packages database.
 Defaults to
 .Pa /var/db/pkg .
-.It PKG_SYSCONFBASE
+.It Va PKG_SYSCONFBASE
 Base directory of configuration files.
 Defaults to
 .Pa /usr/pkg/etc .
-.It PKGSRC_COMPILER
+.It Va PKGSRC_COMPILER
 List of values specifying the chain of compilers to invoke when building
 packages.
 Defaults to
-.Ql gcc .
+.Dq gcc .
 If you are defining
 .Va REAL_CCACHE ,
 remember to prepend
-.Ql ccache
+.Dq ccache
 to this variable's value.
-.It PKGVULNDIR
+.It Va PKGVULNDIR
 Directory where the
-.Pa vulnerabilities
+.Pa pkg-vulnerabilities
 file will be installed (inside the chroot).
 Defaults to
-.Pa /usr/pkg/share .
-.It REAL_PKGVULNDIR
+.Pa /var/db/pkg .
+.It Va REAL_PKGVULNDIR
 Directory where the system-wide
-.Pa vulnerabilities
+.Pa pkg-vulnerabilities
 file resides (outside the chroot).
 Defaults to
-.Pa /usr/pkgsrc/distfiles .
-.It ROOTSHELL
+.Pa /var/db/pkg .
+.It Va ROOTSHELL
 The shell of the root user.
 Defaults to
-.Pa /bin/ksh .
-.It SETS
+.Pa /bin/sh .
+.It Va SETS
 A list of binary sets to be extracted inside
-.Sy DESTDIR .
+.Pa DESTDIR .
 Defaults to
-.Ql base.tgz comp.tgz etc.tgz kern-GENERIC.tgz text.tgz .
+.Dq base.tgz comp.tgz etc.tgz kern-GENERIC.tgz text.tgz .
 If no kernel is extracted by these sets, an empty
 .Pa /netbsd
 file is created inside the chroot.
-.It SETS_X11
-A list of binary sets of the X Window system.
+.It Va SETS_X11
+A list of binary sets of the X Window System.
 This has the same behavior
 as
-.Sy SETS .
+.Va SETS .
 If this variable is set to
-.Ql no ,
-no X Window is configured inside the chroot
-jail and no other X variables take effect.
+.Dq no ,
+the X Window System is not configured inside the chroot environment,
+and no other X variables take effect.
 Defaults to
-.Ql xbase.tgz xcomp.tgz xetc.tgz xfont.tgz xserver.tgz .
-.It SYNC_UMOUNT
+.Dq xbase.tgz xcomp.tgz xetc.tgz xfont.tgz xserver.tgz .
+.It Va SYNC_UMOUNT
 If set to
-.Ql yes ,
+.Dq yes ,
 run
 .Xr sync 8
 three times after all file systems have been unmounted.
 Defaults to
-.Ql no .
-.It USE_AUDIT_PACKAGES
-If set to
-.Ql yes ,
-let
-.Nm
-handle the
-.Pa vulnerabilities
-file automatically.
-This means that it will install the system-wide
-.Pa vulnerabilities
-file inside the chroot when needed, keeping both in sync.
-Defaults to
-.Ql yes .
-.It USE_GCC3
+.Dq no .
+.It Va USE_GCC3
 If set to
-.Ql yes ,
+.Dq yes ,
 the GNU C Compiler version 3 will be installed inside the chroot
 environment and used to build all packages, using the
 .Pa lang/gcc3
 package.
 Defaults to
-.Ql no .
-.It USE_XPKGWEDGE
+.Dq no .
+.It Va USE_XPKGWEDGE
 If set to
-.Ql yes ,
+.Dq yes ,
 you want xpkgwedge to be compiled and installed automatically inside the
 chroot.
 This takes care of setting up
@@ -380,9 +410,9 @@
 for xpkgwedge to work.
 Has no effect if X is unconfigured.
 Defaults to
-.Ql yes .
+.Dq yes .
 .El
-.Ss Mounted file systems
+.Sh MOUNTED FILE SYSTEMS
 In order to avoid duplicating huge system trees,
 .Nm
 takes advantage of file system layers.
@@ -409,70 +439,77 @@
 processes using the chroot environment.
 If some of them crashes unexpectedly and you notice it does not try
 to unmount the file systems, this status file may get out of sync.
-Be sure to check that NO file systems are mounted when issuing a
-.Sy removeroot .
+.Em NOTE :
+Be sure to check that no file systems are mounted when issuing a
+.Cm removeroot !
 .Bl -tag -width indent
-.It REAL_CCACHE
+.It Va REAL_CCACHE
 Specifies where a global ccache directory resides in the real system.
 Defaults to nothing, which disables the global cache.
 Keep in mind that this is specially useful to keep the cache across
 rebuilds of the sandbox, but be very careful if you plan to share a
 cache directory between different sandboxes, as this can lead to problems.
-.It REAL_DISTFILES
+.It Va REAL_DISTFILES
 Specifies where distfiles reside in the real system.
 Defaults to
 .Pa /usr/pkgsrc/distfiles .
-.It REAL_DISTFILES_OPTS
+.It Va REAL_DISTFILES_OPTS
 Mount options.
 Defaults to
-.Sy -t null -o rw .
-.It REAL_PACKAGES
-Specifies where to build binary packages.
+.Dq -t null -o rw .
+.It Va REAL_PACKAGES
+Specifies where to build binary packages to, or install them from.
 This variable is specially useful.
 Defaults to
 .Pa /usr/pkgsrc/packages .
-.It REAL_PACKAGES_OPTS
+.It Va REAL_PACKAGES_OPTS
 Mount options.
 Defaults to
-.Sy -t null -o rw .
-.It REAL_PKGSRC
+.Dq -t null -o rw .
+.It Va REAL_PKGSRC
 The pkgsrc tree.
 This can be useful if you want to use several pkgsrc trees independently.
 Defaults to
 .Pa /usr/pkgsrc .
-.It REAL_PKGSRC_OPTS
+.It Va REAL_PKGSRC_OPTS
 Mount options.
 Defaults to
-.Sy -t null -o ro .
-.It REAL_SRC
+.Dq -t null -o ro .
+.It Va REAL_SRC
 The src system tree.
 Usually useless, but may be needed by some packages, like sysutils/aperture.
 Defaults to
 .Pa /usr/src .
-.It REAL_SRC_OPTS
+.It Va REAL_SRC_OPTS
 Mount options.
 Defaults to
-.Sy -t null -o ro .
-.It MAKEROOT_HOOKS
-A whitespace separated list of functions or external scripts to be executed
+.Dq -t null -o ro .
+.It Va MAKEROOT_HOOKS
+A white space separated list of functions or external scripts to be executed
 after the sandbox is created.
-Two arguments are given to each of them:
+These should accept the following two arguments, as given to them by
+.Nm
+internally:
 .Ar $DESTDIR ,
 and the word
 .Ar makeroot .
 Defaults to nothing.
-.It MOUNT_HOOKS
-A whitespace separated list of functions or external scripts to be executed
+.It Va MOUNT_HOOKS
+A white space separated list of functions or external scripts to be executed
 after file systems are mounted.
-Two arguments are given to each of them:
+These should accept the following two arguments, as given to them by
+.Nm
+internally:
 .Ar $DESTDIR ,
 and the word
 .Ar mount .
 Defaults to nothing.
-.It UMOUNT_HOOKS
-A whitespace separated list of functions or external scripts to be executed
+.It Va UMOUNT_HOOKS
+A white space separated list of functions or external scripts to be executed
 before file systems are unmounted.
-Two arguments are given to each of them:
+These should accept the following two arguments, as given to them by
+.Nm
+internally:
 .Ar $DESTDIR ,
 and the word
 .Ar umount .
@@ -481,76 +518,125 @@
 .Sh TARGETS
 A target specifies what
 .Nm
-should do (as in make).
+should do (as in
+.Xr make 1 ) .
 The following list describes all supported targets,
-in the logical order you should call them.
+in the logical order you should call them, and if and how they use
+.Ar operand
+operands:
 .Bl -tag -width indent
-.It maketemplate
+.It Cm maketemplate
 Create a sample
-.Ar conf_file .
+.Ar conffile .
 You should edit it after the creation as you will probably want to change
 the default configuration, specially paths.
-.It makeroot
-Create the chroot environment, based on the specs of the configuration file.
-This step is required before trying any other, except maketemplate.
-.It build
-Builds the specified packages inside the chroot.
-You can pass the package names as a relative path within pkgsrc or as the
-basename of the package directory (i.e. omitting the directory name).
-.It install
-Install the specified binary packages into the chroot.
+Does not use
+.Ar operand
+operands.
+.It Cm makeroot
+Create the chroot environment, based on the specifications from
+the configuration file.
+This step is required before trying any other, except
+.Cm maketemplate .
+Does not use
+.Ar operand
+operands.
+.It Cm build
+Builds the specified
+.Ar operand
+packages inside the chroot.
+You can pass the package names as a relative path within pkgsrc, or as the
+basename of the package directory (i.e., omitting the directory name).
+.It Cm install
+Install the specified
+.Ar operand
+binary packages into the chroot.
 Package names can contain globs.
 The package files will be taken from within
-.Sy REAL_PACKAGES .
-.It chroot
+.Va REAL_PACKAGES .
+.It Cm chroot
 Enters the chroot environment.
-If no arguments are given,
+Any
+.Ar operand
+operands are taken as commands to execute in the chroot;
+if none are given,
 .Va ROOTSHELL
-is executed, otherwise whatever you typed.
-If the first argument begins with a word prefixed by
-.Li pkg_ ,
-then the
-.Ql chroot
-argument can be omitted (it is implied).
-.It removeroot
+is executed.
+.Pp
+As a special case, if the first operand
+begins with
+.Dq pkg_ ,
+the
+.Cm chroot
+target name may be omitted: it is then implied.
+This shortcut functionality removes the need of specifying the
+.Cm chroot
+target explicitly in case one wants to, e.g., execute commands like
+.Xr pkg_info 1
+or
+.Xr pkg_add 1
+from the
+.Pa pkgtools/pkg_install
+package within the chroot.
+.It Cm removeroot
 Remove the entire chroot tree.
 You should do it with this target because it
-will take care to umount needed mount points.
-.It auto
-This executes several targets automatically, using
-.Sy AUTO_TARGET
+will take care to unmount needed mount points.
+Does not use
+.Ar operand
+operands.
+.It Cm auto
+This executes the targets
+.Cm makeroot ,
+.Cm build ,
+and
+.Cm removeroot
+automatically,
+in that order, using
+.Va AUTO_TARGET
 as
-.Sy BUILD_TARGET
+.Va BUILD_TARGET
 during the build.
-The order is: makeroot, build and removeroot.
-This is useful to create binary packages of several pkgsrc and their
-dependencies automatically.
+This is useful to create binary packages of several packages and their
+dependencies automatically, creating and cleaning up afterwards a dedicated
+chroot with it.
 For this to be useful, you need to set
-.Sy REAL_PACKAGES
-and use
-.Sy AUTO_PACKAGES
-or pass package names through the command line.
+.Va REAL_PACKAGES ,
+and in addition use either
+.Va AUTO_PACKAGES
+or specify
+.Ar operand
+package names, with the latter taking precedence in case of both.
 .Pp
-If the magic word
-.Ql resume
-is passed as the unique argument to this target,
-.Nm
-will attempt to resume a previous automatic build for the given configuration.
+As a special case, if the magic word
+.Dq resume
+is passed as the first operand to this target,
+.Nm
+will attempt to resume a previously interrupted automatic build for
+the given configuration.
+In this case, any other
+operands given (as well as
+.Va AUTO_PACKAGES )
+will be ignored.
 .El
 .Sh NOTES
 This program uses nullfs to create virtual copies of real trees inside the
 chroot environment.
 .Pp
-You need to install the
-.Pa security/audit-packages
-package in the host system (and have an up to date vulnerabilities database)
-if you want security checks to work inside the
-chroot environment.
+If you use
+.Va COPY_PKG_VULNERABILITIES ,
+make sure to have an up to date
+.Pa pkg-vulnerabilities
+file on the host system before entering the chroot.
+See the
+.Xr pkg_admin 1
+man page from the
+.Pa pkgtools/pkg_install
+package for more information.
 .Sh SEE ALSO
-.Xr pkg_delete 1 ,
+.Xr mk.conf 5 ,
 .Xr pkgsrc 7 ,
 .Xr mount_null 8 ,
-.Xr sync 8 ,
-.Xr sysctl 8
+.Pa pkgtools/pkg_install
 .Sh AUTHORS
 .An Julio M. Merino Vidal Aq jmmv%NetBSD.org@localhost
Index: pkgsrc/pkgtools/pkg_comp/DESCR
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_comp/DESCR,v
retrieving revision 1.2
diff -u -r1.2 DESCR
--- pkgsrc/pkgtools/pkg_comp/DESCR      23 Jan 2004 09:48:53 -0000      1.2
+++ pkgsrc/pkgtools/pkg_comp/DESCR      9 Jan 2013 14:19:56 -0000
@@ -1,14 +1,24 @@
-pkg_comp is a small utility designed to build packages inside a
-clean chroot tree.
+pkg_comp, or Package Compiler in its full name, is a small shell
+script that makes the compilation of packages inside a clean sandbox
+easy.
 
-Some ideas about what to use it for (taken from manpage):
-* Build packages for other system versions. For example, build
-  packages for NetBSD 1.5 while you are running NetBSD current.
-* Build packages using different options than your current system
-  like changing the threading library, COPTS, placement of
+Some ideas about what to use it for, taken from the manpage:
+
+* Build packages for other system versions.  For example, build
+  packages for NetBSD 5.0 while you are running NetBSD 6.0, or
+  NetBSD-current.
+* Prevent the need for deinstallation of installed packages (and
+  possibly packages depending on them) on your host system; instead,
+  let this be handled in the chroot.  Also, prevent the risk of leaving
+  your host in an inconsistent state in case of potential package build
+  failures.
+* Do package building in the chroot, and use resulting binary packages
+  outside of it.
+* Build packages using different mk.conf(5) options than your current
+  system, like changing the threading library, COPTS, placement of
   configuration files, etc.
-* Debug the build process of a package, checking if buildlinks
-  work properly.
-* Avoid autoconf's side effects by keeping a separate chroot for
-  each project, like one for GNOME2 and another one for KDE3.
+* Debug the build process of a package, checking if buildlinks work
+  properly.
+* Avoid autoconf's side effects by keeping a separate chroot for each
+  project, like one for GNOME2, and another one for KDE3.
 * Schedule builds of package sets for several different machines.
Index: pkgsrc/pkgtools/pkg_comp/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_comp/Makefile,v
retrieving revision 1.50
diff -u -r1.50 Makefile
--- pkgsrc/pkgtools/pkg_comp/Makefile   11 Sep 2012 23:19:36 -0000      1.50
+++ pkgsrc/pkgtools/pkg_comp/Makefile   9 Jan 2013 14:19:56 -0000
@@ -1,6 +1,6 @@
 # $NetBSD: Makefile,v 1.50 2012/09/11 23:19:36 asau Exp $
 
-DISTNAME=      pkg_comp-1.37
+DISTNAME=      pkg_comp-1.38
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
 DISTFILES=     # empty

--MnLPg7ZWsaic7Fhd--

>Unformatted:
 --MnLPg7ZWsaic7Fhd
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 
 



Home | Main Index | Thread Index | Old Index