summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-05-17 12:07:47 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-05-17 12:07:47 +0000
commit39ff487b5ad7616c7c1dc9cc499d28225f6a05f7 (patch)
treee4ac8a0d3a51907e6f2891b0f243034286cf90aa
parentcbd309e77fc41340ffd6f8e839ebece2430d0060 (diff)
handle normalization of flavors in PackageName objects.
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageName.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageName.pm b/usr.sbin/pkg_add/OpenBSD/PackageName.pm
index 76da6462f3d..d588375c250 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageName.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageName.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageName.pm,v 1.26 2007/05/14 11:02:14 espie Exp $
+# $OpenBSD: PackageName.pm,v 1.27 2007/05/17 12:07:46 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -51,10 +51,11 @@ sub from_string
my $rest = $';
my @all = split /\-/, $rest;
my $version = OpenBSD::PackageName::version->from_string(shift @all);
+ my %flavors = map {($_,1)} @all;
return bless {
stem => $stem,
version => $version,
- flavors => \@all
+ flavors => \%flavors,
}, "OpenBSD::PackageName::Name";
} else {
return bless {
@@ -312,13 +313,13 @@ package OpenBSD::PackageName::Name;
sub to_string
{
my $o = shift;
- return join('-', $o->{stem}, $o->{version}->to_string, @{$o->{flavors}});
+ return join('-', $o->{stem}, $o->{version}->to_string, sort keys %{$o->{flavors}});
}
sub to_pattern
{
my $o = shift;
- return join('-', $o->{stem}, '*', @{$o->{flavors}});
+ return join('-', $o->{stem}, '*', sort keys %{$o->{flavors}});
}
1;