summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-01-09 09:45:41 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-01-09 09:45:41 +0000
commit7de5cfed56d90c28dacb4243b078c67fcee9ec01 (patch)
tree5f5b355047f257a512f8d3fa2d08ad87fd19f627 /usr.sbin/pkg_add
parentfe7e0b8ca1338a44eb35da00497640dce0458e29 (diff)
move pipe handling into RepositoryList
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm12
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm8
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm9
3 files changed, 16 insertions, 13 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index f5c8c0c3e24..0c9b3e2b850 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.77 2010/01/09 09:37:45 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.78 2010/01/09 09:45:40 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -65,11 +65,6 @@ sub find
{
my ($class, $_, $arch) = @_;
- if ($_ eq '-') {
- my $repository = OpenBSD::PackageRepository::Local::Pipe->_new('./');
- my $package = $repository->find(undef, $arch);
- return $package;
- }
if (exists $packages{$_}) {
return $packages{$_};
}
@@ -91,11 +86,6 @@ sub grabPlist
{
my ($class, $_, $arch, $code) = @_;
- if ($_ eq '-') {
- my $repository = OpenBSD::PackageRepository::Local::Pipe->_new('./');
- my $plist = $repository->grabPlist(undef, $arch, $code);
- return $plist;
- }
my $plist;
if (m/\//o) {
my ($repository, undef, $pkgname) = path_parse($_);
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 3909aae9189..8fccf2e41bd 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageRepository.pm,v 1.68 2009/10/13 11:49:25 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.69 2010/01/09 09:45:40 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -367,6 +367,12 @@ sub may_exist
return 1;
}
+sub new
+{
+ my $class = shift;
+ bless {}, $class;
+}
+
sub open_pipe
{
my ($self, $object) = @_;
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm
index 668f7ed0592..db2292eefcd 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.18 2010/01/09 09:37:45 espie Exp $
+# $OpenBSD: PackageRepositoryList.pm,v 1.19 2010/01/09 09:45:40 espie Exp $
#
# Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org>
#
@@ -36,6 +36,9 @@ sub find
{
my ($self, $pkgname, $arch) = @_;
+ if ($pkgname eq '-') {
+ return OpenBSD::PackageRepository::Local::Pipe->new->find($pkgname, $arch);
+ }
for my $repo (@$self) {
my $pkg = $repo->find($pkgname, $arch);
return $pkg if defined $pkg;
@@ -47,6 +50,10 @@ sub grabPlist
{
my ($self, $pkgname, $arch, $code) = @_;
+ if ($pkgname eq '-') {
+ return OpenBSD::PackageRepository::Local::Pipe->new->grabPlist($pkgname, $arch, $code);
+ }
+
for my $repo (@$self) {
my $plist = $repo->grabPlist($pkgname, $arch, $code);
return $plist if defined $plist;