From 8c4c9abb33c01c71834e6614b6dd16c23f53f069 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Fri, 12 Feb 2010 15:58:28 +0000 Subject: check for conflicting selected packages before selecting a package check for conflicting selected packages before selecting a package instead of after selecting it, to avoid having to unselect package in case of conflict (which incorrectly unselected packages with unsatisfied dependencies as well, making the following backtrack_selected call behave wrongly as it simply noticed that the package is no longer required) Here's the second patch again, now with the function comment updated and added _remove_all_rejected_from() call so that prerejections are still cleared (this was previously called from the removed disable_selected() call). Testsuites pass. Patch by Anssi Hannula, fixes #57224 --- NEWS | 3 +++ URPM/Resolve.pm | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 5c44487..857a34b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +- check for conflicting selected packages before selecting a package (#57224) + (by Anssi Hannula) + Version 3.33 - 5 October 2009, by Christophe Fergeau - fix lookup of existing pubkeys (#53710) (by Pascal Terjan) diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 4f8a9e1..3371991 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -968,6 +968,9 @@ sub resolve_requested__no_suggests_ { _no_more_recent_installed_and_providing($urpm, $db, $state, $pkg, $dep->{required}) or next; } } + + _handle_conflicts_with_selected($urpm, $db, $state, $pkg, $dep, \@properties, \@diff_provides, %options) or next; + $urpm->{debug_URPM}("selecting " . $pkg->fullname) if $urpm->{debug_URPM}; #- keep in mind the package has be selected, remove the entry in requested input hash, @@ -990,8 +993,6 @@ sub resolve_requested__no_suggests_ { _unselect_package_deprecated_by($urpm, $db, $state, \%diff_provides_h, $pkg); } - _handle_conflicts_with_selected($urpm, $db, $state, $pkg, $dep, \@properties, \@diff_provides, %options) or next; - #- all requires should be satisfied according to selected package, or installed packages. if (my @l = unsatisfied_requires($urpm, $db, $state, $pkg)) { $urpm->{debug_URPM}("requiring " . join(',', sort @l) . " for " . $pkg->fullname) if $urpm->{debug_URPM}; @@ -1045,7 +1046,7 @@ sub resolve_requested__no_suggests_ { #- unselects $pkg if such a package is already selected #- side-effects: #- + those of _set_rejected_from ($state->{rejected}) -#- + those of disable_selected (flag_requested, flag_required, $state->{selected}, $state->{rejected}, $state->{whatrequires}) +#- + those of _remove_all_rejected_from ($state->{rejected}) #- + those of backtrack_selected ($state->{backtrack}, $state->{rejected}, $state->{selected}, $state->{whatrequires}, flag_requested, flag_required) sub _handle_conflicts_with_selected { my ($urpm, $db, $state, $pkg, $dep, $properties, $diff_provides, %options) = @_; @@ -1056,7 +1057,7 @@ sub _handle_conflicts_with_selected { $p->provides_overlap($_) or next; if (exists $state->{selected}{$p->id}) { $urpm->{debug_URPM}($pkg->fullname . " conflicts with already selected package " . $p->fullname) if $urpm->{debug_URPM}; - disable_selected($urpm, $db, $state, $pkg); + _remove_all_rejected_from($state, $pkg); _set_rejected_from($state, $pkg, $p); unshift @$properties, backtrack_selected($urpm, $db, $state, $dep, $diff_provides, %options); return; -- cgit v1.2.1