Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Mar 2001 18:53:22 +0200 (CEST)
From:      edwin@mavetju.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/26114: [PATCH] pkg_version support for wildcharts on pkg_info
Message-ID:  <20010326165322.05E9B180@cgmd76206.chello.nl>

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

>Number:         26114
>Category:       ports
>Synopsis:       [PATCH] pkg_version support for wildcharts on pkg_info
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 26 09:00:08 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Edwin Groothuis
>Release:        FreeBSD 4.2-RELEASE i386
>Organization:
-
>Environment:

	FreeBSD 4.2, with latest checkout of usr.sbin/pkg_install

>Description:

	Since a short time, pkg_info supports wildcharts on the
	commandline to limit the packages being searched on. This
	patch will make pkg_version use that option.

>How-To-Repeat:

	[~] edwin@p6>pkg_version -s netscape
	linux-netscape-navigator    =
	netscape-communicator       *

>Fix:

--- pkg_version.pl.old  Mon Mar 26 18:18:41 2001
+++ pkg_version.pl      Mon Mar 26 18:49:38 2001
@@ -37,8 +37,9 @@
 #
 # Configuration global variables
 #
-$Version = '0.1';
-$CurrentPackagesCommand = '/usr/sbin/pkg_info -aI';
+$Version = '0.2';
+$AllCurrentPackagesCommand = '/usr/sbin/pkg_info -aI';
+$SelectedCurrentPackagesCommand = '/usr/sbin/pkg_info -I';
 $CatProgram = "cat ";
 $FetchProgram = "fetch -o - ";
 $OriginCommand = '/usr/sbin/pkg_info -qo';
@@ -197,12 +198,13 @@
 pkg_version $Version
 Bruce A. Mah <bmah\@freebsd.org>
 
-Usage: pkg_version [-c] [-d debug] [-h] [-v] [index]
+Usage: pkg_version [-c] [-d debug] [-h] [-v] [-s string] [index]
 -c              Show commands to update installed packages
 -d debug       Debugging output (debug controls level of output)
 -h             Help (this message)
 -l limchar     Limit output to status flags that match
 -L limchar     Limit output to status flags that DON\'T match
+-s string      Limit output to packages with that string in it
 -v             Verbose output
 index          URL or filename of index file
                (Default is $IndexFile)
@@ -212,7 +214,7 @@
 #
 # Parse command-line arguments, deal with them
 #
-if (!getopts('cdhl:L:v') || ($opt_h)) {
+if (!getopts('cdhl:L:s:v') || ($opt_h)) {
     &PrintHelp();
     exit;
 }
@@ -231,6 +233,9 @@
 if ($opt_L) {
     $PreventFlag = $opt_L;
 }
+if ($opt_s) {
+    $StringFlag = $opt_s;
+}
 if ($opt_v) {
     $VerboseFlag = 1;
 }
@@ -249,11 +254,17 @@
 #
 # Get the current list of installed packages
 #
-if ($DebugFlag) {
-    print STDERR "$CurrentPackagesCommand\n";
+if ($StringFlag) {
+    if ($DebugFlag) {
+       print STDERR "$SelectedCurrentPackagesCommand *$StringFlag*\n";
+    }
+    open CURRENT, "$SelectedCurrentPackagesCommand \\*$StringFlag\\*|";
+} else {
+    if ($DebugFlag) {
+       print STDERR "$AllCurrentPackagesCommand\n";
+    }
+    open CURRENT, "$AllCurrentPackagesCommand|";
 }
-
-open CURRENT, "$CurrentPackagesCommand|";
 while (<CURRENT>) {
     ($packageString, $rest) = split;

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

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




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