aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_install
diff options
context:
space:
mode:
authorBruce A. Mah <bmah@FreeBSD.org>2000-10-20 06:16:18 +0000
committerBruce A. Mah <bmah@FreeBSD.org>2000-10-20 06:16:18 +0000
commit69a71301db0e381427ac8afc2db8d419661e6d5e (patch)
tree4a6e8bd0aba9df240e8d8a33c8b46bd87df2e7c7 /usr.sbin/pkg_install
parent65ea861a3eb5e55e7c9d37357543e02aa4baa7ed (diff)
downloadsrc-69a71301db0e381427ac8afc2db8d419661e6d5e.tar.gz
src-69a71301db0e381427ac8afc2db8d419661e6d5e.zip
Add -L option to limit the package status characters the user *doesn't*
want to see. Submitted by: Doug Barton <DougB@gorean.org>
Notes
Notes: svn path=/head/; revision=67349
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 741ef6264bcc..9e2113580d2e 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 59bd29e50788..b4852c05cd9e 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;
}
}