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.53.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5107dd4a78f4
branches:  trunk
changeset: 488385:5107dd4a78f4
user:      abs <abs%pkgsrc.org@localhost>
date:      Sat Jan 29 15:36:30 2005 +0000

description:
Update pkg_chk to 1.53.
    - Substitute default values for GREP, PKG_INFO, and SED at buildtime
    - Add -P dir, to set binary package dir
    - Remove the need for a copy of pkgsrc when using -b
    - List 'missing' packages at the end alog wwith Installed and Failed
    - Output various messages to stdout and to logfile (if active)
    - As ever, there are few problems that cannot be helped by
      adding another layer of abstraction

diffstat:

 doc/CHANGES                       |    3 +-
 pkgtools/pkg_chk/Makefile         |   10 +-
 pkgtools/pkg_chk/files/pkg_chk.8  |   27 +-
 pkgtools/pkg_chk/files/pkg_chk.sh |  382 +++++++++++++++++++++++--------------
 4 files changed, 262 insertions(+), 160 deletions(-)

diffs (truncated from 696 to 300 lines):

diff -r c0e37c163411 -r 5107dd4a78f4 doc/CHANGES
--- a/doc/CHANGES       Sat Jan 29 14:58:39 2005 +0000
+++ b/doc/CHANGES       Sat Jan 29 15:36:30 2005 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.8972 2005/01/29 14:59:27 abs Exp $
+$NetBSD: CHANGES,v 1.8973 2005/01/29 15:37:11 abs Exp $
 
 Changes to the packages collection and infrastructure in 2005:
 
@@ -654,4 +654,5 @@
        Updated mathomatic to 11.7 [minskim 2005-01-29]
        Updated mad123 to 0.8.5 [scw 2005-01-29]
        Updated cpuflags to 0.81 [abs 2005-01-29]
+       Updated pkg_chk to 1.53 [abs 2005-01-29]
 
diff -r c0e37c163411 -r 5107dd4a78f4 pkgtools/pkg_chk/Makefile
--- a/pkgtools/pkg_chk/Makefile Sat Jan 29 14:58:39 2005 +0000
+++ b/pkgtools/pkg_chk/Makefile Sat Jan 29 15:36:30 2005 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.9 2004/11/30 19:32:10 abs Exp $
+# $NetBSD: Makefile,v 1.10 2005/01/29 15:36:30 abs Exp $
 
-DISTNAME=      pkg_chk-1.52
+DISTNAME=      pkg_chk-1.53
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
 DISTFILES=     # empty
@@ -25,8 +25,12 @@
 MAKECONF?=     /etc/mk.conf
 
 do-build:
-       ${SED} -e 's#@MAKE@#${MAKE}#g' \
+       ${SED} -e 's#@AWK@#${AWK}#g' \
+         -e 's#@GREP@#${GREP}#g' \
+         -e 's#@MAKE@#${MAKE}#g' \
          -e 's#@MAKECONF@#${MAKECONF}#g' \
+         -e 's#@PKG_INFO@#${PKG_INFO}#g' \
+         -e 's#@SED@#${SED}#g' \
          -e 's#@SH@#${SH}#g' \
          ${FILESDIR}/pkg_chk.sh >${WRKSRC}/pkg_chk.sh
 
diff -r c0e37c163411 -r 5107dd4a78f4 pkgtools/pkg_chk/files/pkg_chk.8
--- a/pkgtools/pkg_chk/files/pkg_chk.8  Sat Jan 29 14:58:39 2005 +0000
+++ b/pkgtools/pkg_chk/files/pkg_chk.8  Sat Jan 29 15:36:30 2005 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkg_chk.8,v 1.5 2004/11/30 23:37:11 wiz Exp $
+.\"    $NetBSD: pkg_chk.8,v 1.6 2005/01/29 15:36:30 abs Exp $
 .\"
 .\" Copyright (c) 2001 by David Brownlee (abs%NetBSD.org@localhost)
 .\" Absolutely no warranty.
@@ -14,6 +14,7 @@
 .Op Fl C Ar conf
 .Op Fl D Ar tags
 .Op Fl L Ar file
+.Op Fl P Ar file
 .Op Fl U Ar tags
 .Sh DESCRIPTION
 .Nm
@@ -41,12 +42,11 @@
 .It Fl B
 Check the "Build version" (see option -b of pkg_info(1)) of packages.
 .It Fl b
-Limit additions or updates to using binary packages.
-If DEPENDS_TARGET=package is set in
-.Pa /etc/mk.conf ,
-then
+Use binary packages. If
+.Fl s
+is not set this allows
 .Nm
-will automatically generate binary packages for later reuse.
+to run without PKGSRCDIR.
 .It Fl C Ar conf
 Use the
 .Pa pkgchk.conf
@@ -102,7 +102,15 @@
 Use with care, this does not record which packages were installed
 for later update.
 .It Fl s
-Limit additions or updates to building from source.
+Building missing packages from source.
+If DEPENDS_TARGET=package is set in
+.Pa /etc/mk.conf ,
+then
+.Nm
+will automatically generate binary packages for later reuse.
+.It Fl P Ar path
+Set the path to the binary packages. Defaults to PACKAGES if PKGSRCDIR
+is available, or '.' otherwise.
 .It Fl U Ar tags
 Remove the comma separated list of tags from those checked when
 parsing
@@ -269,6 +277,7 @@
 www/communicator                x11+sparc x11+sparc64
 www/navigator                  x11+i386
 x11/xlockmore                   x11 -wopr
+
 .Ed
 .Sh AUTHORS
 .An David Brownlee
@@ -308,8 +317,8 @@
 There exists a workaround, if you have a complete
 .Pa pkgchk.conf :
 .Bd -literal
-# pkg_chk -r
-# pkg_chk -a
+# pkg_chk -ra
+
 .Ed
 will remove all outdated packages and then install all
 files that are in your
diff -r c0e37c163411 -r 5107dd4a78f4 pkgtools/pkg_chk/files/pkg_chk.sh
--- a/pkgtools/pkg_chk/files/pkg_chk.sh Sat Jan 29 14:58:39 2005 +0000
+++ b/pkgtools/pkg_chk/files/pkg_chk.sh Sat Jan 29 15:36:30 2005 +0000
@@ -1,6 +1,6 @@
 #!@SH@ -e
 #
-# $Id: pkg_chk.sh,v 1.9 2004/11/30 19:32:10 abs Exp $
+# $Id: pkg_chk.sh,v 1.10 2005/01/29 15:36:30 abs Exp $
 #
 # TODO: Handle updates with dependencies via binary packages
 
@@ -14,43 +14,43 @@
 
     for pkgdir in $* ; do
 
-       if [ ! -f $PKGSRCDIR/$pkgdir/Makefile ];then
-           echo "WARNING: No $pkgdir/Makefile - package moved or obsolete?"
+       if [ -n "$opt_B" ];then
+           extract_pkg_vars $pkgdir PKGNAME FILESDIR PKGDIR DISTINFO_FILE PATCHDIR
+       else
+           extract_pkg_vars $pkgdir PKGNAME
+       fi
+       if [ -z "$PKGNAME" ]; then
+           MISS_DONE=$MISS_DONE" "$pkgdir
            continue
        fi
-       cd $PKGSRCDIR/$pkgdir
-       if [ -n "$opt_B" ];then
-           extract_make_vars PKGNAME FILESDIR PKGDIR DISTINFO_FILE PATCHDIR
-       else
-           extract_make_vars PKGNAME
-       fi
-       if [ -z "$PKGNAME" ]; then
-           echo "Unable to extract PKGNAME for $pkgdir"
-           exit 1
-       fi
        if [ ! -d $PKG_DBDIR/$PKGNAME ];then
-           echo_n "$PKGNAME: "
-           pkg=$(echo $PKGNAME | sed 's/-[0-9].*//')
+           msg_n "$PKGNAME: "
+           pkg=$(echo $PKGNAME | ${SED} 's/-[0-9].*//')
            pkginstalled=$(sh -c "${PKG_INFO} -e $pkg" || true)
            INSTALL=
            if [ -n "$pkginstalled" ];then
-               echo_n "version mismatch - $pkginstalled"
+               msg_n "version mismatch - $pkginstalled"
                MISMATCH_TODO="$MISMATCH_TODO $pkginstalled"
                UPDATE_TODO="$UPDATE_TODO $PKGNAME $pkgdir"
            else
-               echo_n "missing"
+               msg_n "missing"
                MISSING_TODO="$MISSING_TODO $PKGNAME $pkgdir"
            fi
-           if [ -f $PACKAGES/All/$PKGNAME.tgz ] ;then
-               echo_n " (binary package available)"
+           if [ -f $PACKAGES/$PKGNAME.tgz ] ;then
+               msg_n " (binary package available)"
            fi
-           echo
+           msg
        else
            if [ -n "$opt_B" ];then
                current_build_ver=$(get_build_ver)
-               installed_build_ver=$(sed "s|^[^:]*/[^:]*:||" $PKG_DBDIR/$PKGNAME/+BUILD_VERSION)
+               installed_build_ver=$(${SED} "s|^[^:]*/[^:]*:||" $PKG_DBDIR/$PKGNAME/+BUILD_VERSION)
                if [ x"$current_build_ver" != x"$installed_build_ver" ];then
-                   echo "$PKGNAME: build version information mismatch"
+                   msg "$PKGNAME: build-version mismatch"
+                   verbose "--current--"
+                   verbose "$current_build_ver"
+                   verbose "--installed--"
+                   verbose "$installed_build_ver"
+                   verbose "----"
                    MISMATCH_TODO="$MISMATCH_TODO $PKGNAME"
                    # should we mark this pkg to be updated if -u is given ??
                else
@@ -63,74 +63,17 @@
     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 [ -z "$opt_k" ];then
-               exit 1
-           fi
-           continue
-       fi
-       verbose "$PKGNAME.tgz: found"
-       CHECKLIST="$CHECKLIST$PKGNAME ";
-    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 [ -z "$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$NEXTCHECK" in
-                   *\ $dep\ *)
-                       verbose "$pkg: Duplicate depend $dep"
-                       ;;
-                   *)
-                       NEXTCHECK="$NEXTCHECK$dep "
-                       verbose "$pkg: Add depend $dep"
-                       ;;
-               esac
-           done
-       done
-       CHECKLIST="$NEXTCHECK"
-    done
-    for pkg in $PKGLIST ; do
-       echo $pkg.tgz
-    done
-    }
-
-echo_n()
-    {
-    echo $ac_n "$*"$ac_c
-    }
-
 extract_make_vars()
     {
+    MAKEFILE=$1
+    shift
+    verbose "Extract $@ from $MAKEFILE"
     MAKEDATA=".PHONY: x\nx:\n";
     for var in $* ; do
        MAKEDATA=$MAKEDATA"\t@echo $var=\${$var}\n"
     done
-    eval $(printf "$MAKEDATA" | ${MAKE} -f - -f Makefile x | \
-                                       sed -e 's/[^=]*=/&"/' -e 's/$/"/')
+    eval $(printf "$MAKEDATA" | ${MAKE} -f - -f $MAKEFILE x | \
+                                       ${SED} -e 's/[^=]*=/&"/' -e 's/$/"/')
     }
 
 # $1 = name of variable
@@ -143,8 +86,35 @@
            eval "$1=$2"
        fi
        if [ ! -d `eval echo \\$$1` ];then
-           echo "Unable to locate $1 `eval echo \\$$1`"
-           exit 1;
+           fatal "Unable to locate $1 `eval echo \\$$1`"
+       fi
+    fi
+    }
+
+extract_pkg_vars()
+    {
+    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 "$@"



Home | Main Index | Thread Index | Old Index