summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-09-16 10:01:00 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-09-16 10:01:00 +0000
commit7ca04bf85002c48435902f886ef199ba8a01c99e (patch)
treea3b8aea8209cfee2e8d5dbca5497cb8b7edd84e9 /usr.sbin/pkg_add
parent15c3645b847465b2a4b2afbda4ce4636040d7d9b (diff)
move .tgz addition down to PackageRepositoryList.
re-add list, which returns a \@, whereas available returns a @.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm27
1 files changed, 20 insertions, 7 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index 0d4a503b6c7..97b8ec634b9 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageLocator.pm,v 1.32 2005/09/14 09:50:40 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.33 2005/09/16 10:00:59 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -40,6 +40,13 @@ sub new
}
}
+sub available
+{
+ my $self = shift;
+
+ return @{$self->list()};
+}
+
sub wipe_info
{
my ($self, $pkg) = @_;
@@ -112,6 +119,7 @@ sub open
sub find
{
my ($repository, $name, $arch) = @_;
+ $name.=".tgz" unless $name =~ m/\.tgz$/;
my $self = OpenBSD::PackageLocation->new($repository, $name);
return $self->openPackage($name, $arch);
@@ -120,6 +128,7 @@ sub find
sub grabPlist
{
my ($repository, $name, $arch, $code) = @_;
+ $name.=".tgz" unless $name =~ m/\.tgz$/;
my $self = OpenBSD::PackageLocation->new($repository, $name);
return $self->grabPlist($name, $arch, $code);
@@ -152,6 +161,12 @@ sub available
return installed_packages();
}
+sub list
+{
+ my @list = installed_packages();
+ return \@list;
+}
+
sub wipe_info
{
}
@@ -198,7 +213,7 @@ sub pipename
return "scp $host:$path$name /dev/stdout 2> /dev/null|gzip -d -c -q - 2> /dev/null";
}
-sub available
+sub list
{
my ($self) = @_;
if (!defined $self->{list}) {
@@ -225,7 +240,7 @@ sub may_exist
return -r $self->{baseurl}.$name;
}
-sub available
+sub list
{
my $self = shift;
my $l = [];
@@ -309,7 +324,7 @@ sub pipename
package OpenBSD::PackageRepository::HTTP;
our @ISA=qw(OpenBSD::PackageRepository::HTTPorFTP OpenBSD::PackageRepository);
-sub available
+sub list
{
my ($self) = @_;
if (!defined $self->{list}) {
@@ -334,7 +349,7 @@ sub available
package OpenBSD::PackageRepository::FTP;
our @ISA=qw(OpenBSD::PackageRepository::HTTPorFTP OpenBSD::PackageRepository OpenBSD::PackageRepository::FTPorSCP);
-sub available
+sub list
{
my ($self) = @_;
if (!defined $self->{list}) {
@@ -666,7 +681,6 @@ sub find
my $package = $repository->find(undef, $arch);
return $package;
}
- $_.=".tgz" unless m/\.tgz$/;
if (exists $packages{$_}) {
return $packages{$_};
}
@@ -704,7 +718,6 @@ sub grabPlist
my $plist = $repository->grabPlist(undef, $arch, $code);
return $plist;
}
- $_.=".tgz" unless m/\.tgz$/;
my $plist;
if (m/\//) {
use File::Basename;