diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2008-05-16 18:29:19 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2008-05-16 18:29:19 +0000 |
commit | 0a0719236d7b2bb296dc6b3d3ee1fd4d9bbba5a9 (patch) | |
tree | 063f608305b48355e5dc14e06108fb8c2557b925 /usr.sbin/pkg_add/pkg_mklocatedb | |
parent | 8d336b00e6c6298b024d185ae5bceef6d9bd6fa9 (diff) |
add a -d repository option in order not to have to specify all pkgnames.
as noticed by naddy and ajacoutot, we now have enough packages that this
stresses shell limits if we specify everything on the command line. ;-)
Diffstat (limited to 'usr.sbin/pkg_add/pkg_mklocatedb')
-rw-r--r-- | usr.sbin/pkg_add/pkg_mklocatedb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb index 8034ecab89b..52dc3454b9b 100644 --- a/usr.sbin/pkg_add/pkg_mklocatedb +++ b/usr.sbin/pkg_add/pkg_mklocatedb @@ -34,9 +34,9 @@ sub print_name package main; -set_usage('pkg_mklocatedb [-anPq] [-p portsdir] [-r release] [-s src] [-x X11src] [pkg-name [...]]'); +set_usage('pkg_mklocatedb [-anPq] [-p portsdir] [-d repository] [-r release] [-s src] [-x X11src] [pkg-name [...]]'); -our ($opt_a, $opt_n, $opt_q, $opt_s, $opt_x, $opt_r, $opt_p, $opt_P); +our ($opt_a, $opt_n, $opt_q, $opt_s, $opt_x, $opt_r, $opt_p, $opt_P, $opt_d); sub info { @@ -69,7 +69,7 @@ sub tag } try { - getopts('anqs:x:r:p:P'); + getopts('ad:nqs:x:r:p:P'); } catchall { Usage($_); }; @@ -160,7 +160,17 @@ if ($opt_p) { close($in); } -elsif (@ARGV==0) { +elsif ($opt_d) { + require File::Find; + die "Bad argument: $opt_d is not a directory" unless -d $opt_d; + File::Find::find( + sub { + return unless -f $_; + my $plist = OpenBSD::PackageLocator->grabPlist($File::Find::name); + return unless defined $plist; + $plist->print_name($fh, info($plist)); + }, $opt_d); +} elsif (@ARGV==0) { for my $pkgname (installed_packages()) { my $plist = OpenBSD::PackingList->from_installation($pkgname); next unless defined $plist; |