diff options
author | wiz <wiz> | 2011-03-19 09:44:16 +0000 |
---|---|---|
committer | wiz <wiz> | 2011-03-19 09:44:16 +0000 |
commit | 672cdb99a1373e0a623d65494014b6fb9320b2eb (patch) | |
tree | 5ced8a99985bdb2c089f4b447ab0d8b072a248b8 /pkgtools | |
parent | dfb3f083e26d8d2f853daff43de3da0bb332bbd5 (diff) | |
download | pkgsrc-672cdb99a1373e0a623d65494014b6fb9320b2eb.tar.gz |
Add filebase support, allowing to choose the filename for the resulting
package; from Aleksey Cheusov in relation to PR 44698.
Bump version to 1.9.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkg_tarup/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkg_tarup/files/pkg_tarup | 50 | ||||
-rw-r--r-- | pkgtools/pkg_tarup/files/pkg_tarup.1 | 32 |
3 files changed, 58 insertions, 28 deletions
diff --git a/pkgtools/pkg_tarup/Makefile b/pkgtools/pkg_tarup/Makefile index f5edb3011c1..8801abfc461 100644 --- a/pkgtools/pkg_tarup/Makefile +++ b/pkgtools/pkg_tarup/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.37 2009/11/05 16:22:46 joerg Exp $ +# $NetBSD: Makefile,v 1.38 2011/03/19 09:44:16 wiz Exp $ -DISTNAME= pkg_tarup-1.8 +DISTNAME= pkg_tarup-1.9 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkg_tarup/files/pkg_tarup b/pkgtools/pkg_tarup/files/pkg_tarup index 08257cbc176..f019e5f4f2f 100644 --- a/pkgtools/pkg_tarup/files/pkg_tarup +++ b/pkgtools/pkg_tarup/files/pkg_tarup @@ -1,6 +1,6 @@ #! @SH@ # -# $Id: pkg_tarup,v 1.23 2009/11/05 16:22:47 joerg Exp $ +# $Id: pkg_tarup,v 1.24 2011/03/19 09:44:17 wiz Exp $ # # Tar up installed package # @@ -53,12 +53,20 @@ GETDEPS=0 usage() { - ${ECHO} "Usage: $1 [-a] [-K pkg_dbdir] [-d pkgrepository] [-s pkg_sufx] installed_pkg|pattern [...]" - ${ECHO} "The following environment variables are used:" - ${ECHO} " (unless overriden by command line parameters)" - ${ECHO} " PKGREPOSITORY - A destination directory for packages (/tmp)" - ${ECHO} " PKG_DBDIR - The location of the package database directory" - ${ECHO} " PKG_SUFX - The suffix to append to the package (.tgz)" + cat <<'EOF' +Usage: pkg_tarup [OPTIONS] installed_pkg|pattern [...] +OPTIONS: + -a - Create packages for all dependent packages too. + -d <pkgrepository> - Set the destination directory for packages. + -f <filebase> - Set the filebase. + -K <pkg_dbdir> - Set the package database directory. + -s <pkg_sufx> - Set the extension used for the created package(s). +The following environment variables are used: + (unless overriden by command line parameters) + PKGREPOSITORY - A destination directory for packages (/tmp) + PKG_DBDIR - The location of the package database directory + PKG_SUFX - The suffix to append to the package (.tgz) +EOF exit 1 } @@ -81,8 +89,13 @@ check_and_add() create_package() { PKG="$1" + if [ -n "$FILEBASE" ]; then + PKGFILE=`echo "$PKG" | sed 's/^\(.*\)\(-[0-9][^-]*$\)/'"$FILEBASE"'\2/'` + else + PKGFILE="$PKG" + fi PKG_ARGS= - ${ECHO} "Creating binary package: $PKG" + ${ECHO} "Creating binary package: $PKGFILE" check_and_add -c "${PKG_DBDIR}/${PKG}/+COMMENT" check_and_add -d "${PKG_DBDIR}/${PKG}/+DESC" @@ -130,7 +143,7 @@ create_package() PKG_ARGS="${PKG_ARGS} -l" PKG_ARGS="${PKG_ARGS} -p \"${PKG_PREFIX}\"" PKG_ARGS="${PKG_ARGS} -I \"${PKG_PREFIX}\"" - PKG_ARGS="${PKG_ARGS} \"${PKGREPOSITORY}/${PKG}${PKG_SUFX}\"" + PKG_ARGS="${PKG_ARGS} \"${PKGREPOSITORY}/${PKGFILE}${PKG_SUFX}\"" if [ -f "${PKG_DBDIR}/${PKG}/+VIEWS" ] then PKG_ARGS="${PKG_ARGS} -E" @@ -154,7 +167,7 @@ add_to_list() for rPKG in `pkg_info -e "$1" | ${SED} -e's/\"/\\\"/g'` ; do if [ -z "$rPKG" -o -f "${PKG_DBDIR}/${rPKG}" ] ; then ${ECHO} "Error: package $1 not found" - usage "$0" + usage fi added=1 @@ -191,6 +204,10 @@ while [ $# -gt 0 ] ; do PKG_SUFX="$2" shift 2 ;; + -f) + FILEBASE="$2" + shift 2 + ;; *) break ;; @@ -210,6 +227,11 @@ add_all_deps_to_list() IFS="$oIFS" } +arg_cnt () +{ + echo $# +} + while [ $# -gt 0 ] ; do add_to_list "$1" if [ $GETDEPS -eq 1 ] ; then @@ -217,9 +239,15 @@ while [ $# -gt 0 ] ; do fi shift done +if [ -n "$FILEBASE" ]; then + if [ `arg_cnt ${PKGS}` -ne 1 ] ; then + ${ECHO} "ERROR: -f cannot be used for creating multiple packages!" + exit 1 + fi +fi if [ -z "${PKGS}" ] ; then ${ECHO} "ERROR: No packages to tarup identified!" - usage "$0" + usage fi FOR=" for xPKG in ${PKGS} ; do diff --git a/pkgtools/pkg_tarup/files/pkg_tarup.1 b/pkgtools/pkg_tarup/files/pkg_tarup.1 index 73906cc9474..1d57e6da44b 100644 --- a/pkgtools/pkg_tarup/files/pkg_tarup.1 +++ b/pkgtools/pkg_tarup/files/pkg_tarup.1 @@ -1,22 +1,17 @@ -.\" $NetBSD: pkg_tarup.1,v 1.4 2008/11/19 00:20:48 obache Exp $ -.Dd July 14, 2004 +.\" $NetBSD: pkg_tarup.1,v 1.5 2011/03/19 09:44:17 wiz Exp $ +.Dd March 19, 2011 .Dt PKG_TARUP 1 .Os .Sh NAME .Nm pkg_tarup -.Nd a utility for tarring up installed software packages +.Nd utility for tarring up installed software packages .Sh SYNOPSIS .Nm .Op Fl a -.Bk -words .Op Fl d Ar pkgrepository -.Ek -.Bk -words +.Op Fl f Ar filebase .Op Fl K Ar pkg_dbdir -.Ek -.Bk -words .Op Fl s Ar pkg_sufx -.Ek .Ar pkg-name-or-pattern .Op Ar ... .Sh DESCRIPTION @@ -52,12 +47,15 @@ Set as the extension used for the created package file(s). If this option isn't specified, then .Pa .tgz -is used. +.It Fl f Ar filebase +By default filename for created package looks like this +.Dl ${pkgbase}-${pkgversion}${pkg_sufx} +This option allows to +use +.Ar filebase +instead of +.Pa ${pkgbase} . .El -.Sh EXIT STATUS -The -.Nm -utility exits 0 on success and 1 on errors. .Sh ENVIRONMENT The following environment variables affect the execution of .Nm : @@ -105,10 +103,14 @@ Any variable that affects .Xr pkg_info 1 or .Xr pkg_create 1 . +.Sh EXIT STATUS +The +.Nm +utility exits 0 on success and 1 on errors. .Sh SEE ALSO .Xr pkg_create 1 , .Xr pkg_info 1 , -.Xr packages 7 +.Xr pkgsrc 7 .Sh BUGS Packages that contain files with spaces in their names probably won't work. |