diff options
author | 2011-01-03 19:33:46 +0000 | |
---|---|---|
committer | 2011-01-03 19:33:46 +0000 | |
commit | a192ee45fd6271616fe0d20d28cfa2148e51e278 (patch) | |
tree | 041c5d7e8e0cb76211c597b9dbf42e0c44897af3 | |
parent | redo the object creation in a more straightforward way. (diff) | |
download | wireguard-openbsd-a192ee45fd6271616fe0d20d28cfa2148e51e278.tar.xz wireguard-openbsd-a192ee45fd6271616fe0d20d28cfa2148e51e278.zip |
make it possible to check for a pkgspec by name, without looking at installed
stuff.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgInfo.pm | 22 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_info.1 | 9 |
2 files changed, 26 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm index 4633b96a79f..cde63dc6240 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.19 2010/12/29 13:03:05 espie Exp $ +# $OpenBSD: PkgInfo.pm,v 1.20 2011/01/03 19:33:46 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -487,12 +487,28 @@ sub parse_and_run } }; $state->{no_exports} = 1; - $state->handle_options('cCdfF:hIKLmPQ:qRsSUe:E:Ml:aAt', + $state->handle_options('cCdfF:hIKLmPQ:qr:RsSUe:E:Ml:aAt', '[-AaCcdfIKLMmPqRSstUv] [-D nolock][-E filename] [-e pkg-name] ', - '[-l str] [-Q query] [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')); + if (!$s->is_valid) { + $state->errsay("Invalid spec: #1", $state->opt('r')); + return 1; + } + if ($s->match_ref(\@ARGV) != 0) { + return 0; + } else { + return 1; + } + + } my $nonames = @ARGV == 0 && @extra == 0; unless ($state->hasanyopt('cMUdfILRsSP') || $state->{terse}) { diff --git a/usr.sbin/pkg_add/pkg_info.1 b/usr.sbin/pkg_add/pkg_info.1 index d6ca72c7894..33e1c336cb8 100644 --- a/usr.sbin/pkg_add/pkg_info.1 +++ b/usr.sbin/pkg_add/pkg_info.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: pkg_info.1,v 1.39 2010/06/09 10:25:17 espie Exp $ +.\" $OpenBSD: pkg_info.1,v 1.40 2011/01/03 19:33:46 espie Exp $ .\" .\" Documentation and design originally from FreeBSD. All the code has .\" been rewritten since. We keep the documentation's notice: @@ -15,7 +15,7 @@ .\" Jordan K. Hubbard .\" .\" -.Dd $Mdocdate: June 9 2010 $ +.Dd $Mdocdate: January 3 2011 $ .Dt PKG_INFO 1 .Os .Sh NAME @@ -29,6 +29,7 @@ .Op Fl e Ar pkg-name .Op Fl l Ar str .Op Fl Q Ar query +.Op Fl r Ar pkgspec .Op Ar pkg-name .Op Ar ... .Ek @@ -149,6 +150,10 @@ Be .Dq quiet in emitting report headers and such, just dump the raw info (basically, assume a non-human reading). +.It Fl r Ar pkgspec +Check a list for a given +.Ar pkgspec. +The following arguments are names of packages to verify. .It Fl R Show which packages require a given package. .It Fl S |