pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc Update pkg_chk to 1.86:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7fd5d9b0989c
branches:  trunk
changeset: 532655:7fd5d9b0989c
user:      abs <abs%pkgsrc.org@localhost>
date:      Mon Aug 27 15:28:54 2007 +0000

description:
Update pkg_chk to 1.86:
    - Fix '-l' to list dependencies needed at runtime by each package, as
      opposed to those at build time. Avoids issues such as 'jdk15' pulling
      in sun-jdk & sun-jre

diffstat:

 doc/CHANGES-2007                  |    3 +-
 pkgtools/pkg_chk/Makefile         |    6 +-
 pkgtools/pkg_chk/files/pkg_chk.8  |    7 +-
 pkgtools/pkg_chk/files/pkg_chk.sh |  145 +++++++++++++++++++++----------------
 4 files changed, 90 insertions(+), 71 deletions(-)

diffs (266 lines):

diff -r fa89220ee2d0 -r 7fd5d9b0989c doc/CHANGES-2007
--- a/doc/CHANGES-2007  Mon Aug 27 10:42:46 2007 +0000
+++ b/doc/CHANGES-2007  Mon Aug 27 15:28:54 2007 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES-2007,v 1.1883 2007/08/27 10:42:04 ghen Exp $
+$NetBSD: CHANGES-2007,v 1.1884 2007/08/27 15:30:33 abs Exp $
 
 Changes to the packages collection and infrastructure in 2007:
 
@@ -3441,3 +3441,4 @@
        Updated emulators/dosbox to 0.72 [xtraeme 2007-08-27]
        Updated mail/dovecot to 1.0.3nb1 [ghen 2007-08-27]
        Added mail/dovecot-sieve version 1.0.2 [ghen 2007-08-27]
+       Updated pkgtools/pkg_chk to 1.86 [abs 2007-08-27]
diff -r fa89220ee2d0 -r 7fd5d9b0989c pkgtools/pkg_chk/Makefile
--- a/pkgtools/pkg_chk/Makefile Mon Aug 27 10:42:46 2007 +0000
+++ b/pkgtools/pkg_chk/Makefile Mon Aug 27 15:28:54 2007 +0000
@@ -1,7 +1,6 @@
-# $NetBSD: Makefile,v 1.54 2007/06/19 16:08:47 abs Exp $
+# $NetBSD: Makefile,v 1.55 2007/08/27 15:28:54 abs Exp $
 
-DISTNAME=      pkg_chk-1.85
-PKGREVISION=   6
+DISTNAME=      pkg_chk-1.86
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
 DISTFILES=     # empty
@@ -36,6 +35,7 @@
          -e 's#@MAKE@#${MAKE}#g' \
          -e 's#@MAKECONF@#${TMP_MAKECONF}#g' \
          -e 's#@PKG_ADD@#${PKG_ADD}#g' \
+         -e 's#@PKG_ADMIN@#${PKG_ADMIN}#g' \
          -e 's#@PKG_DELETE@#${PKG_DELETE}#g' \
          -e 's#@PKG_INFO@#${PKG_INFO}#g' \
          -e 's#@SED@#${SED}#g' \
diff -r fa89220ee2d0 -r 7fd5d9b0989c pkgtools/pkg_chk/files/pkg_chk.8
--- a/pkgtools/pkg_chk/files/pkg_chk.8  Mon Aug 27 10:42:46 2007 +0000
+++ b/pkgtools/pkg_chk/files/pkg_chk.8  Mon Aug 27 15:28:54 2007 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkg_chk.8,v 1.24 2006/10/02 07:33:38 abs Exp $
+.\"    $NetBSD: pkg_chk.8,v 1.25 2007/08/27 15:28:54 abs Exp $
 .\"
 .\" Copyright (c) 2001 by David Brownlee (abs%NetBSD.org@localhost)
 .\" Absolutely no warranty.
@@ -57,7 +57,6 @@
 .Pa pkgchk.conf
 file
 .Sq Ar conf .
-
 .It Fl D Ar tags
 Add the comma separated list of tags to those checked when parsing
 .Pa pkgchk.conf .
@@ -84,8 +83,8 @@
 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
+List the filename for all binary packages (including best dependencies) based
+on
 .Pa pkgchk.conf .
 Will abort if a binary package is missing.
 This can be used (in conjunction with
diff -r fa89220ee2d0 -r 7fd5d9b0989c pkgtools/pkg_chk/files/pkg_chk.sh
--- a/pkgtools/pkg_chk/files/pkg_chk.sh Mon Aug 27 10:42:46 2007 +0000
+++ b/pkgtools/pkg_chk/files/pkg_chk.sh Mon Aug 27 15:28:54 2007 +0000
@@ -1,6 +1,6 @@
 #!@SH@ -e
 #
-# $Id: pkg_chk.sh,v 1.49 2007/06/19 13:45:50 joerg Exp $
+# $Id: pkg_chk.sh,v 1.50 2007/08/27 15:28:54 abs Exp $
 #
 # TODO: Make -g check dependencies and tsort
 # TODO: Variation of -g which only lists top level packages
@@ -40,8 +40,10 @@
 
        if [ -n "$opt_B" ];then
            extract_pkg_vars $pkgdir PKGNAME FILESDIR PKGDIR DISTINFO_FILE PATCHDIR
+       elif [ -n "$opt_s" ] ; then
+           extract_pkg_vars $pkgdir PKGNAME
        else
-           extract_pkg_vars $pkgdir PKGNAME
+           PKGNAME=`pkgdir2pkgname $pkgdir`
        fi
        if [ -z "$PKGNAME" ]; then
            MISS_DONE=$MISS_DONE" "$pkgdir
@@ -137,26 +139,14 @@
     PKGDIR=$1
     PKGNAME=
     shift;
-    if [ -n "$opt_b" -a -z "$opt_s" ] ; then
-       for pkg in $PKGDB ; do
-           case $pkg in
-               "$PKGDIR:"*)
-                   PKGNAME=`echo $pkg| ${SED} 's/[^:]*://'`
-                   return;
-               ;;
-           esac
-       done
-       msg "WARNING: No binary package for $PKGDIR"
-    else
-       if [ ! -f $PKGSRCDIR/$pkgdir/Makefile ];then
-           msg "WARNING: No $pkgdir/Makefile - package moved or obsolete?"
-           return
-       fi
-       cd $PKGSRCDIR/$PKGDIR
-       extract_make_vars Makefile "$@"
-       if [ -z "$PKGNAME" ]; then
-           fatal "Unable to extract PKGNAME for $pkgdir"
-       fi
+    if [ ! -f $PKGSRCDIR/$pkgdir/Makefile ];then
+       msg "WARNING: No $pkgdir/Makefile - package moved or obsolete?"
+       return
+    fi
+    cd $PKGSRCDIR/$PKGDIR
+    extract_make_vars Makefile "$@"
+    if [ -z "$PKGNAME" ]; then
+       fatal "Unable to extract PKGNAME for $pkgdir"
     fi
     }
 
@@ -176,7 +166,7 @@
        extract_make_vars Makefile \
                AWK GREP GZIP_CMD ID PACKAGES PKGCHK_CONF PKGCHK_NOTAGS \
                PKGCHK_TAGS PKGCHK_UPDATE_CONF PKG_ADD PKG_DBDIR PKG_DELETE \
-               PKG_INFO PKG_SUFX SED SORT SU_CMD TSORT
+               PKG_ADMIN PKG_INFO PKG_SUFX SED SORT SU_CMD TSORT
        if [ -z "$PACKAGES" ];then
            PACKAGES=$PKGSRCDIR/packages
        fi
@@ -254,59 +244,87 @@
     cat $MY_TMPFILE
     }
 
+# Given a binary package filename as the first argumennt, return a list
+# of exact package versions against which it was built and on which it
+# depends
+#
+list_dependencies()
+    {
+    ${PKG_INFO} -. -q -n $1 | ${GREP} .. || true
+    }
+
+# Pass a list of pkgdirs, outputs a tsorted list including any dependencies
+#
 list_packages()
     {
-    # DEPCHECKLIST contains packages for which binary packages are known to
-    # exist, but now need to be checked for packages on which they depend
-    DEPCHECKLIST=' '
+    # Convert passed in list of pkgdirs to a list of binary package files
+    pkglist=''
     for pkgdir in $* ; do
-       extract_pkg_vars $pkgdir PKGNAME
-       if [ -z "$PKGNAME" ]; then
+       pkgname=`pkgdir2pkgname $pkgdir`
+       if [ -z "$pkgname" ]; then
+           fatal_later "$pkgdir - Unable to extract pkgname"
            continue
        fi
-       if is_binary_available $PKGNAME; then
-           :
+       if is_binary_available $pkgname ; then
+           pkglist="$pkglist $pkgname$PKG_SUFX"
        else
-           fatal_later "$PKGNAME - binary package missing"
-           continue
+           fatal_later "$pkgname - no binary package found"
        fi
-       verbose "$PKGNAME$PKG_SUFX: found"
-       DEPCHECKLIST="$DEPCHECKLIST$PKGNAME ";
     done
 
-    PAIRLIST=
-    PKGLIST=' '
-    while [ "$DEPCHECKLIST" != ' ' ]; do
-       NEXTCHECK=' '
-       for pkg in $DEPCHECKLIST ; do
-           DEPLIST="$(${PKG_INFO} -. -q -N $PACKAGES/$pkg$PKG_SUFX | ${GREP} .. || true)"
-           if [ -z "$DEPLIST" ] ; then
-               PAIRLIST="${PAIRLIST}$pkg$PKG_SUFX $pkg$PKG_SUFX\n"
+    # Variables used in this loop:
+    # pkglist: Current list of binary package files to check for dependencies
+    # next_pkglist: List of binary package files to check after pkglist
+    # pairlist: completed list of package + dependency for use in tsort
+    while [ -n "$pkglist" ] ; do
+       verbose "pkglist: $pkglist"
+       for pkg in $pkglist ; do
+           set -o noglob
+           deplist="$(list_dependencies $PACKAGES/$pkg)"
+           verbose "$pkg: dependencies - `echo $deplist`" 
+           if [ -n "$deplist" ] ; then
+               for depmatch in $deplist ; do
+                   dep=`${PKG_ADMIN} -b -d $PACKAGES lsbest "$depmatch"`
+                   if [ -z "$dep" ] ; then
+                       fatal_later "$depmatch: dependency missing for $pkg"
+                   else
+                       pairlist="$pairlist$dep $pkg\n"
+                       case $dep_cache in 
+                           *" $dep "*)
+                               # depmatch_cache is a quick cache of already
+                               verbose "$pkg: $deplist - cached"
+                               ;;
+                           *)
+                               next_pkglist="$next_pkglist $dep"
+                               dep_cache="$dep_cache $dep "
+                               ;;
+                       esac
+                   fi
+               done
+           else
+               pairlist="$pairlist$pkg $pkg\n"
            fi
-           for dep in $DEPLIST ; do
-               if is_binary_available $dep; then
-                   :
-               else
-                   fatal_later "$dep$PKG_SUFX - dependency missing for $pkg"
-                   break
-               fi
-               PAIRLIST="${PAIRLIST}$dep$PKG_SUFX $pkg$PKG_SUFX\n"
-               case "$PKGLIST$DEPCHECKLIST$NEXTCHECK" in
-                   *" $dep "*)
-                       verbose "$pkg: Duplicate depend $dep"
-                       ;;
-                   *)
-                       NEXTCHECK=" $dep$NEXTCHECK"
-                       verbose "$pkg: Add depend $dep"
-                       ;;
-               esac
-           done
-           PKGLIST="$pkg $PKGLIST"
+           set +o noglob
        done
-       DEPCHECKLIST="$NEXTCHECK"
+       pkglist="$next_pkglist"
+       next_pkglist=
     done
     fatal_later_check
-    printf "$PAIRLIST" | ${TSORT}
+    printf "$pairlist" | ${TSORT}
+    }
+
+pkgdir2pkgname()
+    {
+    pkgdir=$1
+    for pkgline in $PKGDB ; do
+       case $pkgline in
+           "$pkgdir:"*)
+               echo $pkgline | ${SED} 's/[^:]*://'
+               return;
+           ;;
+       esac
+    done
+    msg "WARNING: No binary package for $pkgdir"
     }
 
 pkgdirs_from_conf()
@@ -694,6 +712,7 @@
 test -n "$MAKE"       || MAKE="@MAKE@"
 test -n "$MAKECONF"   || MAKECONF="@MAKECONF@"
 test -n "$PKG_ADD"    || PKG_ADD="@PKG_ADD@"
+test -n "$PKG_ADMIN"  || PKG_ADMIN="@PKG_ADMIN@"
 test -n "$PKG_DBDIR"  || PKG_DBDIR="@PKG_DBDIR@"
 test -n "$PKG_DELETE" || PKG_DELETE="@PKG_DELETE@"
 test -n "$PKG_INFO"   || PKG_INFO="@PKG_INFO@"



Home | Main Index | Thread Index | Old Index