From d8bd601070a2db4e89d5364415814271b8771a21 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 24 Aug 2019 15:30:29 -0700 Subject: [PATCH] _slot_confict_backtrack: create backtrack node for a downgrade matched by all parent atoms (bug 692746) This currently causes the following unit test to fail due to slot conflicts that would be solved by downgrades: ====================================================================== FAIL: testSlotOperatorCompleteGraph (portage.tests.resolver.test_slot_operator_complete_graph.SlotOperatorCompleteGraphTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/portage/tests/__init__.py, line 211, in run testMethod() File "lib/portage/tests/resolver/test_slot_operator_complete_graph.py", line 137, in testSlotOperatorCompleteGraph test_case.fail_msg) AssertionError: False != True : atoms: (=app-misc/meta-pkg-2, app-misc/C), key: success, expected: True, got: False atoms: (=app-misc/meta-pkg-2, app-misc/C), key: slot_collision_solutions, expected: None, got: [] ====================================================================== FAIL: testSlotOperatorRuntimePkgMask (portage.tests.resolver.test_slot_operator_runtime_pkg_mask.SlotOperatorRuntimePkgMaskTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/portage/tests/__init__.py", line 211, in run testMethod() File "lib/portage/tests/resolver/test_slot_operator_runtime_pkg_mask.py", line 132, in testSlotOperatorRuntimePkgMask test_case.fail_msg) AssertionError: False != True : atoms: (=app-misc/meta-pkg-2), key: success, expected: True, got: False atoms: (=app-misc/meta-pkg-2), key: slot_collision_solutions, expected: None, got: [] ====================================================================== FAIL: testSonameSkipUpdate (portage.tests.resolver.soname.test_skip_update.SonameSkipUpdateTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "lib/portage/tests/__init__.py", line 211, in run testMethod() File "lib/portage/tests/resolver/soname/test_skip_update.py", line 82, in testSonameSkipUpdate test_case.fail_msg) AssertionError: False != True : atoms: (@world), key: success, expected: True, got: False atoms: (@world), key: mergelist, expected: [], got: ['[binary]dev-libs/B-1', '[binary]dev-libs/B-2', '[binary]app-misc/A-1'] atoms: (@world), key: slot_collision_solutions, expected: None, got: [] Bug: https://bugs.gentoo.org/692746 --- lib/_emerge/depgraph.py | 6 ++++++ lib/_emerge/resolver/backtracking.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 3e99ac077..7d8c89643 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -1771,6 +1771,12 @@ class depgraph(object): # In order to avoid a missed update, first mask lower versions # that conflict with higher versions (the backtracker visits # these in reverse order). + if (existing_node not in conflict_pkgs and + any(pkg > existing_node for pkg in conflict_pkgs)): + # Even though all parent atoms match existing_node, add it + # to conflict_pkgs in order to avoid a missed update for + # bug 692746. + conflict_pkgs.append(existing_node) conflict_pkgs.sort(reverse=True) backtrack_data = [] for to_be_masked in conflict_pkgs: diff --git a/lib/_emerge/resolver/backtracking.py b/lib/_emerge/resolver/backtracking.py index c29b9d42a..8cf5c6560 100644 --- a/lib/_emerge/resolver/backtracking.py +++ b/lib/_emerge/resolver/backtracking.py @@ -135,11 +135,16 @@ class Backtracker(object): continue entry_is_valid = False + any_parents = False for ppkg, patom in runtime_pkg_mask[pkg].get("slot conflict", set()): + any_parents = True if ppkg not in runtime_pkg_mask: entry_is_valid = True break + else: + if not any_parents: + entry_is_valid = True if not entry_is_valid: return False -- 2.21.0