diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2011-06-30 12:54:45 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2011-06-30 12:54:45 +0000 |
commit | 293cd597381305dfa7c414ddf1b4f93b31a10a92 (patch) | |
tree | 64c7ab110b74f887318993bc615ab7eb4c0a7175 /usr.sbin/pkg_add | |
parent | 9d17cef4181c70ec8d28fdbaddfcccfb7a8bfcaf (diff) |
make exact flavor specs smarter.
problem reported by Jacek Masiulaniec
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/PkgSpec.pm | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm index 8e6a3006491..4ba2a7de820 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgSpec.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PkgSpec.pm,v 1.34 2010/12/24 09:04:14 espie Exp $ +# $OpenBSD: PkgSpec.pm,v 1.35 2011/06/30 12:54:44 espie Exp $ # # Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org> # @@ -59,10 +59,23 @@ sub match package OpenBSD::PkgSpec::exactflavor; our @ISA = qw(OpenBSD::PkgSpec::flavorspec); +sub new +{ + my ($class, $value) = @_; + $value =~ s/^\-//; + bless {map{($_, 1)} split(/\-/, $value)}, $class; +} + +sub flavor_string +{ + my $self = shift; + return join('-', sort keys %$self); +} + sub match { my ($self, $h) = @_; - if ($$self eq $h->flavor_string) { + if ($self->flavor_string eq $h->flavor_string) { return 1; } else { return 0; |