pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/cdpack Update to cdpack-1.9. This version te...
details: https://anonhg.NetBSD.org/pkgsrc/rev/a29afffd3d30
branches: trunk
changeset: 554767:a29afffd3d30
user: dmcmahill <dmcmahill%pkgsrc.org@localhost>
date: Fri Feb 20 05:16:51 2009 +0000
description:
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.
diffstat:
pkgtools/cdpack/Makefile | 16 +++++++-
pkgtools/cdpack/files/cdgen.awk | 67 +++++++++++++++++++++++++++++++---------
pkgtools/cdpack/files/cdpack.1 | 15 ++++++++-
pkgtools/cdpack/files/cdpack.sh | 41 ++++++++++++++++++++++---
4 files changed, 114 insertions(+), 25 deletions(-)
diffs (285 lines):
diff -r 6213fb1478f7 -r a29afffd3d30 pkgtools/cdpack/Makefile
--- a/pkgtools/cdpack/Makefile Fri Feb 20 03:41:25 2009 +0000
+++ b/pkgtools/cdpack/Makefile Fri Feb 20 05:16:51 2009 +0000
@@ -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_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 @@
${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 -r 6213fb1478f7 -r a29afffd3d30 pkgtools/cdpack/files/cdgen.awk
--- a/pkgtools/cdpack/files/cdgen.awk Fri Feb 20 03:41:25 2009 +0000
+++ b/pkgtools/cdpack/files/cdgen.awk Fri Feb 20 05:16:51 2009 +0000
@@ -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 @@
}
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 @@
# 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 @@
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 -r 6213fb1478f7 -r a29afffd3d30 pkgtools/cdpack/files/cdpack.1
--- a/pkgtools/cdpack/files/cdpack.1 Fri Feb 20 03:41:25 2009 +0000
+++ b/pkgtools/cdpack/files/cdpack.1 Fri Feb 20 05:16:51 2009 +0000
@@ -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 @@
.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 @@
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 -r 6213fb1478f7 -r a29afffd3d30 pkgtools/cdpack/files/cdpack.sh
--- a/pkgtools/cdpack/files/cdpack.sh Fri Feb 20 03:41:25 2009 +0000
+++ b/pkgtools/cdpack/files/cdpack.sh Fri Feb 20 05:16:51 2009 +0000
@@ -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 @@
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 @@
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 @@
*.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 @@
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 @@
echo "$pkgname $pkgname" >> $deptree
fi
- echo "$pkgname | $bestdeps | $cfls" >> $depf2
+ echo "$pkgname | $bestdeps | $cfls | $pkg_sufx" >> $depf2
npkgs=`${EXPR} $npkgs + 1`
else
Home |
Main Index |
Thread Index |
Old Index