From owner-freebsd-ports Mon Mar 26 9: 0:15 2001 Delivered-To: freebsd-ports@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8D6AF37B71A for ; Mon, 26 Mar 2001 09:00:09 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2QH09H21887; Mon, 26 Mar 2001 09:00:09 -0800 (PST) (envelope-from gnats) Received: from cgmd76206.chello.nl (d9168.upc-d.chello.nl [213.46.9.168]) by hub.freebsd.org (Postfix) with ESMTP id 41CD837B71A for ; Mon, 26 Mar 2001 08:53:23 -0800 (PST) (envelope-from edwin@cgmd76206.chello.nl) Received: by cgmd76206.chello.nl (Postfix, from userid 1001) id 05E9B180; Mon, 26 Mar 2001 18:53:22 +0200 (CEST) Message-Id: <20010326165322.05E9B180@cgmd76206.chello.nl> Date: Mon, 26 Mar 2001 18:53:22 +0200 (CEST) From: edwin@mavetju.org Reply-To: edwin@mavetju.org To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: ports/26114: [PATCH] pkg_version support for wildcharts on pkg_info Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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 -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 () { ($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