Mon Feb 27 22:42:27 2012 UTC ()
Update to 1.36:

- Allow specifying packages by their basename, without a category.  This
  affects the arguments to the 'build' command as well as the list of
  packages provided to AUTO_PACKAGES and BUILD_PACKAGES.


(jmmv)
diff -r1.47 -r1.48 pkgsrc/pkgtools/pkg_comp/Makefile
diff -r1.35 -r1.36 pkgsrc/pkgtools/pkg_comp/files/pkg_comp.8
diff -r1.39 -r1.40 pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh

cvs diff -r1.47 -r1.48 pkgsrc/pkgtools/pkg_comp/Makefile (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkg_comp/Makefile 2010/11/13 16:23:22 1.47
+++ pkgsrc/pkgtools/pkg_comp/Makefile 2012/02/27 22:42:26 1.48
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1# $NetBSD: Makefile,v 1.47 2010/11/13 16:23:22 jmmv Exp $ 1# $NetBSD: Makefile,v 1.48 2012/02/27 22:42:26 jmmv Exp $
2 2
3DISTNAME= pkg_comp-1.35 3DISTNAME= pkg_comp-1.36
4CATEGORIES= pkgtools 4CATEGORIES= pkgtools
5MASTER_SITES= # empty 5MASTER_SITES= # empty
6DISTFILES= # empty 6DISTFILES= # empty
7 7
8MAINTAINER= jmmv@NetBSD.org 8MAINTAINER= jmmv@NetBSD.org
9COMMENT= Build packages inside a chroot jail 9COMMENT= Build packages inside a chroot jail
10 10
11PKG_INSTALLATION_TYPES= overwrite pkgviews 11PKG_INSTALLATION_TYPES= overwrite pkgviews
12PKG_DESTDIR_SUPPORT= user-destdir 12PKG_DESTDIR_SUPPORT= user-destdir
13 13
14ONLY_FOR_PLATFORM= NetBSD-*-* 14ONLY_FOR_PLATFORM= NetBSD-*-*
15 15
16WRKSRC= ${WRKDIR} 16WRKSRC= ${WRKDIR}

cvs diff -r1.35 -r1.36 pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.8 (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.8 2010/04/15 09:42:45 1.35
+++ pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.8 2012/02/27 22:42:27 1.36
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: pkg_comp.8,v 1.35 2010/04/15 09:42:45 jmmv Exp $ 1.\" $NetBSD: pkg_comp.8,v 1.36 2012/02/27 22:42:27 jmmv Exp $
2.\" 2.\"
3.\" pkg_comp - Build packages inside a clean chroot environment 3.\" pkg_comp - Build packages inside a clean chroot environment
4.\" Copyright (c) 2002, 2003, 2004, 2005 Julio M. Merino Vidal <jmmv@NetBSD.org> 4.\" Copyright (c) 2002, 2003, 2004, 2005 Julio M. Merino Vidal <jmmv@NetBSD.org>
5.\" 5.\"
6.\" Redistribution and use in source and binary forms, with or without 6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions 7.\" modification, are permitted provided that the following conditions
8.\" are met: 8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright 9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer. 10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Neither the name of The NetBSD Foundation nor the names of its 11.\" 2. Neither the name of The NetBSD Foundation nor the names of its
12.\" contributors may be used to endorse or promote products derived 12.\" contributors may be used to endorse or promote products derived
13.\" from this software without specific prior written permission. 13.\" from this software without specific prior written permission.
14.\" 3. Neither the name of author nor the names of its contributors may 14.\" 3. Neither the name of author nor the names of its contributors may
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17.\" 17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE. 28.\" POSSIBILITY OF SUCH DAMAGE.
29.\" 29.\"
30.Dd April 15, 2010 30.Dd February 27, 2012
31.Dt PKG_COMP 8 31.Dt PKG_COMP 8
32.Os 32.Os
33.Sh NAME 33.Sh NAME
34.Nm pkg_comp 34.Nm pkg_comp
35.Nd build packages inside a sandbox 35.Nd build packages inside a sandbox
36.Sh SYNOPSIS 36.Sh SYNOPSIS
37.Nm 37.Nm
38.Oo Fl Po 38.Oo Fl Po
39.Cm c Ns \&| Ns Cm C 39.Cm c Ns \&| Ns Cm C
40.Pc 40.Pc
41.Ar conf_file 41.Ar conf_file
42.Oc 42.Oc
43.Op Fl Nn 43.Op Fl Nn
@@ -145,45 +145,55 @@ Alternatively you can specify any pathna @@ -145,45 +145,55 @@ Alternatively you can specify any pathna
145with the argument of the 145with the argument of the
146.Fl C 146.Fl C
147option. 147option.
148.Pp 148.Pp
149Configuration files are simple shell scripts that define 149Configuration files are simple shell scripts that define
150variables. 150variables.
151The default values shown here are those written in the template when 151The default values shown here are those written in the template when
152issuing a maketemplate. 152issuing a maketemplate.
153.Bl -tag -width indent 153.Bl -tag -width indent
154.It AUTO_PACKAGES 154.It AUTO_PACKAGES
155A list of packages to automatically build during the 155A list of packages to automatically build during the
156.Sy auto 156.Sy auto
157target. 157target.
158A package is in the form section/name, like misc/colorls. 158A package is in the form
 159.Sq section/name ,
 160like
 161.Sq misc/colorls ,
 162or a plain name like
 163.Sq colorls .
159Defaults to nothing. 164Defaults to nothing.
160.It AUTO_TARGET 165.It AUTO_TARGET
161The pkgsrc target to use when building packages in an automated fashion 166The pkgsrc target to use when building packages in an automated fashion
162(using the 167(using the
163.Ql auto 168.Ql auto
164target). 169target).
165Should be set to 170Should be set to
166.Ql package 171.Ql package
167or 172or
168.Ql bin-install , 173.Ql bin-install ,
169as other values are useless. 174as other values are useless.
170Defaults to 175Defaults to
171.Ql package . 176.Ql package .
172.It BUILD_PACKAGES 177.It BUILD_PACKAGES
173A list of packages to automatically build after the 178A list of packages to automatically build after the
174.Sy makeroot 179.Sy makeroot
175target. 180target.
176A package is in the form section/name, like misc/colorls. 181A package is in the form
 182.Sq section/name ,
 183like
 184.Sq misc/colorls ,
 185or a plain name like
 186.Sq colorls .
177Defaults to nothing. 187Defaults to nothing.
178.It BUILD_TARGET 188.It BUILD_TARGET
179The pkgsrc target to use when building packages. 189The pkgsrc target to use when building packages.
180It can contain any target supported by the pkgsrc system, but 190It can contain any target supported by the pkgsrc system, but
181reasonable values are: 191reasonable values are:
182.Ql install , 192.Ql install ,
183.Ql package 193.Ql package
184and 194and
185.Ql bin-install . 195.Ql bin-install .
186Defaults to 196Defaults to
187.Ql package . 197.Ql package .
188.It COPYROOTCFG 198.It COPYROOTCFG
189If set to 199If set to
@@ -465,28 +475,28 @@ should do (as in make). @@ -465,28 +475,28 @@ should do (as in make).
465The following list describes all supported targets, 475The following list describes all supported targets,
466in the logical order you should call them. 476in the logical order you should call them.
467.Bl -tag -width indent 477.Bl -tag -width indent
468.It maketemplate 478.It maketemplate
469Create a sample 479Create a sample
470.Ar conf_file . 480.Ar conf_file .
471You should edit it after the creation as you will probably want to change 481You should edit it after the creation as you will probably want to change
472the default configuration, specially paths. 482the default configuration, specially paths.
473.It makeroot 483.It makeroot
474Create the chroot environment, based on the specs of the configuration file. 484Create the chroot environment, based on the specs of the configuration file.
475This step is required before trying any other, except maketemplate. 485This step is required before trying any other, except maketemplate.
476.It build 486.It build
477Builds the specified packages inside the chroot. 487Builds the specified packages inside the chroot.
478You need to pass their names as relative paths inside pkgsrc, like 488You can pass the package names as a relative path within pkgsrc or as the
479.Pa pkgtools/pkg_comp . 489basename of the package directory (i.e. omitting the directory name).
480.It install 490.It install
481Install the specified binary packages into the chroot. 491Install the specified binary packages into the chroot.
482Package names can contain globs. 492Package names can contain globs.
483The package files will be taken from within 493The package files will be taken from within
484.Sy REAL_PACKAGES . 494.Sy REAL_PACKAGES .
485.It chroot 495.It chroot
486Enters the chroot environment. 496Enters the chroot environment.
487If no arguments are given, 497If no arguments are given,
488.Va ROOTSHELL 498.Va ROOTSHELL
489is executed, otherwise whatever you typed. 499is executed, otherwise whatever you typed.
490If the first argument begins with a word prefixed by 500If the first argument begins with a word prefixed by
491.Li pkg_ , 501.Li pkg_ ,
492then the 502then the

cvs diff -r1.39 -r1.40 pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.sh (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.sh 2010/11/13 16:23:22 1.39
+++ pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.sh 2012/02/27 22:42:27 1.40
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# $NetBSD: pkg_comp.sh,v 1.39 2010/11/13 16:23:22 jmmv Exp $ 3# $NetBSD: pkg_comp.sh,v 1.40 2012/02/27 22:42:27 jmmv Exp $
4# 4#
5# pkg_comp - Build packages inside a clean chroot environment 5# pkg_comp - Build packages inside a clean chroot environment
6# Copyright (c) 2002, 2003, 2004, 2005 Julio M. Merino Vidal <jmmv@NetBSD.org> 6# Copyright (c) 2002, 2003, 2004, 2005 Julio M. Merino Vidal <jmmv@NetBSD.org>
7# 7#
8# Redistribution and use in source and binary forms, with or without 8# Redistribution and use in source and binary forms, with or without
9# modification, are permitted provided that the following conditions 9# modification, are permitted provided that the following conditions
10# are met: 10# are met:
11# 1. Redistributions of source code must retain the above copyright 11# 1. Redistributions of source code must retain the above copyright
12# notice, this list of conditions and the following disclaimer. 12# notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright 13# 2. Redistributions in binary form must reproduce the above copyright
14# notice, this list of conditions and the following disclaimer in 14# notice, this list of conditions and the following disclaimer in
15# the documentation and/or other materials provided with the 15# the documentation and/or other materials provided with the
16# distribution. 16# distribution.
@@ -691,33 +691,34 @@ pkg_auto() @@ -691,33 +691,34 @@ pkg_auto()
691# ---------------------------------------------------------------------- 691# ----------------------------------------------------------------------
692# build target 692# build target
693# ---------------------------------------------------------------------- 693# ----------------------------------------------------------------------
694 694
695# pkg_build pkgs 695# pkg_build pkgs
696# 696#
697# The build target. Also used as a helper function within this script 697# The build target. Also used as a helper function within this script
698# to build several packages when needed. 698# to build several packages when needed.
699# 699#
700pkg_build() 700pkg_build()
701{ 701{
702 local failed invalid p pkgs script statfile 702 local failed invalid p pkgs script statfile
703 703
704 pkgs="$*" 704 pkgs=
705 705 invalid=
706 # Check if all packages exist 706 for pkg in "${@}"; do
707 invalid="" 707 local match="$(find_pkg "${pkg}")"
708 for p in $pkgs; do 708 if [ -z "${match}" ]; then
709 if [ ! -d $REAL_PKGSRC/$p ]; then 709 invalid="${invalid} ${pkg}"
710 invalid="$invalid $p" 710 else
 711 pkgs="${pkgs} ${match}"
711 fi 712 fi
712 done 713 done
713 if [ -n "$invalid" ]; then 714 if [ -n "$invalid" ]; then
714 err "invalid packages:$invalid" 715 err "invalid packages:$invalid"
715 fi 716 fi
716 717
717 # Build them 718 # Build them
718 fsmount 719 fsmount
719 copy_vulnerabilities 720 copy_vulnerabilities
720 failed="" 721 failed=""
721 for p in $pkgs; do 722 for p in $pkgs; do
722 echo "PKG_COMP ==> Building and installing $p" 723 echo "PKG_COMP ==> Building and installing $p"
723 prefix=$(mktemp $DESTDIR/pkg_comp/tmp/pkg_comp-XXXXXX) 724 prefix=$(mktemp $DESTDIR/pkg_comp/tmp/pkg_comp-XXXXXX)
@@ -744,26 +745,52 @@ EOF @@ -744,26 +745,52 @@ EOF
744 mv ${_BUILD_RESUME}.new ${_BUILD_RESUME} 745 mv ${_BUILD_RESUME}.new ${_BUILD_RESUME}
745 fi 746 fi
746 done 747 done
747 fsumount 748 fsumount
748 if [ -n "$failed" ]; then 749 if [ -n "$failed" ]; then
749 echo "PKG_COMP ==> Build error summary" 750 echo "PKG_COMP ==> Build error summary"
750 echo "Build failed for:" 751 echo "Build failed for:"
751 for p in $failed; do 752 for p in $failed; do
752 echo " $p" 753 echo " $p"
753 done 754 done
754 fi 755 fi
755} 756}
756 757
 758# find_pkg name
 759#
 760# Checks if the given package exists and outputs its path within pkgsrc.
 761# Outputs nothing if the package is not found.
 762find_pkg()
 763{
 764 local name="${1}"
 765
 766 case "${name}" in
 767 */*)
 768 if [ -d "${REAL_PKGSRC}/${name}" ]; then
 769 echo "${name}"
 770 else
 771 : # Not found; output nothing.
 772 fi
 773 ;;
 774 *)
 775 local match="$(cd "${REAL_PKGSRC}" && echo */"${name}")"
 776 if [ -d "${REAL_PKGSRC}/${match}" ]; then
 777 echo "${match}"
 778 else
 779 : # Not found; output nothing.
 780 fi
 781 esac
 782}
 783
757# build_and_install pkg 784# build_and_install pkg
758# 785#
759# Builds a package and ensures it gets installed. The use of destdir to 786# Builds a package and ensures it gets installed. The use of destdir to
760# build packages may cause a package to get built but not installed, 787# build packages may cause a package to get built but not installed,
761# which is not OK for this script. This is for internal usage only. 788# which is not OK for this script. This is for internal usage only.
762# 789#
763build_and_install() 790build_and_install()
764{ 791{
765 pkg=${1} 792 pkg=${1}
766 fsmount 793 fsmount
767 if pkg_build ${pkg}; then 794 if pkg_build ${pkg}; then
768 script=$(mktemp ${DESTDIR}/pkg_comp/tmp/pkg_comp-XXXXXX).sh 795 script=$(mktemp ${DESTDIR}/pkg_comp/tmp/pkg_comp-XXXXXX).sh
769 init_script ${script} 796 init_script ${script}