diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 24 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm | 30 |
2 files changed, 32 insertions, 22 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index 59f73bb4aac..1a6444c8d3f 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.71 2010/01/09 10:17:09 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.72 2010/01/09 10:44:41 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -30,13 +30,6 @@ our @ISA=(qw(OpenBSD::PackageRepositoryBase)); use OpenBSD::PackageLocation; use OpenBSD::Paths; -sub parse_url -{ - my ($class, $path) = @_; - $path .= '/' unless $path =~ m/\/$/; - bless { path => $path }, $class; -} - sub baseurl { my $self = shift; @@ -57,19 +50,6 @@ sub new # (relevant for file: url, where we strip, but don't care if we did # vs other schemes, where not having the ftp: marker is a problem) -sub strip_urlscheme -{ - my ($class, $r) = @_; - if ($$r =~ m/^(.*?)\:(.*)$/) { - my $scheme = lc($1); - if ($scheme eq $class->urlscheme) { - $$r = $2; - return 1; - } - } - return 0; -} - sub parse_fullurl { my ($class, $_) = @_; @@ -101,6 +81,8 @@ sub parse return OpenBSD::PackageRepository::Local->parse_fullurl($_); } elsif (m/^inst\:$/io) { return OpenBSD::PackageRepository::Installed->parse_fullurl($_); + } elsif (m/^pipe\:$/io) { + return OpenBSD::PackageRepository::Local::Pipe->parse_fullurl($_); } else { return OpenBSD::PackageRepository::Local->parse_fullurl($_); } diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm index 414d47ab6be..e25254b164e 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Installed.pm,v 1.16 2010/01/05 11:31:07 espie Exp $ +# $OpenBSD: Installed.pm,v 1.17 2010/01/09 10:44:42 espie Exp $ # # Copyright (c) 2007 Marc Espie <espie@openbsd.org> # @@ -26,6 +26,34 @@ use warnings; package OpenBSD::PackageRepositoryBase; +sub parse_url +{ + my ($class, $path) = @_; + $path .= '/' unless $path =~ m/\/$/; + bless { path => $path }, $class; +} + +sub parse_fullurl +{ + my ($class, $_) = @_; + + $class->strip_urlscheme(\$_) or return undef; + return $class->parse_url($_); +} + +sub strip_urlscheme +{ + my ($class, $r) = @_; + if ($$r =~ m/^(.*?)\:(.*)$/) { + my $scheme = lc($1); + if ($scheme eq $class->urlscheme) { + $$r = $2; + return 1; + } + } + return 0; +} + sub match_locations { my ($self, $search, @filters) = @_; |