Sat May 19 10:54:40 2012 UTC ()
Update to pkg_comp 1.37:

- Add the GENERATE_PKG_SUMMARY option to tell pkg_comp to generate a
  pkg_summary.gz file in the packages directory.  Useful to later be
  able to run a packaging tool like pkgin against new binary packages.


(jmmv)
diff -r1.48 -r1.49 pkgsrc/pkgtools/pkg_comp/Makefile
diff -r1.36 -r1.37 pkgsrc/pkgtools/pkg_comp/files/pkg_comp.8
diff -r1.40 -r1.41 pkgsrc/pkgtools/pkg_comp/files/pkg_comp.sh

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

--- pkgsrc/pkgtools/pkg_comp/Makefile 2012/02/27 22:42:26 1.48
+++ pkgsrc/pkgtools/pkg_comp/Makefile 2012/05/19 10:54:39 1.49
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1# $NetBSD: Makefile,v 1.48 2012/02/27 22:42:26 jmmv Exp $ 1# $NetBSD: Makefile,v 1.49 2012/05/19 10:54:39 jmmv Exp $
2 2
3DISTNAME= pkg_comp-1.36 3DISTNAME= pkg_comp-1.37
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.36 -r1.37 pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.8 (expand / switch to unified diff)

--- pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.8 2012/02/27 22:42:27 1.36
+++ pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.8 2012/05/19 10:54:39 1.37
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: pkg_comp.8,v 1.36 2012/02/27 22:42:27 jmmv Exp $ 1.\" $NetBSD: pkg_comp.8,v 1.37 2012/05/19 10:54:39 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 February 27, 2012 30.Dd May 11, 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
@@ -224,26 +224,36 @@ This is useful to add special items to t @@ -224,26 +224,36 @@ This is useful to add special items to t
224Defaults to nothing. 224Defaults to nothing.
225.It INSTALL_PACKAGES 225.It INSTALL_PACKAGES
226A list of packages to automatically install after the 226A list of packages to automatically install after the
227.Sy makeroot 227.Sy makeroot
228and before installing 228and before installing
229.Sy BUILD_PACKAGES . 229.Sy BUILD_PACKAGES .
230These are also installed within the sandbox created by the 230These are also installed within the sandbox created by the
231.Sy auto 231.Sy auto
232target, but before anything is built. 232target, but before anything is built.
233Each name must be the full package name, including the tgz suffix. 233Each name must be the full package name, including the tgz suffix.
234Packages are searched inside 234Packages are searched inside
235.Pa $REAL_PACKAGES/All . 235.Pa $REAL_PACKAGES/All .
236Defaults to nothing. 236Defaults to nothing.
 237.It GENERATE_PKG_SUMMARY
 238If set to
 239.Sq yes ,
 240generate a new
 241.Pa $REAL_PACKAGES/pkg_summary.gz
 242file at the end of every package build by both the
 243.Sq auto
 244and
 245.Sq build
 246targets.
237.It LOCALBASE 247.It LOCALBASE
238Where binary packages get installed. 248Where binary packages get installed.
239Defaults to 249Defaults to
240.Pa /usr/pkg . 250.Pa /usr/pkg .
241.It MKCONF_VARS 251.It MKCONF_VARS
242A list of variable names that will be appended to the generated 252A list of variable names that will be appended to the generated
243.Pa /etc/mk.conf 253.Pa /etc/mk.conf
244file, together with their values set in the configuration file. 254file, together with their values set in the configuration file.
245Its default value contains all variables listed here. 255Its default value contains all variables listed here.
246.It NETBSD_RELEASE 256.It NETBSD_RELEASE
247Specifies which version number of 257Specifies which version number of
248.Nx 258.Nx
249is installed inside the chroot. 259is installed inside the chroot.

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

--- pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.sh 2012/02/27 22:42:27 1.40
+++ pkgsrc/pkgtools/pkg_comp/files/Attic/pkg_comp.sh 2012/05/19 10:54:40 1.41
@@ -1,16 +1,16 @@ @@ -1,16 +1,16 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# $NetBSD: pkg_comp.sh,v 1.40 2012/02/27 22:42:27 jmmv Exp $ 3# $NetBSD: pkg_comp.sh,v 1.41 2012/05/19 10:54:40 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.
@@ -41,27 +41,27 @@ ProgName="`basename $0`" @@ -41,27 +41,27 @@ ProgName="`basename $0`"
41# as they require special handling. 41# as they require special handling.
42_MKCONF_VARS="WRKDIR_BASENAME MKOBJDIRS BSDSRCDIR WRKOBJDIR DISTDIR PACKAGES \ 42_MKCONF_VARS="WRKDIR_BASENAME MKOBJDIRS BSDSRCDIR WRKOBJDIR DISTDIR PACKAGES \
43 PKG_DEVELOPER CLEANDEPENDS LOCALBASE PKG_SYSCONFBASE \ 43 PKG_DEVELOPER CLEANDEPENDS LOCALBASE PKG_SYSCONFBASE \
44 CFLAGS CPPFLAGS CXXFLAGS USE_AUDIT_PACKAGES PKGVULNDIR \ 44 CFLAGS CPPFLAGS CXXFLAGS USE_AUDIT_PACKAGES PKGVULNDIR \
45 USE_XPKGWEDGE PKGSRC_COMPILER \ 45 USE_XPKGWEDGE PKGSRC_COMPILER \
46 LIBKVER_STANDALONE_PREFIX PKG_DBDIR" 46 LIBKVER_STANDALONE_PREFIX PKG_DBDIR"
47 47
48_TEMPLATE_VARS="DESTDIR ROOTSHELL COPYROOTCFG BUILD_TARGET DISTRIBDIR SETS \ 48_TEMPLATE_VARS="DESTDIR ROOTSHELL COPYROOTCFG BUILD_TARGET DISTRIBDIR SETS \
49 SETS_X11 REAL_SRC REAL_SRC_OPTS REAL_PKGSRC \ 49 SETS_X11 REAL_SRC REAL_SRC_OPTS REAL_PKGSRC \
50 REAL_PKGSRC_OPTS REAL_DISTFILES REAL_DISTFILES_OPTS \ 50 REAL_PKGSRC_OPTS REAL_DISTFILES REAL_DISTFILES_OPTS \
51 REAL_PACKAGES REAL_PACKAGES_OPTS REAL_PKGVULNDIR \ 51 REAL_PACKAGES REAL_PACKAGES_OPTS REAL_PKGVULNDIR \
52 NETBSD_RELEASE MAKEROOT_HOOKS MOUNT_HOOKS UMOUNT_HOOKS \ 52 NETBSD_RELEASE MAKEROOT_HOOKS MOUNT_HOOKS UMOUNT_HOOKS \
53 SYNC_UMOUNT AUTO_TARGET AUTO_PACKAGES BUILD_PACKAGES \ 53 SYNC_UMOUNT AUTO_TARGET AUTO_PACKAGES BUILD_PACKAGES \
54 REAL_CCACHE LIBKVER_STANDALONE_PREFIX" 54 REAL_CCACHE LIBKVER_STANDALONE_PREFIX GENERATE_PKG_SUMMARY"
55 55
56_BUILD_RESUME= 56_BUILD_RESUME=
57 57
58# env_clean 58# env_clean
59# 59#
60# Sets all variables that may appear in the config file to the null 60# Sets all variables that may appear in the config file to the null
61# string, so that we know the environment is in a consistent state. 61# string, so that we know the environment is in a consistent state.
62# 62#
63env_clean() 63env_clean()
64{ 64{
65 MKCONF_VARS="" 65 MKCONF_VARS=""
66 TEMPLATE_VARS="" 66 TEMPLATE_VARS=""
67 for var in ${_MKCONF_VARS} ${_TEMPLATE_VARS}; do 67 for var in ${_MKCONF_VARS} ${_TEMPLATE_VARS}; do
@@ -116,26 +116,27 @@ env_setdefaults() @@ -116,26 +116,27 @@ env_setdefaults()
116 : ${REAL_PKGSRC_OPTS:=-t null -o ro} 116 : ${REAL_PKGSRC_OPTS:=-t null -o ro}
117 : ${REAL_DISTFILES:=/usr/pkgsrc/distfiles} 117 : ${REAL_DISTFILES:=/usr/pkgsrc/distfiles}
118 : ${REAL_DISTFILES_OPTS:=-t null -o rw} 118 : ${REAL_DISTFILES_OPTS:=-t null -o rw}
119 : ${REAL_PACKAGES:=/usr/pkgsrc/packages} 119 : ${REAL_PACKAGES:=/usr/pkgsrc/packages}
120 : ${REAL_PACKAGES_OPTS:=-t null -o rw} 120 : ${REAL_PACKAGES_OPTS:=-t null -o rw}
121 : ${REAL_PKGVULNDIR:=/usr/pkgsrc/distfiles} 121 : ${REAL_PKGVULNDIR:=/usr/pkgsrc/distfiles}
122 : ${NETBSD_RELEASE:=no} 122 : ${NETBSD_RELEASE:=no}
123 : ${LIBKVER_STANDALONE_PREFIX:=/libkver} 123 : ${LIBKVER_STANDALONE_PREFIX:=/libkver}
124 : ${MAKEROOT_HOOKS:=} 124 : ${MAKEROOT_HOOKS:=}
125 : ${MOUNT_HOOKS:=} 125 : ${MOUNT_HOOKS:=}
126 : ${UMOUNT_HOOKS:=} 126 : ${UMOUNT_HOOKS:=}
127 : ${SYNC_UMOUNT:=no} 127 : ${SYNC_UMOUNT:=no}
128 : ${REAL_CCACHE:=} 128 : ${REAL_CCACHE:=}
 129 : ${GENERATE_PKG_SUMMARY:=yes}
129 130
130 if [ -n "${MAKE_PACKAGES}" ]; then 131 if [ -n "${MAKE_PACKAGES}" ]; then
131 warn "MAKE_PACKAGES is deprecated; use {AUTO,BUILD}_PACKAGES instead." 132 warn "MAKE_PACKAGES is deprecated; use {AUTO,BUILD}_PACKAGES instead."
132 : ${AUTO_PACKAGES:=${MAKE_PACKAGES}} 133 : ${AUTO_PACKAGES:=${MAKE_PACKAGES}}
133 : ${BUILD_PACKAGES:=${MAKE_PACKAGES}} 134 : ${BUILD_PACKAGES:=${MAKE_PACKAGES}}
134 fi 135 fi
135 136
136 if [ -n "${MOUNT_SCRIPT}" ]; then 137 if [ -n "${MOUNT_SCRIPT}" ]; then
137 warn "MOUNT_SCRIPT is deprecated; use MOUNT_HOOKS instead." 138 warn "MOUNT_SCRIPT is deprecated; use MOUNT_HOOKS instead."
138 : ${MOUNT_HOOKS:=${MOUNT_SCRIPT}} 139 : ${MOUNT_HOOKS:=${MOUNT_SCRIPT}}
139 fi 140 fi
140 141
141 if [ -n "${UMOUNT_SCRIPT}" ]; then 142 if [ -n "${UMOUNT_SCRIPT}" ]; then
@@ -678,26 +679,38 @@ pkg_auto() @@ -678,26 +679,38 @@ pkg_auto()
678 makeroot 679 makeroot
679 680
680 [ "$nflag" = "no" -a -n "$INSTALL_PACKAGES" ] && 681 [ "$nflag" = "no" -a -n "$INSTALL_PACKAGES" ] &&
681 pkg_install $INSTALL_PACKAGES 682 pkg_install $INSTALL_PACKAGES
682 683
683 echo ${pkgs} | tr ' ' '\n' > ${rfile} 684 echo ${pkgs} | tr ' ' '\n' > ${rfile}
684 fi 685 fi
685 686
686 checkroot 687 checkroot
687 _BUILD_RESUME=${rfile} BUILD_TARGET=${target} pkg_build ${pkgs} 688 _BUILD_RESUME=${rfile} BUILD_TARGET=${target} pkg_build ${pkgs}
688 pkg_removeroot 689 pkg_removeroot
689} 690}
690 691
 692# generate_pkg_summary directory
 693#
 694# Generates a pkg_summary.gz file in the specified directory.
 695generate_pkg_summary()
 696{
 697 local directory="${1}"; shift
 698
 699 echo "PKG_COMP ==> Generating pkg_summary.tgz"
 700 for pkg in "${directory}"/*.tgz; do pkg_info -X "${pkg}"; done \
 701 | gzip -c >"${directory}"/pkg_summary.gz
 702}
 703
691# ---------------------------------------------------------------------- 704# ----------------------------------------------------------------------
692# build target 705# build target
693# ---------------------------------------------------------------------- 706# ----------------------------------------------------------------------
694 707
695# pkg_build pkgs 708# pkg_build pkgs
696# 709#
697# The build target. Also used as a helper function within this script 710# The build target. Also used as a helper function within this script
698# to build several packages when needed. 711# to build several packages when needed.
699# 712#
700pkg_build() 713pkg_build()
701{ 714{
702 local failed invalid p pkgs script statfile 715 local failed invalid p pkgs script statfile
703 716
@@ -743,26 +756,29 @@ EOF @@ -743,26 +756,29 @@ EOF
743 elif [ -n "${_BUILD_RESUME}" ]; then 756 elif [ -n "${_BUILD_RESUME}" ]; then
744 grep -v "^${p}\$" < ${_BUILD_RESUME} > ${_BUILD_RESUME}.new 757 grep -v "^${p}\$" < ${_BUILD_RESUME} > ${_BUILD_RESUME}.new
745 mv ${_BUILD_RESUME}.new ${_BUILD_RESUME} 758 mv ${_BUILD_RESUME}.new ${_BUILD_RESUME}
746 fi 759 fi
747 done 760 done
748 fsumount 761 fsumount
749 if [ -n "$failed" ]; then 762 if [ -n "$failed" ]; then
750 echo "PKG_COMP ==> Build error summary" 763 echo "PKG_COMP ==> Build error summary"
751 echo "Build failed for:" 764 echo "Build failed for:"
752 for p in $failed; do 765 for p in $failed; do
753 echo " $p" 766 echo " $p"
754 done 767 done
755 fi 768 fi
 769 if [ "${GENERATE_PKG_SUMMARY}" = yes ]; then
 770 generate_pkg_summary "${REAL_PACKAGES}/All"
 771 fi
756} 772}
757 773
758# find_pkg name 774# find_pkg name
759# 775#
760# Checks if the given package exists and outputs its path within pkgsrc. 776# Checks if the given package exists and outputs its path within pkgsrc.
761# Outputs nothing if the package is not found. 777# Outputs nothing if the package is not found.
762find_pkg() 778find_pkg()
763{ 779{
764 local name="${1}" 780 local name="${1}"
765 781
766 case "${name}" in 782 case "${name}" in
767 */*) 783 */*)
768 if [ -d "${REAL_PKGSRC}/${name}" ]; then 784 if [ -d "${REAL_PKGSRC}/${name}" ]; then