summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2003-10-31 18:42:52 +0000
committerMarc Espie <espie@cvs.openbsd.org>2003-10-31 18:42:52 +0000
commit190c30969c5e9b984ec47912e4026ea5a03f7165 (patch)
tree6d15f6cce18645cc0704de97dc82a21df6cba7be
parent4e361f08f00d721ff779c559d60ba23c129c1207 (diff)
put pkgpath back in correct order.
automatically append package location specified on the command line to pkgpath (reported by numerous people). okay sturm@
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageLocator.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index 0444bb6453b..d4734f05965 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
@@ -1,4 +1,4 @@
-# $OpenBSD: PackageLocator.pm,v 1.3 2003/10/23 23:18:55 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.4 2003/10/31 18:42:51 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -190,7 +190,7 @@ if (defined $ENV{PKG_PATH}) {
$i.= ":".(shift @tentative);
}
$i =~ m|/$| or $i.='/';
- unshift @pkgpath, OpenBSD::PackageLocation->new($i);
+ push @pkgpath, OpenBSD::PackageLocation->new($i);
}
} else {
@pkgpath=(OpenBSD::PackageLocation->new("./"));
@@ -206,8 +206,14 @@ sub find
}
my $package;
if (m/\//) {
- my $location = OpenBSD::PackageLocation->new($_);
- $package = openAbsolute($location, '');
+ use File::Basename;
+
+ my ($pkgname, $path) = fileparse($_);
+ my $location = OpenBSD::PackageLocation->new($path);
+ $package = openAbsolute($location, $pkgname);
+ if (defined $package) {
+ push(@pkgpath, $location);
+ }
} else {
for my $p (@pkgpath) {
$package = openAbsolute($p, $_);