diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2016-01-30 11:29:30 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2016-01-30 11:29:30 +0000 |
commit | bebe9b404d63f0751e86627920c57e3de705b839 (patch) | |
tree | 314b1f24a6af03551694d8c9ee9f6a205e2cbe2b | |
parent | c7ed55b273b7104a9fb3ceaffcb40364b0c45e03 (diff) |
redo sthen's idea deeper in pkg_add, so that *every* url can be abbreviated
the same way (e.g., PKG_PATH=ftp.openbsd.org will work)
okay sthen@
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageLocator.pm | 3 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageRepository.pm | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm b/usr.sbin/pkg_add/OpenBSD/PackageLocator.pm index cfbbf18e1e5..81b4d416113 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.104 2016/01/27 20:49:45 sthen Exp $ +# $OpenBSD: PackageLocator.pm,v 1.105 2016/01/30 11:29:29 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -44,7 +44,6 @@ sub build_default_path return unless defined $state->config->value('installpath'); for my $i ($state->config->value("installpath")) { - $i =~ s/(^[a-z0-9][a-z0-9.]+\.[a-z0-9.]+$)/http:\/\/$1\/%m/; $default_path->add(OpenBSD::PackageRepository->new($i, $state)); } } diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm index af2cc70f434..36f9ab18dd2 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.114 2015/07/12 14:52:17 espie Exp $ +# $OpenBSD: PackageRepository.pm,v 1.115 2016/01/30 11:29:29 espie Exp $ # # Copyright (c) 2003-2010 Marc Espie <espie@openbsd.org> # @@ -123,6 +123,11 @@ sub parse } elsif ($u =~ m/^pipe\:$/io) { return $class->pipe->parse_fullurl($r, $state); } else { + if ($$r =~ m/^([a-z0-9][a-z0-9.]+\.[a-z0-9.]+)(\:|$)/ + && !-d $1) { + $$r =~ s//http:\/\/$1\/%m$2/; + return $class->http->parse_fullurl($r, $state); + } return $class->file->parse_fullurl($r, $state); } } |