summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-10-11 18:41:22 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-10-11 18:41:22 +0000
commit0cfad83a681eeb8ee1e89d41232e8a42368c50f1 (patch)
treecad393ca254346e73fe42a42559c26be9a5ead5a /usr.sbin
parentd4e52bb73a11e03c08dab8bdd73f3038ba6cf7ff (diff)
option -m will show only packages tagged as manual installations.
(there are still some kinks in the setting of @option manual-install, so it's not as accurate as it should be).
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/pkg_info32
1 files changed, 29 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info
index 7c125b185a5..05fbfcdf777 100644
--- a/usr.sbin/pkg_add/pkg_info
+++ b/usr.sbin/pkg_add/pkg_info
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_info,v 1.75 2009/10/11 18:15:08 espie Exp $
+# $OpenBSD: pkg_info,v 1.76 2009/10/11 18:41:21 espie Exp $
#
# Copyright (c) 2003-2009 Marc Espie <espie@openbsd.org>
#
@@ -184,6 +184,24 @@ sub filter_files
return @result;
}
+sub manual_filter
+{
+ require OpenBSD::PackingList;
+
+ my @result = ();
+ for my $arg (@_) {
+ find_pkg($arg,
+ sub {
+ my ($pkgname, $handle) = @_;
+
+ my $plist = $handle->plist(\&OpenBSD::PackingList::ConflictOnly);
+
+ push(@result, $pkgname) if $plist->has('manual-installation');
+ });
+ }
+ return @result;
+}
+
my $path_info;
sub add_to_path_info
@@ -227,7 +245,7 @@ sub find_by_path
our ($opt_c, $opt_C, $opt_D, $opt_d, $opt_f, $opt_I, $opt_i, $opt_k, $opt_K,
$opt_L, $opt_Q, $opt_q, $opt_R, $opt_r, $opt_s, $opt_v, $opt_h,
- $opt_l, $opt_a, $opt_M, $opt_U, $opt_A, $opt_S, $opt_P, $opt_t);
+ $opt_l, $opt_a, $opt_m, $opt_M, $opt_U, $opt_A, $opt_S, $opt_P, $opt_t);
my $terse = 0;
my $exit_code = 0;
my $error_e = 0;
@@ -369,7 +387,7 @@ sub print_info
}
}
-set_usage('pkg_info [-AacCDdfIiKkLMPqRrSstUv] [-F opt] [-E filename] [-e pkg-name] [-l str] [-Q query] [pkg-name] [...]');
+set_usage('pkg_info [-AacCDdfIiKkLmMPqRrSstUv] [-F opt] [-E filename] [-e pkg-name] [-l str] [-Q query] [pkg-name] [...]');
my %defines;
my $locked;
@@ -466,6 +484,10 @@ if (@ARGV > 0 && $opt_t) {
Usage "Can't specify package name(s) with -t";
}
+if (@ARGV > 0 && $opt_m) {
+ Usage "Can't specify package name(s) with -m";
+}
+
if (@ARGV == 0 && !$error_e) {
@ARGV = sort(installed_packages(defined $opt_A ? 0 : 1));
if ($opt_t) {
@@ -487,6 +509,10 @@ if (@sought_files) {
}
}
+if ($opt_m) {
+ @ARGV = manual_filter(@ARGV);
+}
+
for my $pkg (@ARGV) {
if ($terse && !$opt_q) {
print $opt_l, $pkg, "\n";