Add '-l' which will match a certain status code.
Add the submitter as a contributor in the man page freebsd -> FreeBSD, while I'm poking around. PR: bin/15162 Submitted by: Dominic Mitchell <dom@palmerharvey.co.uk>
This commit is contained in:
parent
a30945450e
commit
47f97505ad
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=54053
@ -33,6 +33,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm pkg_version
|
||||
.Op Fl cdhv
|
||||
.Op Fl l Ar limchar
|
||||
.Op Ar index
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
@ -59,7 +60,7 @@ index file could not be determined. A common reason for this message
|
||||
is that there are multiple versions of a particular software package
|
||||
installed, or that multiple versions are listed in the index file.
|
||||
Examples from the
|
||||
.Fx 2.2.6
|
||||
.Fx
|
||||
ports collection are the Tcl toolkit or the
|
||||
.Tn EMACS
|
||||
editor.
|
||||
@ -75,6 +76,15 @@ system.
|
||||
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
|
||||
@ -112,7 +122,7 @@ index file:
|
||||
The command below generates a report against
|
||||
the version numbers in the on-line ports collection:
|
||||
.Pp
|
||||
.Dl % pkg_version ftp://ftp.freebsd.org/pub/FreeBSD/ports-current/INDEX
|
||||
.Dl % pkg_version ftp://ftp.FreeBSD.org/pub/FreeBSD/ports-current/INDEX
|
||||
.Pp
|
||||
The command below generates a file of commands to run to update the installed
|
||||
files. It is
|
||||
@ -126,7 +136,8 @@ suggestions, and then cut-and-paste (or retype) the commands you want to run.
|
||||
.Sh AUTHOR
|
||||
.An Bruce A. Mah Aq bmah@ca.sandia.gov
|
||||
.Sh CONTRIBUTORS
|
||||
.An Nik Clayton Aq nik@freebsd.org
|
||||
.An Nik Clayton Aq nik@FreeBSD.org ,
|
||||
.An Dominic Mitchell Aq dom@palmerharvey.co.uk
|
||||
.Sh BUGS
|
||||
There should be a better way of dealing with packages that
|
||||
can have more than one installed version.
|
||||
|
@ -47,6 +47,7 @@ $ShowCommandsFlag = 0;
|
||||
$DebugFlag = 0;
|
||||
$VerboseFlag = 0;
|
||||
$CommentChar = "#";
|
||||
$LimitFlag = "";
|
||||
|
||||
#
|
||||
# CompareVersions
|
||||
@ -124,6 +125,7 @@ Usage: pkg_version [-c] [-d debug] [-h] [-v] [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
|
||||
-v Verbose output
|
||||
index URL or filename of index file
|
||||
(Default is $IndexFile)
|
||||
@ -133,7 +135,7 @@ EOF
|
||||
#
|
||||
# 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_c) {
|
||||
if ($opt_d) {
|
||||
$DebugFlag = $opt_d;
|
||||
}
|
||||
if ($opt_l) {
|
||||
$LimitFlag = $opt_l;
|
||||
}
|
||||
if ($opt_v) {
|
||||
$VerboseFlag = 1;
|
||||
}
|
||||
@ -258,8 +263,12 @@ foreach $packageName (sort keys %currentPackages) {
|
||||
$Comment = "unknown in index";
|
||||
}
|
||||
|
||||
if ($LimitFlag) {
|
||||
write if $versionCode =~ m/[$LimitFlag]/o;
|
||||
} else {
|
||||
write;
|
||||
}
|
||||
}
|
||||
|
||||
exit 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user