Subject: pkg_chk changes to show pkgsrc directory
To: None <abs@netbsd.org>
From: Greg Troxel <gdt@ir.bbn.com>
List: tech-pkg
Date: 06/14/2006 11:03:25
--=-=-=
Content-Transfer-Encoding: quoted-printable


I have a local patch to pkgsrc which adds a -d option.  When enabled,
mismatched packages are preceded by the pkgsrc directory:

devel/readline readline-5.1pl1nb1: version mismatch - readline-5.0

I find this useful because doing 'make update' is too scary, and I
prefer make replace.  I scan the list for what I want to update and
use the following shell functions, one of which depends on having the
directory:

# do a full make replace cycle on a number of packages
function pkgreplace () { (if [ "$1" =3D "" ]; then echo "usage eg pkgreplac=
e editors/emacs"; \
else cd /usr/pkgsrc && \
(for i in $*; do (cd $i && make replace package clean); done); fi); }
function pkgreplacecat () { pkgreplace `egrep $1 PKG | awk '{print $1}'`; }

Is it ok to commit this (after addding a trailing period in the man page)?

Index: files/pkg_chk.8
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_chk/files/pkg_chk.8,v
retrieving revision 1.19
diff -u -r1.19 pkg_chk.8
=2D-- files/pkg_chk.8	4 May 2006 22:08:05 -0000	1.19
+++ files/pkg_chk.8	8 Jun 2006 14:09:05 -0000
@@ -10,7 +10,7 @@
 .Nd check, and optionally update, installed packages
 .Sh SYNOPSIS
 .Nm
=2D.Op Fl aBbcfhiklNnqrsuv
+.Op Fl aBbcdfhiklNnqrsuv
 .Op Fl C Ar conf
 .Op Fl D Ar tags
 .Op Fl L Ar file
@@ -63,6 +63,8 @@
 .Pa pkgchk.conf .
 Also includes
 .Ev PKGCHK_TAGS .
+.It Fl d
+Print the pgksrc directory before package names
 .It Fl f
 Fetch all missing/mismatched packages found.
 Can be used with
Index: files/pkg_chk.sh
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_chk/files/pkg_chk.sh,v
retrieving revision 1.35
diff -u -r1.35 pkg_chk.sh
=2D-- files/pkg_chk.sh	7 Jun 2006 16:27:14 -0000	1.35
+++ files/pkg_chk.sh	8 Jun 2006 14:09:05 -0000
@@ -48,6 +48,9 @@
 	    continue
 	fi
 	if [ ! -d $PKG_DBDIR/$PKGNAME ];then
+	    if [ -n "$opt_d" ]; then
+		msg_n "$pkgdir "
+	    fi
 	    msg_n "$PKGNAME: "
 	    pkg=3D$(echo $PKGNAME | ${SED} 's/-[0-9].*//')
 	    pkginstalled=3D$(sh -c "${PKG_INFO} -e $pkg" || true)
@@ -542,6 +545,7 @@
 	-b      Install binary packages
 	-C conf Use pkgchk.conf file 'conf'
 	-c      Check installed packages against pkgchk.conf
+	-d	Print pkgsrc directory before package name
 	-D tags Comma separated list of additional pkgchk.conf tags to set
 	-f      Perform a 'make fetch' for all required packages
 	-g      Generate an initial pkgchk.conf file
@@ -578,7 +582,7 @@
     fi
     }
=20
=2Dargs=3D$(getopt BC:D:L:P:U:abcfghiklNnqrsSuv $*)
+args=3D$(getopt BC:D:L:P:U:abcdfghiklNnqrsSuv $*)
 if [ $? !=3D 0 ]; then
     opt_h=3D1
 fi
@@ -591,6 +595,7 @@
 	-C )	opt_C=3D"$2" ; shift ;;
 	-c )	opt_a=3D1 ; opt_q=3D1 ; echo "-c is deprecated - use -a -q" ;;
 	-D )	opt_D=3D"$2" ; shift ;;
+	-d )	opt_d=3D1 ;;
 	-f )	opt_f=3D1 ;;
 	-g )	opt_g=3D1 ;;
 	-h )	opt_h=3D1 ;;
=20


=2D-=20
        Greg Troxel <gdt@ir.bbn.com>

--=-=-=
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (NetBSD)

iD8DBQFEkCU9+vesoDJhHiURAhrRAKC1/YsmkgfCgllVnJdxcNe7r7qqDwCfdCXI
HbUc5VhskXoETS6fsYnQYNk=
=cMlR
-----END PGP SIGNATURE-----
--=-=-=--