From eab0b8fad2892d12aa3976678638db455a611e31 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 18 Jul 2013 11:54:18 +0200 Subject: adapt to perl-5.18's random hash keys ordering (translate_why_removed_one) ensure we got the right reason (testsuite) adapt to new URPM predictible behaviour it was previously relying on the following fixed hash order: $ perl -MData::Dumper -e 'warn Dumper [ keys {'rr1', 'rr1', 'rr2', 'rr2'} ]; \ warn Dumper [ keys {'bb1', 'bb1', 'bb2', 'bb2-1'} ]' $VAR1 = [ 'rr2', 'rr1' ]; $VAR1 = [ 'bb1', 'bb2' ]; --- NEWS | 1 + t/superuser--orphans.t | 4 ++-- urpm/select.pm | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index e6eaafbb..ca453190 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ - library: + o adapt to perl-5.18 o prevent disabling removing orphan if we failed to detect running kernel version diff --git a/t/superuser--orphans.t b/t/superuser--orphans.t index 68f10ff3..30c16477 100644 --- a/t/superuser--orphans.t +++ b/t/superuser--orphans.t @@ -57,11 +57,11 @@ test_auto_select_both('l', 'll', 'l-2 ll-1'); test_auto_select_both('m', 'mm', 'm-2 mm-2'); test_auto_select_both('n', 'nn', 'n-2 nn-2'); test_auto_select_both('o', 'oo1', 'o-2 oo2-2'); -test_auto_select_both('r', 'rr2', 'r-2', 'rr2-1'); +test_auto_select_both('r', 'rr1', 'r-2', 'rr1-1'); test_auto_select_both('s', 'ss1 ss2', 's-2 ss1-1 ss2-1'); test_auto_select_both('t', 'tt1', 't-2 tt2-2', 'tt1-1'); -test_auto_select(['r', 'rr1'], 'r rr1 rr2', 'r-2 rr1-1', 'rr2-1'); +test_auto_select(['r', 'rr2'], 'r rr1 rr2', 'r-2 rr2-1', 'rr1-1'); #test_auto_select(['s ss1'], 's ss1 ss2', 's-2 ss1-1', 'ss2-1'); # this fails, but that's ok test_urpme(['g'], 'g', 'g', ''); diff --git a/urpm/select.pm b/urpm/select.pm index 507f82c0..03259f71 100644 --- a/urpm/select.pm +++ b/urpm/select.pm @@ -694,7 +694,7 @@ sub translate_why_removed_one { my $closure = rejected_closure($state, $fullname) or return $fullname; my ($from) = keys %$closure; - my ($whyk) = keys %{$closure->{$from}}; + my ($whyk) = sort { $b ne 'avoid' } keys %{$closure->{$from}}; my $whyv = $closure->{$from}{$whyk}; my $frompkg = $urpm->search($from, strict_fullname => 1); my $s = do { -- cgit v1.2.1