diff options
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackageLocator.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageLocator.pm | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm index 52d4b6f888a..5e4f7264329 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.81 2010/01/09 11:26:58 espie Exp $ +# $OpenBSD: PackageLocator.pm,v 1.82 2010/01/09 12:01:57 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -45,20 +45,12 @@ if (defined $ENV{PKG_PATH}) { sub path_parse { - use File::Basename; - use OpenBSD::Paths; - my $pkg_db = $ENV{"PKG_DBDIR"} || OpenBSD::Paths->pkgdb; - - my ($pkgname, $path) = fileparse(shift); - my $repo; - - if ($path eq $pkg_db.'/') { - $repo = OpenBSD::PackageRepository::Installed->new; - } else { - $repo = OpenBSD::PackageRepository->new($path); + my ($pkgname, $path) = (shift, './'); + if ($pkgname =~ m/^(.*[\/\:])(.*)/) { + ($pkgname, $path) = ($2, $1); } - return ($repo, $path, $pkgname); + return (OpenBSD::PackageRepository->new($path), $path, $pkgname); } sub find @@ -69,7 +61,7 @@ sub find return $packages{$_}; } my $package; - if (m/\//o) { + if (m/[\/\:]/o) { my ($repository, undef, $pkgname) = path_parse($_); $package = $repository->find($pkgname, $arch); if (defined $package) { @@ -87,7 +79,7 @@ sub grabPlist my ($class, $_, $arch, $code) = @_; my $plist; - if (m/\//o) { + if (m/[\/\:]/o) { my ($repository, undef, $pkgname) = path_parse($_); $plist = $repository->grabPlist($pkgname, $arch, $code); if (defined $plist) { |