From: espie Date: Thu, 16 Apr 2015 14:08:19 +0000 (+0000) Subject: add %m as a shorthand, will expand to X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=99e1ceaee04e7963e25d333b35fb86e40d6b01ef;p=openbsd add %m as a shorthand, will expand to pub/OpenBSD/5.7/packages/amd64 for lazy typers. okay aja@ --- diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Installed.pm index de0dff231c3..4326816b420 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.31 2015/04/16 13:29:16 espie Exp $ +# $OpenBSD: Installed.pm,v 1.32 2015/04/16 14:08:19 espie Exp $ # # Copyright (c) 2007-2014 Marc Espie # @@ -38,6 +38,12 @@ sub expand_locations return OpenBSD::Paths->os_version; } elsif ($string eq '%c') { return OpenBSD::Paths->os_directory; + } elsif ($string eq '%m') { + return join('/', + 'pub/OpenBSD', + OpenBSD::Paths->os_directory, + 'packages', + OpenBSD::Paths->architecture); } } @@ -55,7 +61,7 @@ sub parse_url $$r = ''; } - $path =~ s/\%[vac]/$class->expand_locations($&, $state)/ge; + $path =~ s/\%[vacm]/$class->expand_locations($&, $state)/ge; $path .= '/' unless $path =~ m/\/$/; bless { path => $path, state => $state }, $class; }