From d1d666428ac197ed53d0af999ef1328c1a02c213 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 28 Jul 2009 13:13:04 +0000 Subject: keep psel/promote info and remove deadlocked pkg instead of aborting upgrade Patch from Anssi Hannula, fixes bug #52105 lib64gcj9 has to be removed (conflicts), therefore so does libgcj9-src (x86_64) that depends on it. Installed java-1.5.0-gcj-src depends on libgcj9-src, so perl-URPM tries to promote the i586 libgcj9-src for it. However, strict_arch check prohibits changing the arch, so it falls back to backtracking. Backtracking finds libgcj9-src again and tries to select it; however, it drops $dep->{psel} and $dep->{promote}, so when it fails again, perl-URPM does not know java-1.5.0-gcj-src should also be removed due to the failed promotion. This patch changes the code in backtrack_selected in two ways: 1) When a replacement package is found, keep {promote} and {psel} info, so that when backtrack_selected is run the second time it correctly handles the failed promotion. 2) When such a replacement fails as well and the deadlock protection is triggered, do not switch to keep mode for the package that caused the promotion (it would unselect all the packages involved in the update that caused the promotion). Instead proceed to remove it as usual. The patch introduces no failures on the urpmi testsuite. --- URPM/Resolve.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 801929b..1f23552 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -561,9 +561,7 @@ sub backtrack_selected { if (defined $dep->{required}) { #- avoid deadlock here... - if (exists $state->{backtrack}{deadlock}{$dep->{required}}) { - $options{keep} = 1; #- force keeping package to that backtrack is doing something. - } else { + if (!exists $state->{backtrack}{deadlock}{$dep->{required}}) { $state->{backtrack}{deadlock}{$dep->{required}} = undef; #- search for all possible packages, first is to try the selection, then if it is @@ -593,6 +591,8 @@ sub backtrack_selected { return { required => $_->id, exists $dep->{from} ? (from => $dep->{from}) : @{[]}, exists $dep->{requested} ? (requested => $dep->{requested}) : @{[]}, + exists $dep->{promote} ? (promote => $dep->{promote}) : @{[]}, + exists $dep->{psel} ? (psel => $dep->{psel}) : @{[]}, }; } } -- cgit v1.2.1