From ec6cb173cc28f500e01f5acf8c8eb3e88c7adff0 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 18 Jun 2013 20:05:44 +0200 Subject: adapt to perl-5.18 random hash keys ordering thus fixing urpmi testsuite... --- NEWS | 4 ++++ URPM/Resolve.pm | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 1f55e38..8dc72cf 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +- adapt to perl-5.18 random hash keys ordering + now find_required_package() always sort matching packages by their names + before sorting them by arch and score + Version 4.27 - 22 March 2013 - fix selecting right DKMS flavor (mga#9172) diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 896fe50..4ad9e7c 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -81,7 +81,7 @@ sub find_candidate_packages { push @packages, $pkg; } elsif (my $name = property2name($_)) { my $property = $_; - foreach (keys %{$urpm->{provides}{$name} || {}}) { + foreach (sort keys %{$urpm->{provides}{$name} || {}}) { my $pkg = $urpm->{depslist}[$_]; $pkg->flag_skip and next; $pkg->is_arch_compat or next; @@ -231,7 +231,7 @@ sub find_required_package { } } } - my @packages = values %packages; + my @packages = sort { $a->fullname cmp $b->fullname } values %packages; if (@packages > 1) { #- packages should be preferred if one of their provides is referenced @@ -266,7 +266,8 @@ sub _find_required_package__sort { my ($best, @other) = sort { $a->[1] <=> $b->[1] #- we want the lowest (ie preferred arch) - || $b->[2] <=> $a->[2]; #- and the higher score + || $b->[2] <=> $a->[2] #- and the higher score + || $a->[0]->fullname cmp $b->[0]->fullname; #- then by name } map { my $score = 0; $score += 2 if $_->flag_requested; -- cgit v1.2.1