pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkgchk Update pkgchk to 1.42



details:   https://anonhg.NetBSD.org/pkgsrc/rev/97f240a48f47
branches:  trunk
changeset: 462378:97f240a48f47
user:      abs <abs%pkgsrc.org@localhost>
date:      Wed Oct 01 11:25:02 2003 +0000

description:
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.

diffstat:

 pkgtools/pkgchk/Makefile        |   4 +-
 pkgtools/pkgchk/files/pkgchk.8  |  49 ++++++++++++++++-----
 pkgtools/pkgchk/files/pkgchk.sh |  90 ++++++++++++++++++++++++++++++++++++----
 3 files changed, 118 insertions(+), 25 deletions(-)

diffs (294 lines):

diff -r 875f3cf6f31f -r 97f240a48f47 pkgtools/pkgchk/Makefile
--- a/pkgtools/pkgchk/Makefile  Wed Oct 01 08:22:48 2003 +0000
+++ b/pkgtools/pkgchk/Makefile  Wed Oct 01 11:25:02 2003 +0000
@@ -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 -r 875f3cf6f31f -r 97f240a48f47 pkgtools/pkgchk/files/pkgchk.8
--- a/pkgtools/pkgchk/files/pkgchk.8    Wed Oct 01 08:22:48 2003 +0000
+++ b/pkgtools/pkgchk/files/pkgchk.8    Wed Oct 01 11:25:02 2003 +0000
@@ -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@localhost)
 .\" 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 @@
 .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 @@
 .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 @@
 .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 @@
 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 @@
 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 @@
 .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 @@
 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 -r 875f3cf6f31f -r 97f240a48f47 pkgtools/pkgchk/files/pkgchk.sh
--- a/pkgtools/pkgchk/files/pkgchk.sh   Wed Oct 01 08:22:48 2003 +0000
+++ b/pkgtools/pkgchk/files/pkgchk.sh   Wed Oct 01 11:25:02 2003 +0000
@@ -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 @@
     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 @@
     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 @@
     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 @@
        -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 @@
     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 @@
        -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 @@
 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 @@
     `
 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



Home | Main Index | Thread Index | Old Index