From 5cb38c21422b6b5ab63195e8dcba126bbc2a3b5c Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Mon, 23 Mar 2009 09:40:49 +0000 Subject: fix _handle_diff_provides in case of impossible-to-satisfy selected packages Fixes bug #48223, patch from Anssi Hannula Currently, if _handle_diff_provides finds unsatisfied requires on an already selected package, and cannot find any packages from the repo that satisfy these, it calls resolve_rejected_ (or set_rejected_and_compute_diff_provides after fix to bug #47803) (as it does when those unsatisfied requires are on an installed package, which was always the case before r242656). However, those should be called with installed packages only. Attached patch makes _handle_diff_provides call disable_selected_and_unrequested_dependencies and _set_rejected_from in case of selected packages. --- URPM/Resolve.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index f672a0d..182f224 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -554,8 +554,8 @@ sub with_state_unsatisfied_requires { sub with_any_unsatisfied_requires { my ($urpm, $db, $state, $name, $do) = @_; - with_db_unsatisfied_requires($urpm, $db, $state, $name, $do); - with_state_unsatisfied_requires($urpm, $db, $state, $name, $do); + with_db_unsatisfied_requires($urpm, $db, $state, $name, sub { my ($p, @l) = @_; $do->($p, 0, @l)}); + with_state_unsatisfied_requires($urpm, $db, $state, $name, sub { my ($p, @l) = @_; $do->($p, 1, @l)}); } @@ -1196,11 +1196,13 @@ sub _find_packages_obsoleting { #- side-effects: $properties #- + those of backtrack_selected_psel_keep ($state->{rejected}, $state->{selected}, $state->{whatrequires}, flag_requested, flag_required) #- + those of resolve_rejected_ ($state->{rejected}, $properties) +#- + those of disable_selected_and_unrequested_dependencies (flag_requested, flag_required, $state->{selected}, $state->{whatrequires}, $state->{rejected}) +#- + those of _set_rejected_from ($state->{rejected}) sub _handle_diff_provides { my ($urpm, $db, $state, $properties, $diff_provides, $n, $pkg, %options) = @_; with_any_unsatisfied_requires($urpm, $db, $state, $n, sub { - my ($p, @unsatisfied) = @_; + my ($p, $from_state, @unsatisfied) = @_; #- try if upgrading the package will be satisfying all the requires... #- there is no need to avoid promoting epoch as the package examined is not @@ -1235,7 +1237,10 @@ sub _handle_diff_provides { $urpm->{debug_URPM}("promoting " . join(' ', _ids_to_fullnames($urpm, @best)) . " because of conflict above") if $urpm->{debug_URPM}; push @$properties, map { +{ required => $_, promote => $n, psel => $pkg } } @best; } else { - if ($options{keep}) { + if ($from_state) { + disable_selected_and_unrequested_dependencies($urpm, $db, $state, $p); + _set_rejected_from($state, $p, $pkg); + } elsif ($options{keep}) { backtrack_selected_psel_keep($urpm, $db, $state, $pkg, [ scalar $p->fullname ]); } else { my %diff_provides_h; -- cgit v1.2.1