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



details:   https://anonhg.NetBSD.org/pkgsrc/rev/bbb889a12f5c
branches:  trunk
changeset: 494971:bbb889a12f5c
user:      abs <abs%pkgsrc.org@localhost>
date:      Wed Jun 01 11:29:45 2005 +0000

description:
update pkg_chk to 1.58
- sort -l output so that dependencies always come before packages
  which depend upon them
- completely rework -u so that a list of packages to be update is generated,
  then all mismatched packages are removed, then the list is processed to
  add in packages. If -u is interrupted, a second run will resume the update
- update (-u) works with binary packages

diffstat:

 doc/CHANGES                       |    3 +-
 pkgtools/pkg_chk/Makefile         |    4 +-
 pkgtools/pkg_chk/files/pkg_chk.8  |   64 +----
 pkgtools/pkg_chk/files/pkg_chk.sh |  396 +++++++++++++++++++------------------
 4 files changed, 229 insertions(+), 238 deletions(-)

diffs (truncated from 693 to 300 lines):

diff -r 93a148efb86e -r bbb889a12f5c doc/CHANGES
--- a/doc/CHANGES       Wed Jun 01 09:27:44 2005 +0000
+++ b/doc/CHANGES       Wed Jun 01 11:29:45 2005 +0000
@@ -1,4 +1,4 @@
-$NetBSD: CHANGES,v 1.10268 2005/06/01 03:38:04 taca Exp $
+$NetBSD: CHANGES,v 1.10269 2005/06/01 11:30:28 abs Exp $
 
 Changes to the packages collection and infrastructure in 2005:
        
@@ -2750,3 +2750,4 @@
        Updated textproc/diction to 1.08 [snj 2005-06-01]
        Updated audio/mpc to 0.11.2 [simonb 2005-06-01]
        Updated graphics/ruby-imlib2 to 0.5.1 [taca 2005-06-01]
+       Updated pkgtools/pkg_chk to 1.58 [abs 2005-06-01]
diff -r 93a148efb86e -r bbb889a12f5c pkgtools/pkg_chk/Makefile
--- a/pkgtools/pkg_chk/Makefile Wed Jun 01 09:27:44 2005 +0000
+++ b/pkgtools/pkg_chk/Makefile Wed Jun 01 11:29:45 2005 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.15 2005/05/07 22:24:04 wiz Exp $
+# $NetBSD: Makefile,v 1.16 2005/06/01 11:29:45 abs Exp $
 
-DISTNAME=      pkg_chk-1.57
+DISTNAME=      pkg_chk-1.58
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r 93a148efb86e -r bbb889a12f5c pkgtools/pkg_chk/files/pkg_chk.8
--- a/pkgtools/pkg_chk/files/pkg_chk.8  Wed Jun 01 09:27:44 2005 +0000
+++ b/pkgtools/pkg_chk/files/pkg_chk.8  Wed Jun 01 11:29:45 2005 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pkg_chk.8,v 1.9 2005/03/26 00:46:40 hubertf Exp $
+.\"    $NetBSD: pkg_chk.8,v 1.10 2005/06/01 11:29:45 abs Exp $
 .\"
 .\" Copyright (c) 2001 by David Brownlee (abs%NetBSD.org@localhost)
 .\" Absolutely no warranty.
@@ -40,7 +40,8 @@
 .Fl s
 options are given.
 .It Fl B
-Check the "Build version" (see option -b of pkg_info(1)) of packages.
+Include the "Build version" (see option -b of pkg_info(1)) of packages when
+determining if a package is up to date.
 .It Fl b
 Use binary packages. If
 .Fl s
@@ -94,7 +95,8 @@
 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.
+was completely up to date. The list is sorted so that dependencies
+always come before packages which depend upon them.
 .It Fl N
 For each installed package, look if there is a newer version
 noted in PKGSRCDIR/doc/TODO.
@@ -133,7 +135,8 @@
 options are given.
 .Pp
 Note: If the update fails (particularly when building from source), the system
-will be left with missing packages.
+will be left with missing packages. Once the error has been fixed a second run
+will resume the update.
 .It Fl v
 Verbose - list the tags set when checking
 .Pa pkgchk.conf ,
@@ -258,6 +261,14 @@
 .Pa /etc/mk.conf .
 Defaults to
 .Pa ${PKGSRCDIR}/pkgchk.conf .
+.It Ev PKGCHK_UPDATE_CONF
+Pathname to temporary list of installed packages used when updating.
+If not set in environment then read from
+.Pa /etc/mk.conf .
+Defaults to
+.Pa ${PKGSRCDIR}/pkgchk_update-$(hostname).conf . Note, if pkgsrc is being
+shared across multiple machines which may be updating at the same time then
+it is important this file does not overlap between machines.
 .It Ev PKGCHK_TAGS
 Additional tags to add when parsing
 .Pa pkgchk.conf .
@@ -275,9 +286,9 @@
 pkgtools/xpkgwedge              x11
 
 shells/standalone-tcsh          *
-wm/pwm                          x11
+wm/pwm                          /etc/X11/XF86Config
 misc/setiathome                 i386
-print/acroread                  x11+i386
+print/acroread                  /etc/X11/XF86Config+i386
 www/communicator                x11+sparc x11+sparc64
 www/navigator                  x11+i386
 x11/xlockmore                   x11 -wopr
@@ -288,44 +299,7 @@
 .Aq abs%netbsd.org@localhost ,
 plus much from Stoned Elipot.
 .Sh BUGS
-Updating packages on which other packages depend can currently only be done
-via source (not binary packages).
 .Pp
-If both package
-.Em a
-and package
-.Em b
-are to be updated, and
-.Em a
-depends on
-.Em b ,
+When used against binary packages,
 .Nm
-will correctly skip the update of
-.Em a .
-However, if
-.Em a
-depends on
-.Em b
-and
-.Em c ,
-and all three are marked for update,
-.Nm
-will update
-.Em b
-and
-.Em c
-in two separate passes, resulting in unnecessary rebuilding of
-.Em a
-(and potentially other packages).
-.Pp
-There exists a workaround, if you have a complete
-.Pa pkgchk.conf :
-.Bd -literal
-# pkg_chk -ra
-
-.Ed
-will remove all outdated packages and then install all
-files that are in your
-.Pa pkgchk.conf
-file, but not currently installed, i.e. hopefully all
-that you just deleted, if the file was complete.
+does not handle the directory containing multiple versions of the same package.
diff -r 93a148efb86e -r bbb889a12f5c pkgtools/pkg_chk/files/pkg_chk.sh
--- a/pkgtools/pkg_chk/files/pkg_chk.sh Wed Jun 01 09:27:44 2005 +0000
+++ b/pkgtools/pkg_chk/files/pkg_chk.sh Wed Jun 01 11:29:45 2005 +0000
@@ -1,14 +1,16 @@
 #!@SH@ -e
 #
-# $Id: pkg_chk.sh,v 1.14 2005/04/20 15:32:25 abs Exp $
+# $Id: pkg_chk.sh,v 1.15 2005/06/01 11:29:45 abs Exp $
 #
-# TODO: Handle updates with dependencies via binary packages
+# TODO: Make -g check dependencies and tsort
+# TODO: Variation of -g which only lists top level packages
+# TODO: List top level packages installed but not in config
+# TODO: Generate list files so -u can work against a remote URL
 
 PATH=/usr/sbin:/usr/bin:${PATH}
 
 check_packages_installed()
     {
-    UPDATE_TODO=
     MISSING_TODO=
     MISMATCH_TODO=
 
@@ -31,7 +33,6 @@
            if [ -n "$pkginstalled" ];then
                msg_n "version mismatch - $pkginstalled"
                MISMATCH_TODO="$MISMATCH_TODO $pkginstalled"
-               UPDATE_TODO="$UPDATE_TODO $PKGNAME $pkgdir"
            else
                msg_n "missing"
                MISSING_TODO="$MISSING_TODO $PKGNAME $pkgdir"
@@ -52,7 +53,6 @@
                    verbose "$installed_build_ver"
                    verbose "----"
                    MISMATCH_TODO="$MISMATCH_TODO $PKGNAME"
-                   # should we mark this pkg to be updated if -u is given ??
                else
                    verbose "$PKGNAME: OK"
                fi
@@ -63,6 +63,15 @@
     done
     }
 
+delete_pkgs()
+    {
+    for pkg in $* ; do
+       if [ -d $PKG_DBDIR/$pkg ] ; then
+           run_cmd "${PKG_DELETE} -r $pkg" 1
+       fi
+    done
+    }
+
 extract_make_vars()
     {
     MAKEFILE=$1
@@ -130,13 +139,15 @@
 
     if [ -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 SED PACKAGES PKG_INFO PKG_ADD \
-                       PKG_DELETE PKGCHK_CONF PKGCHK_TAGS PKGCHK_NOTAGS
+       extract_make_vars Makefile AWK GREP SED TSORT SORT PACKAGES PKG_INFO \
+                       PKG_ADD PKG_DELETE PKGCHK_CONF PKGCHK_UPDATE_CONF \
+                       PKGCHK_TAGS PKGCHK_NOTAGS
        if [ -z "$PACKAGES" ];then
            PACKAGES=$PKGSRCDIR/packages
        fi
     elif [ $MAKECONF != /dev/null ] ; then
-       extract_make_vars $MAKECONF PACKAGES PKGCHK_CONF PKGCHK_TAGS PKGCHK_NOTAGS
+       extract_make_vars $MAKECONF PACKAGES PKGCHK_CONF PKGCHK_UPDATE_CONF \
+                       PKGCHK_TAGS PKGCHK_NOTAGS
        if [ -z "$PACKAGES" ] ; then
            PACKAGES=`pwd`
        fi
@@ -145,6 +156,9 @@
     if [ -z "$PKGCHK_CONF" ];then
        PKGCHK_CONF=$PKGSRCDIR/pkgchk.conf
     fi
+    if [ -z "$PKGCHK_UPDATE_CONF" ];then
+       PKGCHK_UPDATE_CONF=$PKGSRCDIR/pkgchk_update-$(hostname).conf
+    fi
     }
 
 fatal()
@@ -161,6 +175,16 @@
     fi
     }
 
+generate_conf_from_installed()
+    {
+    FILE=$1
+    if [ -r $FILE ]; then
+       mv $FILE ${FILE}.old
+    fi
+    echo "# Generated automatically at $(date)" > $FILE
+    echo $(pkgdirs_from_installed) | fmt -1    >> $FILE
+    }
+
 get_build_ver()
     {
     if [ -n "$opt_b" -a -z "$opt_s" ] ; then
@@ -207,31 +231,127 @@
        verbose "$PKGNAME.tgz: found"
        CHECKLIST="$CHECKLIST$PKGNAME ";
     done
+
+    PAIRLIST=
+    PKGLIST=' '
     while [ "$CHECKLIST" != ' ' ]; do
-       PKGLIST="$PKGLIST$CHECKLIST"
        NEXTCHECK=' '
        for pkg in $CHECKLIST ; do
            if [ ! -f $PACKAGES/$pkg.tgz ] ; then
                fatal_maybe " ** $pkg.tgz - binary package dependency missing"
                continue
            fi
-           for dep in $(${PKG_INFO} -. -N $PACKAGES/$pkg.tgz | ${SED} '1,/Built using:/d' | ${GREP} ..) ; do
-               case "$PKGLIST$NEXTCHECK" in
-                   *\ $dep\ *)
+           DEPLIST="$(${PKG_INFO} -. -N $PACKAGES/$pkg.tgz | ${SED} '1,/Built using:/d' | ${GREP} ..)"
+           if [ -z "$DEPLIST" ] ; then
+               PAIRLIST="${PAIRLIST}$pkg.tgz $pkg.tgz\n"
+           fi
+           for dep in $DEPLIST ; do
+               if [ ! -f $PACKAGES/$dep.tgz ] ; then
+                   fatal_maybe " ** $dep.tgz - binary package dependency missing"
+                   break 2
+               fi
+               PAIRLIST="${PAIRLIST}$dep.tgz $pkg.tgz\n"
+               case "$PKGLIST$CHECKLIST$NEXTCHECK" in
+                   *" $dep "*)
                        verbose "$pkg: Duplicate depend $dep"
                        ;;
                    *)
-                       NEXTCHECK="$NEXTCHECK$dep "
+                       NEXTCHECK=" $dep$NEXTCHECK"
                        verbose "$pkg: Add depend $dep"
                        ;;
                esac
            done
+           PKGLIST="$pkg $PKGLIST"
        done
        CHECKLIST="$NEXTCHECK"
     done
-    for pkg in $PKGLIST ; do
-       echo $pkg.tgz
-    done
+    printf "$PAIRLIST" | ${TSORT}
+    }
+
+pkgdirs_from_conf()
+    {
+    CONF=$1; shift
+    LIST="$*"
+    if [ ! -r $CONF ];then
+       fatal "Unable to read PKGCHK_CONF '$CONF'"
+    fi
+
+    # Determine list of tags
+    #
+    extract_make_vars Makefile OPSYS OS_VERSION MACHINE_ARCH



Home | Main Index | Thread Index | Old Index