From 5a244e0774978fa8bf0a7f27871e695b2d31b13a Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Thu, 8 Jan 2009 09:24:23 +0000 Subject: Favour required packages when we have several choices to fulfill a "requires", fixes bug #46874 --- NEWS | 4 ++++ URPM/Resolve.pm | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/NEWS b/NEWS index 579ddf5..613d3b7 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ - fix sorting choices on provided version (feature introduced in 3.08, but was not working if packages were coming from different repository) +- when a "Requires:" can be fullfilled by several different packages and + one of those packages is explicitly required by another package which + is also being installed, silently choose this package instead of letting + the choice up to perl-URPM user (fixes bug #46874) Version 3.23 - 12 December 2008, by Pascal "Pixel" Rigaux diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 4d634dd..3593c3b 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -240,6 +240,16 @@ 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; -- cgit v1.2.1