Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Nov 1999 11:55:03 +0000 (GMT)
From:      Dom.Mitchell@palmerharvey.co.uk
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        bmah@CS.Sandia.GOV, billf@FreeBSD.ORG
Subject:   bin/15162: New option for pkg_version(1).
Message-ID:  <19991129115503.1ED91211@voodoo.pandhm.co.uk>

next in thread | raw e-mail | index | archive | help

>Number:         15162
>Category:       bin
>Synopsis:       New option for pkg_version(1).
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 29 04:00:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Dominic Mitchell
>Release:        FreeBSD 3.3-STABLE i386
>Organization:
Palmer & Harvey McLane Ltd.
>Environment:

FreeBSD voodoo.pandhm.co.uk 3.3-STABLE FreeBSD 3.3-STABLE #4: Thu Nov 18 09:01:45 GMT 1999     root@voodoo.pandhm.co.uk:/usr/src/sys/compile/VOODOO  i386

>Description:

	I thought it would be useful to limit the output of pkg_version
	to one or more matching status flags.  The attached patch
	implements this option.

	In particular, this lets get the commands to update merely the
	out of date ports with ease:

	% pkg_version -c -l '<'
#
#  less
#  needs updating (index has 340)
#
cd /usr/ports/misc/less
make
pkg_delete -f less-337
make install

#
#  vim
#  needs updating (index has 5.5.38)
#
cd /usr/ports/editors/vim5
make
pkg_delete -f vim-5.5.37
make install

>How-To-Repeat:

	Apply patch.

>Fix:
	
	Here's the patch:

diff -urP /usr/src/usr.sbin/pkg_install/version/pkg_version.1 version/pkg_version.1
--- /usr/src/usr.sbin/pkg_install/version/pkg_version.1	Fri Nov 26 22:04:49 1999
+++ version/pkg_version.1	Mon Nov 29 11:53:31 1999
@@ -33,6 +33,7 @@
 .Sh SYNOPSIS
 .Nm pkg_version
 .Op Fl cdhv
+.Op Fl l Ar limchar
 .Op Ar index
 .Sh DESCRIPTION
 The
@@ -75,6 +76,15 @@
 Enable debugging output.
 .It Fl h
 Print help message.
+.It Fl l
+Limit the output to those packages whose status flag matches
+.Ar limchar .
+You may specify more than one character to match in
+.Ar limchar .  
+Note that because some of the status flag characters are also special
+to the shell, it is best to quote
+.Ar limchar
+with single quotes.
 .It Fl v
 Enable verbose output.  Verbose output includes some English-text
 interpretations of the version number comparisons, as well as the
Binary files /usr/src/usr.sbin/pkg_install/version/pkg_version.1.gz and version/pkg_version.1.gz differ
diff -urP /usr/src/usr.sbin/pkg_install/version/pkg_version.pl version/pkg_version.pl
--- /usr/src/usr.sbin/pkg_install/version/pkg_version.pl	Fri Nov 26 22:04:49 1999
+++ version/pkg_version.pl	Mon Nov 29 11:37:24 1999
@@ -47,6 +47,7 @@
 $DebugFlag = 0;
 $VerboseFlag = 0;
 $CommentChar = "#";
+$LimitFlag = "";
 
 #
 # CompareVersions
@@ -124,6 +125,7 @@
 -c              Show commands to update installed packages
 -d debug	Debugging output (debug controls level of output)
 -h		Help (this message)
+-l limchar	Limit output
 -v		Verbose output
 index		URL or filename of index file
 		(Default is $IndexFile)
@@ -133,7 +135,7 @@
 #
 # Parse command-line arguments, deal with them
 #
-if (!getopts('cdhv') || ($opt_h)) {
+if (!getopts('cdhl:v') || ($opt_h)) {
     &PrintHelp();
     exit;
 }
@@ -143,6 +145,9 @@
 if ($opt_d) {
     $DebugFlag = $opt_d;
 }
+if ($opt_l) {
+    $LimitFlag = $opt_l;
+}
 if ($opt_v) {
     $VerboseFlag = 1;
 }
@@ -258,7 +263,11 @@
 	$Comment = "unknown in index";
     }
 
-    write;
+    if ($LimitFlag) {
+	write if $versionCode =~ m/[$LimitFlag]/o;
+    } else {
+	write;
+    }
 }
 
 exit 0;


-- 
**********************************************************************
This email and any files transmitted with it are intended solely for the use of the individual or entity to whom they are addressed. 
The email has been swept by MIMEsweeper for the presence of computer viruses.

www.palmerharvey.co.uk
**********************************************************************

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19991129115503.1ED91211>