diff options
author | abs <abs> | 2003-10-01 11:25:02 +0000 |
---|---|---|
committer | abs <abs> | 2003-10-01 11:25:02 +0000 |
commit | 6950490639502558f923a7ae136d90fa450f1b9c (patch) | |
tree | a6b6231f055eb7cc0f27a361899209d45570ec65 | |
parent | 25d52dba9d5cfd82eb5f0591ec8820e5bac3d31b (diff) | |
download | pkgsrc-6950490639502558f923a7ae136d90fa450f1b9c.tar.gz |
Update pkgchk to 1.42
Update -L:
Do not reset the logfile at the start of each package. Also
try to make the 'tail' of the logfile in the event of an
error more useful.
Implement -l:
List the filename for all binary packages (including the
exact dependencies against which each package was built)
based on pkgchk.conf. Will abort if a binary package is
missing. This can be used (in conjunction with -U and -D)
to determine what packages would need to be copied to a
remote machine to ensure it was completely up to date.
-rw-r--r-- | pkgtools/pkgchk/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkgchk/files/pkgchk.8 | 49 | ||||
-rwxr-xr-x | pkgtools/pkgchk/files/pkgchk.sh | 90 |
3 files changed, 118 insertions, 25 deletions
diff --git a/pkgtools/pkgchk/Makefile b/pkgtools/pkgchk/Makefile index a9cdcfe9384..872a31b0818 100644 --- a/pkgtools/pkgchk/Makefile +++ b/pkgtools/pkgchk/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.45 2003/09/16 14:36:08 abs Exp $ +# $NetBSD: Makefile,v 1.46 2003/10/01 11:25:02 abs Exp $ -DISTNAME= pkgchk-1.41 +DISTNAME= pkgchk-1.42 WRKSRC= ${WRKDIR} CATEGORIES= pkgtools MASTER_SITES= # empty diff --git a/pkgtools/pkgchk/files/pkgchk.8 b/pkgtools/pkgchk/files/pkgchk.8 index 165d6bd5df8..6c9bc1033af 100644 --- a/pkgtools/pkgchk/files/pkgchk.8 +++ b/pkgtools/pkgchk/files/pkgchk.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: pkgchk.8,v 1.16 2003/09/16 14:45:53 wiz Exp $ +.\" $NetBSD: pkgchk.8,v 1.17 2003/10/01 11:25:02 abs Exp $ .\" .\" Copyright (c) 2001 by David Brownlee (abs@netbsd.org) .\" Absolutely no warranty. @@ -10,7 +10,7 @@ .Nd check, and optionally update, installed packages .Sh SYNOPSIS .Nm -.Op Fl aBbcfhiknrsuv +.Op Fl aBbcfhiklnrsuv .Op Fl C Ar conf .Op Fl D Ar tags .Op Fl L Ar file @@ -48,13 +48,16 @@ then .Nm will automatically generate binary packages for later reuse. .It Fl C Ar conf -Use the pkgchk.conf file +Use the +.Pa pkgchk.conf +file .Sq Ar conf . .It Fl c -Check versions of packages specified in pkgchk.conf. +Check versions of packages specified in +.Pa pkgchk.conf . .It Fl D Ar tags Add the comma separated list of tags to those checked when parsing -pkgchk.conf. +.Pa pkgchk.conf . Also includes .Ev PKGCHK_TAGS . .It Fl f @@ -71,7 +74,8 @@ to just fetch missing/mismatches packages. .It Fl h Brief help. .It Fl i -Check versions of installed packages, ignoring pkgchk.conf. +Check versions of installed packages, ignoring +.Pa pkgchk.conf . .It Fl k Continue with further packages if errors are encountered. .It Fl L Ar file @@ -79,6 +83,14 @@ Redirect the output for all commands run into the logfile .Pa file . Should be specified as a full pathname. On any error the tail end of the logfile will be displayed. +.It Fl l +List the filename for all binary packages (including the exact dependencies +against which each package was built) based on +.Pa pkgchk.conf . +Will abort if a binary package is missing. +This can be used (in conjunction with -U and -D) to determine what +packages would need to be copied to a remote machine to ensure it +was completely up to date. .It Fl n Display actions that would be taken, but do not change anything. .It Fl r @@ -89,7 +101,8 @@ for later update. Limit additions or updates to building from source. .It Fl U Ar tags Remove the comma separated list of tags from those checked when -parsing pkgchk.conf. +parsing +.Pa pkgchk.conf . Also includes .Ev PKGCHK_NOTAGS . Package directories can also be skipped by listing them under @@ -106,10 +119,14 @@ options are given. Note: If the update fails (particularly when building from source), the system will be left with missing packages. .It Fl v -Verbose - list the tags set when checking pkgchk.conf, and all packages checked. +Verbose - list the tags set when checking +.Pa pkgchk.conf , +and all packages checked. .El .Sh FILE FORMAT -Each non comment line in pkgsrc.conf should contain a package +Each non comment line in +.Pa pkgsrc.conf +should contain a package directory (such as sysutils/skill) followed by an optional list of tags. Tags are checked against the current machine's set: @@ -143,7 +160,9 @@ match the current machine. .El .Pp The default set of tags used to determine which packages to match -in pkgsrc.conf are equivalent to the output of the following with +in +.Pa pkgsrc.conf +are equivalent to the output of the following with any spaces converted to hypens (-): hostname -s, hostname, uname -srm, uname -sr, uname -sm, uname -s, uname -r, uname -m. If @@ -211,12 +230,16 @@ If not set in environment then read from Defaults to .Pa ${PKGSRCDIR}/pkgchk.conf . .It Ev PKGCHK_TAGS -Additional tags to add when parsing pkgchk.conf. +Additional tags to add when parsing +.Pa pkgchk.conf . .It Ev PKGCHK_NOTAGS -Additional tags to unset when parsing pkgchk.conf. +Additional tags to unset when parsing +.Pa pkgchk.conf . .El .Sh EXAMPLES -Sample pkgchk.conf file: +Sample +.Pa pkgchk.conf +file: .Bd -literal # Must install before others devel/cpuflags diff --git a/pkgtools/pkgchk/files/pkgchk.sh b/pkgtools/pkgchk/files/pkgchk.sh index 70c4832a45b..9da7b5c1db7 100755 --- a/pkgtools/pkgchk/files/pkgchk.sh +++ b/pkgtools/pkgchk/files/pkgchk.sh @@ -1,6 +1,6 @@ #!/bin/sh -e # -# $Id: pkgchk.sh,v 1.44 2003/09/16 14:36:12 abs Exp $ +# $Id: pkgchk.sh,v 1.45 2003/10/01 11:25:02 abs Exp $ # # TODO: Handle updates with dependencies via binary packages @@ -63,6 +63,69 @@ check_packages_installed() done } +list_packages() + { + CHECKLIST=' ' + for pkgdir in $* ; do + + if [ ! -f $PKGSRCDIR/$pkgdir/Makefile ];then + echo "WARNING: No $pkgdir/Makefile - package moved or obsolete?" + continue + fi + cd $PKGSRCDIR/$pkgdir + extract_make_vars PKGNAME + if [ -z "$PKGNAME" ]; then + echo "Unable to extract PKGNAME for $pkgdir" + exit 1 + fi + if [ ! -f $PACKAGES/All/$PKGNAME.tgz ] ;then + echo " ** $PKGNAME - binary package missing" + if [ -n "$opt_k" ];then + exit 1 + fi + continue + fi + if [ -n "$opt_v" ];then + echo "$PKGNAME.tgz: found" + fi + CHECKLIST="$CHECKLIST$PKGNAME "; + if [ $PKGNAME = 'samba-2.2.8anb4.tgz' ] ; then + echo XXX + break + fi + done + while [ "$CHECKLIST" != ' ' ]; do + PKGLIST="$PKGLIST$CHECKLIST" + NEXTCHECK=' ' + for pkg in $CHECKLIST ; do + if [ ! -f $PACKAGES/All/$pkg.tgz ] ; then + echo " ** $PKGNAME - binary package (dependency) missing" + if [ -n "$opt_k" ];then + exit 1 + fi + continue + fi + for dep in `pkg_info -N $PACKAGES/All/$pkg.tgz | ${SED} '1,/Built using:/d' | ${GREP} ..` ; do + case "$PKGLIST" in + *\ $dep\ *) + if [ -n "$opt_v" ];then + echo "Duplicate depend $dep" + fi;; + *) + NEXTCHECK="$NEXTCHECK$dep " + if [ -n "$opt_v" ];then + echo "Add depend $dep" + fi;; + esac + done + done + CHECKLIST="$NEXTCHECK" + done + for pkg in $PKGLIST ; do + echo $pkg.tgz + done + } + echo_n() { echo $ac_n "$*"$ac_c @@ -228,14 +291,15 @@ run_cmd() echo $1 if [ -z "$opt_n" ];then if [ -n "$opt_L" ] ; then - sh -c "$1" > "$opt_L" 2>&1 || FAIL=1 + sh -c "$1" >> "$opt_L" 2>&1 || FAIL=1 else sh -c "$1" || FAIL=1 fi if [ -n "$FAIL" ] ; then echo "** '$1' failed" if [ -n "$opt_L" ] ; then - tail -20 "$opt_L" + tail -100 "$opt_L" | egrep -v '^(\*\*\* Error code 1|Stop\.)' |\ + tail -40 fi if [ "$FAILOK" != 1 ]; then exit 1 @@ -244,7 +308,7 @@ run_cmd() fi } -args=`getopt BC:D:L:U:abcfhiknrsuv $*` +args=`getopt BC:D:L:U:abcfhiklnrsuv $*` if [ $? != 0 ]; then opt_h=1 fi @@ -263,6 +327,7 @@ while [ $# != 0 ]; do -h ) opt_h=1 ;; -i ) opt_i=1 ;; -k ) opt_k=1 ;; + -l ) opt_l=1 ;; -n ) opt_n=1 ;; -r ) opt_r=1 ;; -s ) opt_s=1 ;; @@ -277,8 +342,8 @@ if [ -z "$opt_b" -a -z "$opt_s" ];then opt_b=1; opt_s=1; fi -if [ -z "$opt_a" -a -z "$opt_c" -a -z "$opt_i" ];then - echo "Must specify at least one of -a, -c, -i, or -u"; +if [ -z "$opt_a" -a -z "$opt_c" -a -z "$opt_i" -a -z "$opt_l" ];then + echo "Must specify at least one of -a, -c, -i, -l, or -u"; echo opt_h=1; fi @@ -297,6 +362,7 @@ if [ -n "$opt_h" -o $# != 1 ];then -h This help -i Check versions of installed packages (not using pkgchk.conf) -k Continue with further packages if errors are encountered + -l List binary packages including dependencies (implies -c) -n Display actions that would be taken, but do not perform them -r Recursively remove mismatched files (use with care) -s Limit installations to building from source @@ -355,7 +421,7 @@ if [ -n "$opt_i" ];then fi -if [ -n "$opt_c" ];then +if [ -n "$opt_c" -o -n "$opt_l" ];then if [ ! -r $PKGCHK_CONF ];then echo "Unable to read PKGCHK_CONF '$PKGCHK_CONF'" @@ -440,9 +506,13 @@ if [ -n "$opt_c" ];then ` fi -# Check $PKGDIRLIST packages are installed and correct version -# -check_packages_installed $PKGDIRLIST +if [ -n "$opt_l" ] ; then + list_packages $PKGDIRLIST +else + # Check $PKGDIRLIST packages are installed and correct version + # + check_packages_installed $PKGDIRLIST +fi if [ -n "$opt_r" -a -n "$MISMATCH_TODO" ]; then run_cmd "${PKG_DELETE} -r $MISMATCH_TODO" 1 |