summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-06-04 11:42:04 +0000
committerPierre-Yves Ritschard <pyr@cvs.openbsd.org>2007-06-04 11:42:04 +0000
commit8b1ee59c582797bf42099bd985ac14b98422b202 (patch)
tree9dba2ada991bd82aa558cd544934d56e1513bc59 /usr.sbin/pkg_add
parent7557caba8631038214978acc5bb8367ddcf85b69 (diff)
add -t flag to pkg_info to enable listing of the ``top level'' packages,
i.e those who are not a dependency of another package. useful to show the packages you actually use. ok espie@
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/pkg_info14
-rw-r--r--usr.sbin/pkg_add/pkg_info.16
2 files changed, 15 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info
index c28a2a1d08b..377436cf23f 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.57 2007/05/18 12:44:32 espie Exp $
+# $OpenBSD: pkg_info,v 1.58 2007/06/04 11:42:03 pyr Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -209,7 +209,7 @@ sub find_by_path
our ($opt_c, $opt_D, $opt_d, $opt_f, $opt_I, $opt_i, $opt_k, $opt_K, $opt_L,
$opt_m, $opt_p, $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_l, $opt_a, $opt_M, $opt_U, $opt_A, $opt_S, $opt_P, $opt_t);
my $terse = 0;
my $exit_code = 0;
my $error_e = 0;
@@ -321,7 +321,7 @@ set_usage('pkg_info [-AacDdfIiKkLMPpqRrSsUv] [-E filename] [-e pkg-name] [-l str
my $locked;
try {
- getopts('cDdfhIikKLmpPQ:qRrsSUve:E:Ml:aA',
+ getopts('cDdfhIikKLmpPQ:qRrsSUve:E:Ml:aAt',
{'e' =>
sub {
my $pat = shift;
@@ -404,8 +404,16 @@ if (@ARGV > 0 && ($opt_a || $opt_A)) {
Usage "Can't specify package name(s) with -a";
}
+if (@ARGV > 0 && $opt_t) {
+ Usage "Can't specify package name(s) with -t";
+}
+
if (@ARGV == 0 && !$error_e) {
@ARGV = sort(installed_packages(defined $opt_A ? 0 : 1));
+ if ($opt_t) {
+ require OpenBSD::RequiredBy;
+ @ARGV = grep { OpenBSD::RequiredBy->new($_)->list == 0 } @ARGV;
+ }
}
if (@sought_files) {
diff --git a/usr.sbin/pkg_add/pkg_info.1 b/usr.sbin/pkg_add/pkg_info.1
index a3beb156755..3cbe4aa67c8 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.25 2007/05/31 19:20:26 jmc Exp $
+.\" $OpenBSD: pkg_info.1,v 1.26 2007/06/04 11:42:03 pyr 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: May 31 2007 $
+.Dd $Mdocdate: June 4 2007 $
.Dt PKG_INFO 1
.Os
.Sh NAME
@@ -160,6 +160,8 @@ This signature is a unique tag showing the package name, and the version number
of every dependency and shared library necessary to build this package.
.It Fl s
Show an estimate of the total size of each package.
+.It Fl t
+Show packages which are not required by any other packages.
.It Fl U
Show the deinstall-message file (if any) for each package.
.It Fl v