summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2011-01-10 13:04:38 +0000
committerespie <espie@openbsd.org>2011-01-10 13:04:38 +0000
commite3ac2bb4b76cb3e5eb676201ceaced8612386807 (patch)
tree91dee7a0c9f83858dc05beaaac974bb9ea361d34
parentRemove 2 empty lines. (diff)
downloadwireguard-openbsd-e3ac2bb4b76cb3e5eb676201ceaced8612386807.tar.xz
wireguard-openbsd-e3ac2bb4b76cb3e5eb676201ceaced8612386807.zip
have "non quiet" mode for pkg_info -r show something...
postpone locking: we don't need any locks for pkg_info -r.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgInfo.pm19
1 files changed, 13 insertions, 6 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
index cde63dc6240..5133f402327 100644
--- a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: PkgInfo.pm,v 1.20 2011/01/03 19:33:46 espie Exp $
+# $OpenBSD: PkgInfo.pm,v 1.21 2011/01/10 13:04:38 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -491,24 +491,31 @@ sub parse_and_run
'[-AaCcdfIKLMmPqRSstUv] [-D nolock][-E filename] [-e pkg-name] ',
'[-l str] [-Q query] [-r pkgspec] [pkg-name] [...]');
- $state->lock;
-
if ($state->opt('r')) {
require OpenBSD::PkgSpec;
- my $s = OpenBSD::PkgSpec->new($state->opt('r'));
+ my $pattern = $state->opt('r');
+ my $s = OpenBSD::PkgSpec->new($pattern);
if (!$s->is_valid) {
- $state->errsay("Invalid spec: #1", $state->opt('r'));
+ $state->errsay("Invalid pkgspec: #1", $pattern);
return 1;
}
- if ($s->match_ref(\@ARGV) != 0) {
+ my @l = $s->match_ref(\@ARGV);
+ unless ($state->opt('q')) {
+ $state->say("Pkgspec #1 matched #2", $pattern,
+ join(' ', @l));
+ }
+ if (@l != 0) {
return 0;
} else {
return 1;
}
}
+
+ $state->lock;
+
my $nonames = @ARGV == 0 && @extra == 0;
unless ($state->hasanyopt('cMUdfILRsSP') || $state->{terse}) {