summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordmcmahill <dmcmahill@pkgsrc.org>2009-02-20 05:16:51 +0000
committerdmcmahill <dmcmahill@pkgsrc.org>2009-02-20 05:16:51 +0000
commit7037193a4e4ec3a2456c47894a73cd549b497ef1 (patch)
tree5b5e21daeb1fc2c32e0bf1d078a89c5d59565c6c
parent732f59f780984eef396939cd12af74b2ee04c0f1 (diff)
downloadpkgsrc-7037193a4e4ec3a2456c47894a73cd549b497ef1.tar.gz
Update to cdpack-1.9. This version teaches cdpack how to add packages
ending in .tbz as well as .tgz. Should address the problem reported in PR pkg/40515. I am explicitly not using the mk.conf settings for PKG_SUFX though because at run time we may or may not have a valid mk.conf on hand that corresponds to how the packages were built.
-rw-r--r--pkgtools/cdpack/Makefile16
-rwxr-xr-xpkgtools/cdpack/files/cdgen.awk67
-rw-r--r--pkgtools/cdpack/files/cdpack.115
-rwxr-xr-xpkgtools/cdpack/files/cdpack.sh41
4 files changed, 114 insertions, 25 deletions
diff --git a/pkgtools/cdpack/Makefile b/pkgtools/cdpack/Makefile
index 8b6976877c9..5b2cd0b8980 100644
--- a/pkgtools/cdpack/Makefile
+++ b/pkgtools/cdpack/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.28 2008/06/16 15:29:35 joerg Exp $
+# $NetBSD: Makefile,v 1.29 2009/02/20 05:16:51 dmcmahill Exp $
#
-DISTNAME= cdpack-1.8
+DISTNAME= cdpack-1.9
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
@@ -20,9 +20,12 @@ NO_CHECKSUM= yes
NO_CONFIGURE= yes
USE_TOOLS+= awk:run
+USE_TOOLS+= bzcat:run
USE_TOOLS+= expr:run
+USE_TOOLS+= gzcat:run
USE_TOOLS+= printf:run
USE_TOOLS+= sort:run
+USE_TOOLS+= tar:run
USE_TOOLS+= tsort:run
INSTALLATION_DIRS= bin libexec ${PKGMANDIR}/man1
@@ -32,14 +35,21 @@ do-build:
${SED} -e 's;@prefix@;${PREFIX};g' \
-e 's;@progver@;${PKGVERSION};g' \
-e 's;@AWK@;${AWK};g' \
+ -e 's;@BZCAT@;${BZCAT};g' \
-e 's;@EXPR@;${EXPR};g' \
+ -e 's;@GZCAT@;${GZCAT};g' \
-e 's;@PRINTF@;${PRINTF};g' \
-e 's;@SORT@;${SORT};g' \
+ -e 's;@TAR@;${TAR};g' \
-e 's;@TSORT@;${TSORT};g' \
${FILESDIR}/${f}.sh > \
${WRKSRC}/${f}
${CHMOD} 755 ${WRKDIR}/${f}
- ${SED} -e 's;@AWK@;${AWK};g' ${FILESDIR}/${f}.1 > \
+ ${SED} -e 's;@AWK@;${AWK};g' \
+ -e 's;@BZCAT@;${BZCAT};g' \
+ -e 's;@GZCAT@;${GZCAT};g' \
+ -e 's;@TAR@;${TAR};g' \
+ ${FILESDIR}/${f}.1 > \
${WRKSRC}/${f}.1
.endfor
${SED} -e 's;@AWK@;${AWK};g' ${FILESDIR}/cdgen.awk > \
diff --git a/pkgtools/cdpack/files/cdgen.awk b/pkgtools/cdpack/files/cdgen.awk
index 6f4fbbace0d..6e85184cdc8 100755
--- a/pkgtools/cdpack/files/cdgen.awk
+++ b/pkgtools/cdpack/files/cdgen.awk
@@ -1,7 +1,7 @@
#!@AWK@ -f
-# $NetBSD: cdgen.awk,v 1.6 2005/08/01 21:47:43 dmcmahill Exp $
+# $NetBSD: cdgen.awk,v 1.7 2009/02/20 05:16:51 dmcmahill Exp $
#
-# Copyright (c) 2001, 2002, 2003, 2005 Dan McMahill, All rights reserved.
+# Copyright (c) 2001, 2002, 2003, 2005, 2009 Dan McMahill, All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -33,6 +33,12 @@
BEGIN {
+# all of the PKG_SUFX values which are currently allowed. This is hardcoded into
+# pkg_create(1) and friends.
+
+ allsf[1] = ".tgz";
+ allsf[2] = ".tbz";
+
# ARGV[0] = program name
# ARGV[1] = packages directory (/usr/pkgsrc/packages/All)
# ARGV[2] = output directory
@@ -179,6 +185,11 @@ BEGIN {
}
else{
printf("WARNING: binary package \"%s\" has zero size\n",pkgorder[n]);
+ if(!verbose) {
+ verbose = 1;
+ getsize(pkgorder[n]);
+ verbose = 0;
+ }
}
totsize = totsize + pkgsize[pkgorder[n]];
}
@@ -393,9 +404,14 @@ BEGIN {
# populate it with the symlinks to the binary packages
for (n=1; n<=npkgs; n++){
if (cdcontents[cdn":"pkgorder[n]]){
- cmd = "cd " outdir " && ln -s " packages "/" ;
- cmd = cmd pkgorder[n] ".tgz";
- do_system(cmd);
+ for(i in allsf) {
+ cmd="test -f " packages "/" pkgorder[n] allsf[i];
+ if( (r = system(cmd)) == 0){
+ cmd = "cd " outdir " && ln -s " packages "/" ;
+ cmd = cmd pkgorder[n] allsf[i];
+ do_system(cmd);
+ }
+ }
}
}
@@ -414,17 +430,36 @@ BEGIN {
exit 0
} # BEGIN
-function getsize(name,cmd,sz){
-
- cmd="test -f " packages "/" name ".tgz";
- if(system(cmd) == 0){
- cmd="du -k " packages "/" name ".tgz";
- cmd | getline ;
- close(cmd);
- sz=$1;
- }
- else{
- sz=0;
+# This is a bit of a hack, but in the event that we have both a
+# foo-1.3.tgz and a foo-1.3.tbz, we currently take them both.
+# I'm not sure how we avoid this. One option is a flag to
+# cdpack that says to prefer the .tbz over the .tgz for example.
+# To implement that, the cdpack.sh shell script would need some
+# updating as well as this function. Grep for ".tgz" in
+# pkgsrc/pkgutils/cdpack/files/* and also grep for allsf in this file
+
+function getsize(name,cmd,sz,i,pkgsfx,r){
+ sz=0;
+ for(i in allsf) {
+ pkgsfx=allsf[i];
+ cmd="test -f " packages "/" name pkgsfx;
+ if( verbose ) {
+ printf("getsize(%s): Checking for suffix \"%s\" with:\n", name, pkgsfx);
+ printf(" %s\n", cmd);
+ }
+ if( (r = system(cmd)) == 0){
+ cmd="du -k " packages "/" name pkgsfx;
+ cmd | getline ;
+ close(cmd);
+ if( verbose ) {
+ printf(" \"%s\" gave %s\n", cmd, $0);
+ }
+ sz=sz + $1;
+ } else {
+ if( verbose ) {
+ printf(" command returned %d\n", r);
+ }
+ }
}
return(sz);
diff --git a/pkgtools/cdpack/files/cdpack.1 b/pkgtools/cdpack/files/cdpack.1
index e2cae81ecc5..c3896a192cd 100644
--- a/pkgtools/cdpack/files/cdpack.1
+++ b/pkgtools/cdpack/files/cdpack.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: cdpack.1,v 1.13 2008/01/28 23:06:14 dmcmahill Exp $
+.\" $NetBSD: cdpack.1,v 1.14 2009/02/20 05:16:51 dmcmahill Exp $
.\"
.\" Copyright (c) 2001, 2002, 2003, 2005 Dan McMahill, All rights reserved.
.\"
@@ -70,6 +70,11 @@ that directory. A file,
.Ar .index ,
which lists the contents of each CD/DVD will be left in the root
directory of each CD/DVD image.
+.Nm
+will look for files ending both in .tgz as well as .tbz when
+scanning the directory
+.Ar packages_directory
+for binary packages.
.Bl -tag -width "-x directory "
.It Fl ac
Include binary packages marked as NO_BIN_ON_CDROM on the CD/DVD set.
@@ -159,6 +164,14 @@ uses the fillowing environment variables if set.
awk implementation to use.
Defaults to
.Dq Li @AWK@ .
+.It Ev BZCAT
+bzcat2 implementation to use.
+Defaults to
+.Dq Li @BZCAT@ .
+.It Ev GZCAT
+bzcat2 implementation to use.
+Defaults to
+.Dq Li @GZCAT@ .
.It Ev TMPDIR
Directory for holding temporary files during the image creation.
Defaults to
diff --git a/pkgtools/cdpack/files/cdpack.sh b/pkgtools/cdpack/files/cdpack.sh
index 4696650f0a7..ac65f3128a4 100755
--- a/pkgtools/cdpack/files/cdpack.sh
+++ b/pkgtools/cdpack/files/cdpack.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-# $NetBSD: cdpack.sh,v 1.12 2008/01/28 23:03:48 dmcmahill Exp $
+# $NetBSD: cdpack.sh,v 1.13 2009/02/20 05:16:51 dmcmahill Exp $
#
-# Copyright (c) 2001, 2002, 2003, 2005 Dan McMahill, All rights reserved.
+# Copyright (c) 2001, 2002, 2003, 2005, 2009 Dan McMahill, All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -40,11 +40,16 @@ progver=@progver@
TMPDIR=${TMPDIR:-/tmp}
TMP=${TMPDIR}/${prog}.$$
+
AWK=${AWK:-@AWK@}
+BZCAT=${BZCAT:-@BZCAT@}
EXPR="@EXPR@"
+GZCAT=${GZCAT:-@GZCAT@}
SORT="@SORT@"
+TAR="${TAR:-@TAR@}"
TSORT="@TSORT@"
+
depf=$TMP/depf
depf2=$TMP/depf2
deptree=$TMP/deptree
@@ -250,6 +255,21 @@ if [ "$VERBOSE" = "yes" ]; then
else
echo "A CD-ROM sized image will be created"
fi
+
+ cat << EOF
+
+The following tools will be used:
+
+AWK = ${AWK}
+BZCAT = ${BZCAT}
+EXPR = ${EXPR}
+GZCAT = ${GZCAT}
+SORT = ${SORT}
+TAR = ${TAR}
+TSORT = ${TSORT}
+
+EOF
+
fi
#
@@ -326,14 +346,24 @@ do
*.txt)
continue
;;
+ *.tbz)
+ pkg_sufx=.tbz
+ ZCAT=${BZCAT}
+ ;;
+
+ *.tgz)
+ pkg_sufx=.tgz
+ ZCAT=${GZCAT}
+ ;;
+
esac
if [ -f $pkg ]; then
# extract the packge name
- pkgname=`basename $pkg .tgz`
+ pkgname=`basename $pkg $pkg_sufx`
# extract the packing list
- cat $pkg | (cd $TMP; tar --fast-read -xzf - +BUILD_INFO +CONTENTS)
+ cat $pkg | (cd $TMP; $ZCAT - | ${TAR} --fast-read -xf - +BUILD_INFO +CONTENTS)
# extract the depends
deps=`${AWK} '/^@pkgdep/ {printf("%s ",$2)}' $TMP/+CONTENTS`
@@ -383,6 +413,7 @@ do
best=`/usr/sbin/pkg_admin lsbest "${packages}/${dep}"`
if [ ! -z "$best" ]; then
best=`basename $best .tgz`
+ best=`basename $best .tbz`
bestdeps=$bestdeps" "$best
echo "$best $pkgname" >> $deptree
listed=yes
@@ -398,7 +429,7 @@ do
echo "$pkgname $pkgname" >> $deptree
fi
- echo "$pkgname | $bestdeps | $cfls" >> $depf2
+ echo "$pkgname | $bestdeps | $cfls | $pkg_sufx" >> $depf2
npkgs=`${EXPR} $npkgs + 1`
else