summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authorbmah <bmah@FreeBSD.org>2000-10-20 06:16:18 +0000
committerbmah <bmah@FreeBSD.org>2000-10-20 06:16:18 +0000
commit9ee7a66d3e2e71817788cf4b6bd57e8ca6f6d511 (patch)
tree99c8c82eeeedc22d1157a5166fc236551955e775 /usr.sbin/pkg_install
parentf0a9b1aef57862889cf74dd8a5f2a2164d825356 (diff)
downloadFreeBSD-src-9ee7a66d3e2e71817788cf4b6bd57e8ca6f6d511.zip
FreeBSD-src-9ee7a66d3e2e71817788cf4b6bd57e8ca6f6d511.tar.gz
Add -L option to limit the package status characters the user *doesn't*
want to see. Submitted by: Doug Barton <DougB@gorean.org>
Diffstat (limited to 'usr.sbin/pkg_install')
-rw-r--r--usr.sbin/pkg_install/version/pkg_version.113
-rwxr-xr-xusr.sbin/pkg_install/version/pkg_version.pl26
2 files changed, 33 insertions, 6 deletions
diff --git a/usr.sbin/pkg_install/version/pkg_version.1 b/usr.sbin/pkg_install/version/pkg_version.1
index 741ef62..9e21135 100644
--- a/usr.sbin/pkg_install/version/pkg_version.1
+++ b/usr.sbin/pkg_install/version/pkg_version.1
@@ -34,6 +34,7 @@
.Nm pkg_version
.Op Fl cdhv
.Op Fl l Ar limchar
+.Op Fl L Ar limchar
.Op Ar index
.Sh DESCRIPTION
The
@@ -93,6 +94,15 @@ 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 L
+Limit the output to those packages whose status flag doesn't match
+.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
@@ -149,7 +159,8 @@ suggestions, and then cut-and-paste (or retype) the commands you want to run.
.Sh CONTRIBUTORS
.An Nik Clayton Aq nik@FreeBSD.org ,
.An Dominic Mitchell Aq dom@palmerharvey.co.uk ,
-.An Mark Ovens Aq marko@FreeBSD.org
+.An Mark Ovens Aq marko@FreeBSD.org ,
+.An Doug Barton Aq DougB@gorean.org
.Sh BUGS
There should be a better way of dealing with packages that
can have more than one installed version.
diff --git a/usr.sbin/pkg_install/version/pkg_version.pl b/usr.sbin/pkg_install/version/pkg_version.pl
index 59bd29e..b4852c0 100755
--- a/usr.sbin/pkg_install/version/pkg_version.pl
+++ b/usr.sbin/pkg_install/version/pkg_version.pl
@@ -48,6 +48,7 @@ $DebugFlag = 0;
$VerboseFlag = 0;
$CommentChar = "#";
$LimitFlag = "";
+$PreventFlag = "";
#
# CompareNumbers
@@ -196,7 +197,8 @@ 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
+-l limchar Limit output to status flags that match
+-L limchar Limit output to status flags that DON'T match
-v Verbose output
index URL or filename of index file
(Default is $IndexFile)
@@ -206,7 +208,7 @@ EOF
#
# Parse command-line arguments, deal with them
#
-if (!getopts('cdhl:v') || ($opt_h)) {
+if (!getopts('cdhl:L:v') || ($opt_h)) {
&PrintHelp();
exit;
}
@@ -222,6 +224,9 @@ if ($opt_d) {
if ($opt_l) {
$LimitFlag = $opt_l;
}
+if ($opt_L) {
+ $PreventFlag = $opt_L;
+}
if ($opt_v) {
$VerboseFlag = 1;
}
@@ -344,10 +349,21 @@ foreach $packageName (sort keys %currentPackages) {
$Comment = "unknown in index";
}
- if ($LimitFlag) {
- write if $versionCode =~ m/[$LimitFlag]/o;
- } else {
+ # Having figured out what to print, now determine, based on the
+ # $LimitFlag and $PreventFlag variables, if we should print or not.
+ if ((not $LimitFlag) and (not $PreventFlag)) {
write;
+ } elsif ($PreventFlag) {
+ if ($versionCode !~ m/[$PreventFlag]/o) {
+ if (not $LimitFlag) {
+ write;
+ } else {
+ write if $versionCode =~ m/[$LimitFlag]/o;
+ }
+ }
+ } else {
+ # Must mean that there is a LimitFlag
+ write if $versionCode =~ m/[$LimitFlag]/o;
}
}
OpenPOWER on IntegriCloud