summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
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/PackageRepositoryList.pm
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/PackageRepositoryList.pm')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm35
1 files changed, 23 insertions, 12 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
index 935ba2d299f..f073c13cff3 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageRepositoryList.pm,v 1.16 2007/05/19 09:50:31 espie Exp $
+# $OpenBSD: PackageRepositoryList.pm,v 1.17 2009/04/19 14:58:32 espie Exp $
#
# Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org>
#
@@ -23,20 +23,20 @@ package OpenBSD::PackageRepositoryList;
sub new
{
my $class = shift;
- return bless {list => [] }, $class;
+ return bless [], $class;
}
sub add
{
my $self = shift;
- push @{$self->{list}}, @_;
+ push @$self, @_;
}
sub find
{
my ($self, $pkgname, $arch) = @_;
- for my $repo (@{$self->{list}}) {
+ for my $repo (@$self) {
my $pkg = $repo->find($pkgname, $arch);
return $pkg if defined $pkg;
}
@@ -47,7 +47,7 @@ sub grabPlist
{
my ($self, $pkgname, $arch, $code) = @_;
- for my $repo (@{$self->{list}}) {
+ for my $repo (@$self) {
my $plist = $repo->grabPlist($pkgname, $arch, $code);
return $plist if defined $plist;
}
@@ -57,7 +57,7 @@ sub grabPlist
sub match
{
my ($self, @search) = @_;
- for my $repo (@{$self->{list}}) {
+ for my $repo (@$self) {
my @l = $repo->match(@search);
if (@l > 0) {
return @l;
@@ -69,21 +69,32 @@ sub match
sub match_locations
{
my ($self, @search) = @_;
- for my $repo (@{$self->{list}}) {
- my @l = $repo->match_locations(@search);
- if (@l > 0) {
- return @l;
+ for my $repo (@$self) {
+ my $l = $repo->match_locations(@search);
+ if (@$l > 0) {
+ return $l;
}
}
- return ();
+ return [];
}
sub cleanup
{
my $self = shift;
- for my $repo (@{$self->{list}}) {
+ for my $repo (@$self) {
$repo->cleanup;
}
}
+sub print_without_src
+{
+ my $self = shift;
+ my @l = ();
+ for my $repo (@$self) {
+ next if $repo->isa("OpenBSD::PackageRepository::Source");
+ push(@l, $repo->url);
+ }
+ return join(':', @l);
+}
+
1;