summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/OpenBSD
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2005-09-13 20:44:09 +0000
committerMarc Espie <espie@cvs.openbsd.org>2005-09-13 20:44:09 +0000
commit9571b83ba5315647e439fcdcc639d34481d398d0 (patch)
tree1ab7a560eabd5d476a6d32009bf574cfd24a32a3 /usr.sbin/pkg_add/OpenBSD
parent64d71e19ad946b2e9c85c24deb14bc2a385d52ab (diff)
grabPlist shall behave like find.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm28
1 files changed, 25 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index 44684370f6e..05848a80b40 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.28 2005/09/13 20:03:29 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.29 2005/09/13 20:44:08 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -697,9 +697,31 @@ sub available
sub grabPlist
{
- my ($self, $pkgname, $arch, $code) = @_;
+ my $class = shift;
+ local $_ = shift;
+ my $arch = shift;
+ my $code = shift;
- return $pkgpath->grabPlist($pkgname, $arch, $code);
+ if ($_ eq '-') {
+ my $repository = OpenBSD::PackageRepository::Local::Pipe->_new('./');
+ my $plist = $repository->grabPlist(undef, $arch, $code);
+ return $plist;
+ }
+ $_.=".tgz" unless m/\.tgz$/;
+ my $plist;
+ if (m/\//) {
+ use File::Basename;
+
+ my ($pkgname, $path) = fileparse($_);
+ my $repository = OpenBSD::PackageRepository->new($path);
+ $plist = $repository->grabPlist($pkgname, $arch, $code);
+ if (defined $plist) {
+ $pkgpath->add($repository);
+ }
+ } else {
+ $plist = $pkgpath->grabPlist($_, $arch, $code);
+ }
+ return $plist;
}
1;