Subject: Re: pkg/32952: pkg_chk now spewing pkg_delete commands with "-i"
To: None <abs@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org,>
From: Todd Vierling <tv@duh.org>
List: pkgsrc-bugs
Date: 03/12/2006 14:00:05
The following reply was made to PR pkg/32952; it has been noted by GNATS.

From: Todd Vierling <tv@duh.org>
To: abs@netbsd.org
Cc: gnats-bugs@netbsd.org
Subject: Re: pkg/32952: pkg_chk now spewing pkg_delete commands with "-i"
 emulation
Date: Sun, 12 Mar 2006 08:56:02 -0500 (Eastern Standard Time)

 Here's a diff implementing "-q" as a superset of "-n" -- it also suppresses
 all msg_progress messages and run_cmd messages.
 
 Index: Makefile
 ===================================================================
 RCS file: /cvsroot/pkgsrc/pkgtools/pkg_chk/Makefile,v
 retrieving revision 1.28
 diff -u -r1.28 Makefile
 --- Makefile	18 Feb 2006 21:34:03 -0000	1.28
 +++ Makefile	12 Mar 2006 13:54:34 -0000
 @@ -1,6 +1,6 @@
  # $NetBSD: Makefile,v 1.28 2006/02/18 21:34:03 abs Exp $
 
 -DISTNAME=	pkg_chk-1.69
 +DISTNAME=	pkg_chk-1.69.1
  CATEGORIES=	pkgtools
  MASTER_SITES=	# empty
  DISTFILES=	# empty
 Index: files/pkg_chk.8
 ===================================================================
 RCS file: /cvsroot/pkgsrc/pkgtools/pkg_chk/files/pkg_chk.8,v
 retrieving revision 1.16
 diff -u -r1.16 pkg_chk.8
 --- files/pkg_chk.8	18 Feb 2006 21:34:03 -0000	1.16
 +++ files/pkg_chk.8	12 Mar 2006 13:54:34 -0000
 @@ -10,7 +10,7 @@
  .Nd check, and optionally update, installed packages
  .Sh SYNOPSIS
  .Nm
 -.Op Fl aBbcfhiklNnrSsuv
 +.Op Fl aBbcfhiklNnqrSsuv
  .Op Fl C Ar conf
  .Op Fl D Ar tags
  .Op Fl L Ar file
 @@ -117,6 +117,13 @@
  is available, or
  .Dq Pa \&.
  otherwise.
 +.It Fl q
 +Do not display actions or take any action; only list information
 +about package version differences.
 +Useful for options that list information about package differences, such as
 +.Fl a
 +or
 +.Fl u .
  .It Fl r
  Recursively delete any mismatched packages found.
  Use with care, this does not record which packages were installed
 @@ -165,14 +172,14 @@
  .Pa pkgchk.conf .
  This is a synomyn for
  .Nm
 -.Fl a n ,
 +.Fl a q ,
  and will be removed in a future version.
  .It Fl i
  Check versions of installed packages, ignoring
  .Pa pkgchk.conf.
  .Nm
  This is a synomyn for
 -.Fl u n ,
 +.Fl u q ,
  and will be removed in a future version.
  .El
  .Sh FILE FORMAT
 Index: files/pkg_chk.sh
 ===================================================================
 RCS file: /cvsroot/pkgsrc/pkgtools/pkg_chk/files/pkg_chk.sh,v
 retrieving revision 1.29
 diff -u -r1.29 pkg_chk.sh
 --- files/pkg_chk.sh	18 Feb 2006 21:34:03 -0000	1.29
 +++ files/pkg_chk.sh	12 Mar 2006 13:54:34 -0000
 @@ -424,7 +424,9 @@
 
  msg_progress()
      {
 -    msg "[ $@ ]"
 +    if [ -z "$opt_q" ] ; then
 +	msg "[ $@ ]"
 +    fi
      }
 
  msg_n()
 @@ -475,7 +477,7 @@
  	run_cmd "cd $PKGSRCDIR/$PKGDIR && ${MAKE} update CLEANDEPENDS=yes"
      fi
 
 -    if [ -z "$opt_n" -a ! -d $PKG_DBDIR/$PKGNAME ];then
 +    if [ -z "$opt_n" -a -z "$opt_q" -a ! -d $PKG_DBDIR/$PKGNAME ];then
  	FAIL=1
      fi
 
 @@ -504,8 +506,10 @@
      else
  	FAILOK=$opt_k
      fi
 -    msg $(date +%R) $1
 -    if [ -z "$opt_n" ];then
 +    if [ -z "$opt_q" ];then
 +	msg $(date +%R) $1
 +    fi
 +    if [ -z "$opt_n" -a -z "$opt_q" ];then
  	if [ -n "$opt_L" ] ; then
  	    sh -c "$1" >> "$opt_L" 2>&1 || FAIL=1
  	else
 @@ -593,18 +597,19 @@
  	-B )    opt_B=1 ;;
  	-b )	opt_b=1 ;;
  	-C )	opt_C="$2" ; shift ;;
 -	-c )	opt_a=1 ; opt_n=1 ; echo "-c is deprecated - use -a -n" ;;
 +	-c )	opt_a=1 ; opt_q=1 ; echo "-c is deprecated - use -a -q" ;;
  	-D )	opt_D="$2" ; shift ;;
  	-f )	opt_f=1 ;;
  	-g )	opt_g=1 ;;
  	-h )	opt_h=1 ;;
 -	-i )	opt_u=1 ; opt_n=1 ; echo "-i is deprecated - use -u -n" ;;
 +	-i )	opt_u=1 ; opt_q=1 ; echo "-i is deprecated - use -u -q" ;;
  	-k )	opt_k=1 ;;
  	-L )	opt_L="$2" ; shift ;;
  	-l )	opt_l=1 ;;
  	-N )	opt_N=1 ;;
  	-n )	opt_n=1 ;;
  	-P )	opt_P="$2" ; shift ;;
 +	-q )	opt_q=1 ; shift ;;
  	-r )	opt_r=1 ;;
  	-S )	opt_S=1 ;;
  	-s )	opt_s=1 ;;
 @@ -752,12 +757,12 @@
  	if [ -f $PKGCHK_UPDATE_CONF ] ; then
  	    msg "Merging in previous $PKGCHK_UPDATE_CONF"
  	    tmp=$(cat $PKGCHK_UPDATE_CONF;echo $(pkgdirs_from_installed)|fmt -1)
 -	    if [ -z "$opt_n" ] ; then
 +	    if [ -z "$opt_n" -a -z "$opt_q" ] ; then
  		echo $tmp | fmt -1 | ${SORT} -u > $PKGCHK_UPDATE_CONF
  	    fi
  	    tmp=
  	else
 -	    if [ -z "$opt_n" ] ; then
 +	    if [ -z "$opt_n" -a -z "$opt_q" ] ; then
  		echo $(pkgdirs_from_installed) | fmt -1 > $PKGCHK_UPDATE_CONF
  	    fi
  	fi