diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2008-06-18 12:12:15 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2008-06-18 12:12:15 +0000 |
commit | 1938ea7bd2aa6fa41317440c5dfbad608667b56c (patch) | |
tree | b9dbc8377ca4707cf18658b241421825f5e5323f /usr.sbin | |
parent | 2137f66f26456d35e5f956ecfab03d898cd6a53c (diff) |
forgot: changed PackageLocator so that the new parse method is responsible
for breaking up the next part.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index 7eb9c1d624e..3a5c90864d2 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.54 2008/06/13 15:19:06 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.55 2008/06/18 12:12:14 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -62,6 +62,49 @@ sub new } } +sub todo +{ + my ($class, $ref) = @_; + my $s = $$ref; + return undef if $s eq ''; + + if ($$ref =~ m/^ftp\:(.*)$/io) { + return OpenBSD::PackageRepository::FTP->_parse($1, $ref); + } elsif ($$ref =~ m/^http\:(.*)$/io) { + return OpenBSD::PackageRepository::HTTP->_parse($1, $ref); + } elsif ($$ref =~ m/^https\:(.*)$/io) { + return OpenBSD::PackageRepository::HTTPS->_parse($1, $ref); + } elsif ($$ref =~ m/^scp\:(.*)$/io) { + require OpenBSD::PackageRepository::SCP; + + return OpenBSD::PackageRepository::SCP->_parse($1, $ref); + } elsif ($$ref =~ m/^src\:(.*)$/io) { + require OpenBSD::PackageRepository::Source; + + return OpenBSD::PackageRepository::Source->_parse($1, $ref); + } elsif ($$ref =~ m/^file\:(.*)$/io) { + return OpenBSD::PackageRepository::Local->_parse($1, $ref); + } elsif ($$ref =~ m/^inst\:(.*)$/io) { + return OpenBSD::PackageRepository::Installed->_parse($1, $ref); + } else { + return OpenBSD::PackageRepository::Local->_parse($$ref, $ref); + } +} + +sub parse +{ + my ($class, $ref) = @_; + my $s = $$ref; + return undef if !defined $s; + if ($s =~ m/(.*?)\/\:(.*)/) { + $$ref = $2; + return $class->new($1); + } else { + undef $$ref; + return $class->new($s); + } +} + sub available { my $self = shift; |