summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2010-01-09 10:45:33 +0000
committerMarc Espie <espie@cvs.openbsd.org>2010-01-09 10:45:33 +0000
commit8bf87ff0e6f51524a4ca44fe5b34eb426142cb7f (patch)
treea8041e7f148cbc5c7de08b9828e19b0a1ea3dbe5 /usr.sbin/pkg_add
parentc6b405c968feb39c3f780484c36c7ec4ceee3c40 (diff)
tweak path parsing to handle inst:pkgname and such as well...
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/Update.pm4
-rw-r--r--usr.sbin/pkg_add/pkg_info4
3 files changed, 11 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm
index 0c9b3e2b850..d2ab5feaec7 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.78 2010/01/09 09:45:40 espie Exp $
+# $OpenBSD: PackageLocator.pm,v 1.79 2010/01/09 10:45:32 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -45,11 +45,13 @@ 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 ($pkgname, $path) = (shift, './');
+ if ($pkgname =~ m/^(.*[\/\:])(.*)/) {
+ ($pkgname, $path) = ($2, $1);
+ }
my $repo;
if ($path eq $pkg_db.'/') {
@@ -69,7 +71,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 +89,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) {
diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm
index 95001f90b7c..b9bd790c438 100644
--- a/usr.sbin/pkg_add/OpenBSD/Update.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Update.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Update.pm,v 1.127 2010/01/02 12:52:18 espie Exp $
+# $OpenBSD: Update.pm,v 1.128 2010/01/09 10:45:32 espie Exp $
#
# Copyright (c) 2004-2010 Marc Espie <espie@openbsd.org>
#
@@ -275,7 +275,7 @@ sub process_hint2
my ($self, $set, $hint, $state) = @_;
my $pkgname = $hint->pkgname;
if (OpenBSD::PackageName::is_stem($pkgname)) {
- if ($pkgname =~ m/\//o) {
+ if ($pkgname =~ m/[\/\:]/o) {
require OpenBSD::PackageLocator;
my $repo;
($repo, undef, $pkgname) = OpenBSD::PackageLocator::path_parse($pkgname);
diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info
index e20b23fc10d..9758048ac59 100644
--- a/usr.sbin/pkg_add/pkg_info
+++ b/usr.sbin/pkg_add/pkg_info
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_info,v 1.85 2010/01/08 17:06:00 espie Exp $
+# $OpenBSD: pkg_info,v 1.86 2010/01/09 10:45:32 espie Exp $
#
# Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org>
#
@@ -106,7 +106,7 @@ sub find_pkg
my ($repo, $path);
- if ($pkgname =~ m/\//o) {
+ if ($pkgname =~ m/[\/\:]/o) {
($repo, $path, $pkgname) =
OpenBSD::PackageLocator::path_parse($pkgname);
} else {