aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2009-01-16 14:48:19 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2009-01-16 14:48:19 +0000
commite412f58a577a8ad552a105ef5b1160fb0e9c78dd (patch)
treefaeebe3763b3a497c54f918c1ee899743f375ea2
parent8cd50d4451ce571b275117e550a1506966d4133d (diff)
downloadperl-URPM-e412f58a577a8ad552a105ef5b1160fb0e9c78dd.tar
perl-URPM-e412f58a577a8ad552a105ef5b1160fb0e9c78dd.tar.gz
perl-URPM-e412f58a577a8ad552a105ef5b1160fb0e9c78dd.tar.bz2
perl-URPM-e412f58a577a8ad552a105ef5b1160fb0e9c78dd.tar.xz
perl-URPM-e412f58a577a8ad552a105ef5b1160fb0e9c78dd.zip
Really fix bug #46874
-rw-r--r--NEWS2
-rw-r--r--URPM/Resolve.pm28
2 files changed, 20 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index 359214f..4130501 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- previous fix for bug #46874 was bogus, really fix it this time
+
Version 3.24 - 13 January 2009, by Christophe Fergeau
- fix sorting choices on provided version (feature introduced in 3.08,
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index ef4f13b..0cf96c3 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -240,16 +240,6 @@ sub find_required_package {
_set_flag_installed_and_upgrade_if_no_newer($db, $pkg);
}
- #- if another package requires one of the potential candidates,
- #- we select this candidate instead of keeping all the
- #- other packages.
- foreach my $pkg (@packages) {
- exists $state->{whatrequires}->{$pkg->name} or next;
- $urpm->{debug_URPM}("forcing use of " . $pkg->name . " for $id_prop because " . join(", ", map { $urpm->{depslist}[$_]->name } keys %{$state->{whatrequires}->{$pkg->name}}) . " require(s) it") if $urpm->{debug_URPM};
-
- return [ $pkg ];
- }
-
if (my @kernel_source = _find_required_package__kernel_source($urpm, $db, \@packages)) {
$urpm->{debug_URPM}("packageCallbackChoices: kernel source chosen " . join(",", map { $_->name } @kernel_source) . " in " . join(",", map { $_->name } @packages)) if $urpm->{debug_URPM};
return \@kernel_source, \@kernel_source;
@@ -399,6 +389,23 @@ sub _choose_required {
#- take the best choice possible.
my ($chosen, $prefered) = find_required_package($urpm, $db, $state, $dep->{required});
+ if ((@$chosen > 1) && ($dep->{from})) {
+ #- if another package requires one of the potential candidates,
+ #- we select this candidate instead of keeping all the
+ #- other packages.
+ foreach my $pkg (@$chosen) {
+ #- get list of packages that requires something provided by $pkg
+ my @requiring_pkg = grep { exists $state->{whatrequires}->{$_} } $pkg->provides_nosense;
+ foreach (@requiring_pkg) {
+ my @requires_from_elsewhere = grep { $_->name ne $dep->{from}->name } whatrequires($urpm, $state, $_) or next;
+
+ $urpm->{debug_URPM}("forcing use of " . $pkg->name . " for $dep->{required} because " . join(", ", map { $_->name } @requires_from_elsewhere) . " require(s) it") if $urpm->{debug_URPM};
+ @$chosen = $pkg;
+ undef $prefered;
+ }
+ }
+ }
+
#- If no choice is found, this means that nothing can be possibly selected
#- according to $dep, so we need to retry the selection, allowing all
#- packages that conflict or anything similar to see which strategy can be
@@ -424,6 +431,7 @@ sub _choose_required {
return; #- always redo according to choices.
}
+
#- now do the real work, select the package.
my $pkg = shift @$chosen;
if ($urpm->{debug_URPM} && $pkg->name ne _dep_to_name($urpm, $dep)) {