From 7de5cfed56d90c28dacb4243b078c67fcee9ec01 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sat, 9 Jan 2010 09:45:41 +0000 Subject: move pipe handling into RepositoryList --- usr.sbin/pkg_add/OpenBSD/PackageLocator.pm | 12 +----------- usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 8 +++++++- usr.sbin/pkg_add/OpenBSD/PackageRepositoryList.pm | 9 ++++++++- 3 files changed, 16 insertions(+), 13 deletions(-) (limited to 'usr.sbin/pkg_add/OpenBSD') 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 # @@ -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 # @@ -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 # @@ -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; -- cgit v1.2.3