summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/PackageRepository
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2009-04-19 14:58:33 +0000
committerMarc Espie <espie@cvs.openbsd.org>2009-04-19 14:58:33 +0000
commitec8ddac0b1b2a0ba80424a1b47bb6bab9e35bcf5 (patch)
treed6cca43827cdc725b832e2a73bf959a6200d61f2 /usr.sbin/pkg_add/OpenBSD/PackageRepository
parent087733393d1622a68046244a995781b5af3496b2 (diff)
synch with my new style search/location changes
It's likely there will be some fallout, but it's getting a bit too large to keep around. This does kill a few very old oddities as well.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackageRepository')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm50
1 files changed, 45 insertions, 5 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm
index 57463fd14d3..ff926d516a8 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Installed.pm,v 1.12 2007/06/10 17:13:48 espie Exp $
+# $OpenBSD: Installed.pm,v 1.13 2009/04/19 14:58:32 espie Exp $
#
# Copyright (c) 2007 Marc Espie <espie@openbsd.org>
#
@@ -40,12 +40,12 @@ sub match
sub match_locations
{
my ($self, $search, @filters) = @_;
- my @l = $search->match_locations($self);
+ my $l = $search->match_locations($self);
while (my $filter = (shift @filters)) {
- last if @l == 0; # don't bother filtering empty list
- @l = $filter->filter_locations(@l);
+ last if @$l == 0; # don't bother filtering empty list
+ $l = $filter->filter_locations($l);
}
- return @l;
+ return $l;
}
sub url
@@ -88,6 +88,32 @@ sub canonicalize
return $name;
}
+sub locations_list
+{
+ my $self = shift;
+ if (!defined $self->{locations}) {
+ my $l = [];
+ require OpenBSD::PackageLocation;
+
+ for my $name (@{$self->list}) {
+ push @$l, OpenBSD::PackageLocation->new($self, $name);
+ }
+ $self->{locations} = $l;
+ }
+ return $self->{locations};
+}
+
+sub grab_info
+{
+ my ($repository, $location) = @_;
+ $location->grabInfoFiles;
+}
+
+sub get_plist
+{
+ my ($repository, $location, $code) = @_;
+ $location->_plist($code);
+}
package OpenBSD::PackageRepository::Installed;
our @ISA = (qw(OpenBSD::PackageRepositoryBase));
@@ -123,6 +149,7 @@ sub canonicalize
my ($self, $name) = @_;
return installed_name($name);
}
+
sub find
{
my ($repository, $name, $arch) = @_;
@@ -137,6 +164,19 @@ sub find
return $self;
}
+sub grab_info
+{
+ my ($repository, $location) = @_;
+ $location->{dir} = installed_info($location->name);
+}
+
+sub get_plist
+{
+ my ($repository, $location, $code) = @_;
+ require OpenBSD::PackingList;
+ return OpenBSD::PackingList->from_installation($location->name, $code);
+}
+
sub grabPlist
{
my ($repository, $name, $arch, $code) = @_;