aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-12-15 17:02:21 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-12-15 17:02:21 +0000
commite0a98f3d0e05c3b50b514e54b30c5d5973e73926 (patch)
tree38252138734efe3ddfe8bc6df5f83559571b7bcb
parentf3859d8745f0eae79bd8eadc73753bb92b031212 (diff)
downloadperl-URPM-e0a98f3d0e05c3b50b514e54b30c5d5973e73926.tar
perl-URPM-e0a98f3d0e05c3b50b514e54b30c5d5973e73926.tar.gz
perl-URPM-e0a98f3d0e05c3b50b514e54b30c5d5973e73926.tar.bz2
perl-URPM-e0a98f3d0e05c3b50b514e54b30c5d5973e73926.tar.xz
perl-URPM-e0a98f3d0e05c3b50b514e54b30c5d5973e73926.zip
- fix sorting choices on provided version (feature introduced in 3.08,
but was not working if packages were coming from different repository)
-rw-r--r--NEWS3
-rw-r--r--URPM/Resolve.pm13
2 files changed, 12 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index ae93bda..579ddf5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- fix sorting choices on provided version (feature introduced in 3.08,
+ but was not working if packages were coming from different repository)
+
Version 3.23 - 12 December 2008, by Pascal "Pixel" Rigaux
- fix bad free() (thanks to glibc for detecting it)
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index 8c58c63..8e0d395 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -235,13 +235,12 @@ 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
- || URPM::rpmvercmp($b->[3], $a->[3]); #- and the highest provided version
+ || $b->[2] <=> $a->[2]; #- and the higher score
} map {
my $score = 0;
$score += 2 if $_->flag_requested;
$score += $_->flag_upgrade ? 1 : -1 if $_->flag_installed;
- [ $_, $_->is_arch_compat, $score, $provided_version->{$_} || 0 ];
+ [ $_, $_->is_arch_compat, $score ];
} @$packages;
my @chosen_with_score = ($best, grep { $_->[1] == $best->[1] && $_->[2] == $best->[2] } @other);
@@ -278,7 +277,13 @@ sub _find_required_package__sort {
# propose to select all packages for installed locales
my @prefered = grep { $_->[1] == 3 } @chosen_with_score;
- [ map { $_->[0] } @chosen_with_score ], [ map { $_->[0] } @prefered ];
+ @chosen = map { $_->[0] } @chosen_with_score;
+ if (%$provided_version) {
+ # highest provided version first
+ # (nb: this sort overrules the sort on media (cf ->id above))
+ @chosen = sort { URPM::rpmvercmp($provided_version->{$b} || 0, $provided_version->{$a} || 0) } @chosen;
+ }
+ \@chosen, [ map { $_->[0] } @prefered ];
}
#- prefer the pkgs corresponding to installed/selected kernels