summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2016-06-28 15:38:36 +0000
committerespie <espie@openbsd.org>2016-06-28 15:38:36 +0000
commit7726b8e0e0ca53932971a1172b4edb544055f0b8 (patch)
tree3044e26092ba528c4d77c0cb8b07a98d63342875
parentdocument is-branch (diff)
downloadwireguard-openbsd-7726b8e0e0ca53932971a1172b4edb544055f0b8.tar.xz
wireguard-openbsd-7726b8e0e0ca53932971a1172b4edb544055f0b8.zip
option -z that uses is-branch info to produce "complete"
stem--[flavor][%branch] listing. feedback and suggestions semarie@
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PkgInfo.pm19
-rw-r--r--usr.sbin/pkg_add/pkg_info.114
2 files changed, 26 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm b/usr.sbin/pkg_add/OpenBSD/PkgInfo.pm
index 642a4b8de26..f36ec2e0c67 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.38 2016/06/22 12:18:21 espie Exp $
+# $OpenBSD: PkgInfo.pm,v 1.39 2016/06/28 15:38:36 espie Exp $
#
# Copyright (c) 2003-2014 Marc Espie <espie@openbsd.org>
#
@@ -415,7 +415,18 @@ sub print_info
return;
}
my $plist;
- if ($state->opt('I')) {
+ if ($state->opt('z')) {
+ $plist = $handle->plist(\&OpenBSD::PackingList::ExtraInfoOnly);
+ my $name = OpenBSD::PackageName->new_from_string($pkg);
+ my $stem = $name->{stem};
+ my $compose = $stem."--".join('-', sort keys %{$name->{flavors}});
+ if ($plist->has('is-branch')) {
+ if ($plist->fullpkgpath =~ m/\/([^\/]+?)(,.*)?$/) {
+ $compose .= "%$1";
+ }
+ }
+ $state->say("#1", $compose);
+ } elsif ($state->opt('I')) {
if ($state->opt('q')) {
$state->say("#1", $pkg);
} else {
@@ -567,8 +578,8 @@ sub parse_and_run
}
};
$state->{no_exports} = 1;
- $state->handle_options('cCdfF:hIKLmPQ:qr:RsSUe:E:Ml:aAt',
- '[-AaCcdfIKLMmPqRSstUv] [-D nolock][-E filename] [-e pkg-name] ',
+ $state->handle_options('cCdfF:hIKLmPQ:qr:RsSUe:E:Ml:aAtz',
+ '[-AaCcdfIKLMmPqRSstUvz] [-D nolock][-E filename] [-e pkg-name] ',
'[-l str] [-Q query] [-r pkgspec] [pkg-name ...]');
if ($state->opt('r')) {
diff --git a/usr.sbin/pkg_add/pkg_info.1 b/usr.sbin/pkg_add/pkg_info.1
index b65099ad277..f6d480e3e79 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.52 2016/02/29 22:59:33 jmc Exp $
+.\" $OpenBSD: pkg_info.1,v 1.53 2016/06/28 15:38:36 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: February 29 2016 $
+.Dd $Mdocdate: June 28 2016 $
.Dt PKG_INFO 1
.Os
.Sh NAME
@@ -24,7 +24,7 @@
.Sh SYNOPSIS
.Nm pkg_info
.Bk -words
-.Op Fl AaCcdfIKLMmPqRSstUv
+.Op Fl AaCcdfIKLMmPqRSstUvz
.Op Fl E Ar filename
.Op Fl e Ar pkg-name
.Op Fl l Ar str
@@ -179,6 +179,14 @@ Show packages which are not required by any other packages.
Show the deinstall-message file (if any) for each package.
.It Fl v
Turn on verbose output.
+.It Fl z
+Fuzzy listing option, often used together with
+.Fl m .
+Only shows stems, flavors and branches information.
+To be reused with
+.Xr pkg_add 1
+.Fl l
+to recreate a package installation with different versions and no ambiguity.
.El
.Sh ENVIRONMENT
.Bl -tag -width PKG_TMPDIR