summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2004-12-22 12:56:26 +0000
committerMarc Espie <espie@cvs.openbsd.org>2004-12-22 12:56:26 +0000
commitbcd1afc7c25496c82542dc94751af6f307dc6b99 (patch)
tree3d5f49c9b1640676b35b4eea875787acab0a085b /usr.sbin
parent756a8eb701074f3f1c1ce1c0881c984fb7027318 (diff)
keep less stuff around for -e pkgpath.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/pkg_info28
1 files changed, 15 insertions, 13 deletions
diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info
index 9dc6c51502a..84defa9ced7 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.25 2004/12/16 11:07:33 espie Exp $
+# $OpenBSD: pkg_info,v 1.26 2004/12/22 12:56:25 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -109,30 +109,32 @@ sub filter_files
return @result;
}
-my $all_plists;
+my $path_info;
sub find_by_path
{
my $pat = shift;
- if (!defined $all_plists) {
+ if (!defined $path_info) {
require OpenBSD::PackingOld;
require OpenBSD::PackingList;
- $all_plists = [];
- for my $pkg (installed_packages()) {
- push(@$all_plists,
+ $path_info = {};
+ for my $pkg (installed_packages(1)) {
+ my $plist =
OpenBSD::PackingList->from_installation($pkg,
- \&OpenBSD::PackingList::ExtraInfoOnly));
+ \&OpenBSD::PackingList::ExtraInfoOnly);
+ my $path = $plist->{extrainfo}->{subdir};
+ $path_info->{$path} = [] unless
+ defined $path_info->{$path};
+ push(@{$path_info->{$path}}, $plist->pkgname());
}
}
- my @result = ();
- for my $plist (@$all_plists) {
- if ($plist->{extrainfo}->{subdir} eq $pat) {
- push(@result, $plist->pkgname());
- }
+ if (defined $path_info->{$pat}) {
+ return @{$path_info->{$pat}};
+ } else {
+ return ();
}
- return @result;
}
our ($opt_c, $opt_D, $opt_d, $opt_f, $opt_I, $opt_i, $opt_k, $opt_K, $opt_L,