diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-02-20 19:11:29 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-02-20 19:11:29 +0000 |
commit | 78ea5c3b5be8cd7dd18030bccee9f9b5f25c7d1a (patch) | |
tree | 745a4aa0be92c8c7a5d9c49b3446fe8afd4ac29d /usr.sbin/pkg_add/OpenBSD/PackageName.pm | |
parent | e26ef121e3f913552b83b25f2cb07562e5cc0755 (diff) |
move wildcard rewriting down. Allows flavors in package-specs to
properly contain a dot and other fun characters.
Reported by Jason Ish. Survives a full ports build.
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD/PackageName.pm')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PackageName.pm | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm index 6ae90dac660..f6ff3e90cc8 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm @@ -1,4 +1,4 @@ -# $OpenBSD: PackageName.pm,v 1.3 2003/11/06 17:47:25 espie Exp $ +# $OpenBSD: PackageName.pm,v 1.4 2004/02/20 19:11:28 espie Exp $ # # Copyright (c) 2003 Marc Espie. # @@ -223,11 +223,6 @@ sub subpattern_match my ($stemspec, $vspec, $flavorspec); - # first, handle special characters (shell -> perl) - $p =~ s/\./\\\./g; - $p =~ s/\+/\\\+/g; - $p =~ s/\*/\.\*/g; - $p =~ s/\?/\./g; # then, guess at where the version number is if any, @@ -238,14 +233,24 @@ sub subpattern_match if ($p =~ m/\-((?:\>|\>\=|\<|\<\=)?\d[^-]*)/) { ($stemspec, $vspec, $flavorspec) = ($`, $1, $'); # `any version' matcher - } elsif ($p =~ m/\-(\.\*)/) { - ($stemspec, $vspec, $flavorspec) = ($`, $1, $'); + } elsif ($p =~ m/\-\*/) { + ($stemspec, $vspec, $flavorspec) = ($`, '*', $'); # okay, so no version marker. Assume no flavor spec. } else { ($stemspec, $vspec, $flavorspec) = ($p, '', ''); } - $p = "$stemspec-\.\*" if $vspec ne ''; + $stemspec =~ s/\./\\\./g; + $stemspec =~ s/\+/\\\+/g; + $stemspec =~ s/\*/\.\*/g; + $stemspec =~ s/\?/\./g; + $vspec =~ s/\./\\\./g; + $vspec =~ s/\+/\\\+/g; + $vspec =~ s/\*/\.\*/g; + $vspec =~ s/\?/\./g; + + $p = $stemspec; + $p.="-.*" if $vspec ne ''; # First trim down the list my @l = grep {/^$p$/} @$list; |