pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_chk Bump to pkg_chk-1.89:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/42bb1f405042
branches:  trunk
changeset: 538701:42bb1f405042
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Sun Feb 17 00:55:20 2008 +0000

description:
Bump to pkg_chk-1.89:

Some changes from Aleksey Cheusov in pkg/36298 and pkg/36641 with
additional cleanup by me.

- option -g doesn't need PKGSRCDIR populated
- fatal if mktemp fails
- truncate logfile instead of removing it
- performance improvement for binary package scan

diffstat:

 pkgtools/pkg_chk/Makefile         |   5 +++--
 pkgtools/pkg_chk/files/pkg_chk.sh |  33 ++++++++++++++++++++++++---------
 2 files changed, 27 insertions(+), 11 deletions(-)

diffs (113 lines):

diff -r f23ad83e3633 -r 42bb1f405042 pkgtools/pkg_chk/Makefile
--- a/pkgtools/pkg_chk/Makefile Sat Feb 16 23:38:42 2008 +0000
+++ b/pkgtools/pkg_chk/Makefile Sun Feb 17 00:55:20 2008 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.57 2008/01/18 07:50:03 tnn Exp $
+# $NetBSD: Makefile,v 1.58 2008/02/17 00:55:20 tnn Exp $
 
-DISTNAME=      pkg_chk-1.88
+DISTNAME=      pkg_chk-1.89
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
 DISTFILES=     # empty
@@ -45,6 +45,7 @@
          -e 's#@TSORT@#${TSORT}#g' \
          -e 's#@PREFIX@#${PREFIX}#g' \
          -e 's#@PKG_DBDIR@#${PKG_DBDIR}#g' \
+         -e 's#@XARGS@#${XARGS}#g' \
          ${FILESDIR}/pkg_chk.sh >${WRKSRC}/pkg_chk.sh
 
 do-install:
diff -r f23ad83e3633 -r 42bb1f405042 pkgtools/pkg_chk/files/pkg_chk.sh
--- a/pkgtools/pkg_chk/files/pkg_chk.sh Sat Feb 16 23:38:42 2008 +0000
+++ b/pkgtools/pkg_chk/files/pkg_chk.sh Sun Feb 17 00:55:20 2008 +0000
@@ -1,6 +1,6 @@
 #!@SH@ -e
 #
-# $Id: pkg_chk.sh,v 1.52 2008/01/18 07:50:03 tnn Exp $
+# $Id: pkg_chk.sh,v 1.53 2008/02/17 00:55:21 tnn Exp $
 #
 # TODO: Make -g check dependencies and tsort
 # TODO: Variation of -g which only lists top level packages
@@ -31,6 +31,12 @@
     fi
     }
 
+bin_pkg_info2pkgdb()
+    {
+    ${AWK} '/^PKGNAME=/ {sub("^PKGNAME=", ""); PKGNAME=$0} \
+            /^PKGPATH=/ {sub("^PKGPATH=", ""); printf("%s:%s ", $0, PKGNAME)}'
+    }
+
 check_packages_installed()
     {
     MISSING_TODO=
@@ -161,7 +167,9 @@
     # as well as AWK, GREP, SED, PKGCHK_TAGS and PKGCHK_NOTAGS
     #
 
-    if [ -z "$opt_b" -o -n "$opt_s" -o -d $PKGSRCDIR/pkgtools/pkg_chk ] ; then
+    if [ -n "$opt_g" ]; then
+        :
+    elif [ -z "$opt_b" -o -n "$opt_s" -o -d $PKGSRCDIR/pkgtools/pkg_chk ] ; then
        cd $PKGSRCDIR/pkgtools/pkg_chk
        extract_make_vars Makefile \
                AWK GREP GZIP_CMD ID PACKAGES PKGCHK_CONF PKGCHK_NOTAGS \
@@ -231,6 +239,11 @@
     echo $(pkgdirs_from_installed) | tr ' ' '\n' >> $FILE
     }
 
+get_bin_pkg_info()
+    {
+    list_bin_pkgs | ${XARGS} ${PKG_INFO} -X
+    }
+
 get_build_ver()
     {
     if [ -n "$opt_b" -a -z "$opt_s" ] ; then
@@ -244,6 +257,11 @@
     cat $MY_TMPFILE
     }
 
+list_bin_pkgs ()
+    {
+    ls -t $PACKAGES | grep "$PKG_SUFX_RE"'$' | sed "s|^|$PACKAGES/|"
+    }
+
 # 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
@@ -718,8 +736,10 @@
 test -n "$SED"        || SED="@SED@"
 test -n "$SORT"              || SORT="@SORT@"
 test -n "$TSORT"      || TSORT="@TSORT@"
+test -n "$XARGS"      || XARGS="@XARGS@"
 
 MY_TMPDIR=`${MKTEMP} -d ${TMPDIR-/tmp}/${0##*/}.XXXXXX`
+test -n "$MY_TMPDIR" || fatal "Couldn't create temporary directory."
 MY_TMPFILE=$MY_TMPDIR/tmp
 
 if [ -z "$MAKECONF" -o ! -f "$MAKECONF" ] ; then
@@ -747,7 +767,7 @@
 fi
 
 if [ -n "$opt_L" ] ; then
-    rm -f $opt_L
+    printf '' > $opt_L
 fi
 
 basedir=$(pwd)
@@ -796,12 +816,7 @@
        *)
            if [ -d "$PACKAGES" ] ; then
                msg_progress Scan $PACKAGES
-               cd $PACKAGES
-               for f in `ls -t | grep "$PKG_SUFX_RE"'$'` ; do # Sort by time to pick up newest first
-                   PKGDIR=`${PKG_INFO} -. -B $PACKAGES/$f|${AWK} -F= '$1=="PKGPATH"{print $2}'`
-                   PKGNAME=`echo $f | ${SED} "s/$PKG_SUFX"'$//'`
-                   PKGDB="${PKGDB} $PKGDIR:$PKGNAME"
-               done
+               PKGDB=$(get_bin_pkg_info | bin_pkg_info2pkgdb)
                PKGSRCDIR=NONE
            fi;;
     esac



Home | Main Index | Thread Index | Old Index