summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-10-04 13:12:38 -0700
committerZac Medico <zmedico@gentoo.org>2010-10-04 13:12:38 -0700
commitaeb672bb1e841a1a4d3994f87f01a26dc92c8a59 (patch)
tree9872ceb7b27e6383332efe777de5b6f2f6e0b898 /pym
parent78d28f182fbe2b2618be4652763849d0fc289b16 (diff)
downloadportage-aeb672bb1e841a1a4d3994f87f01a26dc92c8a59.tar.gz
portage-aeb672bb1e841a1a4d3994f87f01a26dc92c8a59.tar.bz2
portage-aeb672bb1e841a1a4d3994f87f01a26dc92c8a59.zip
Optimize slot conflict backtracking for #337178.
This borrows logic from commit fc33f34e3d060b57e03204fb427b01971f8dafff which fixes bug #337178 in the 2.1.9 branch. With this change, BacktrackingTestCase.testBacktrackingGoodVersionFirst() is solved with fewer backtracking steps.
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/depgraph.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 82433e8d9..64a25ceb1 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -899,6 +899,19 @@ class depgraph(object):
parent_atoms = set()
backtrack_data.append((to_be_masked, parent_atoms))
+ # NOTE: Generally, we prefer to mask the higher
+ # version since this solves common cases in which a
+ # lower version is needed so that all dependencies
+ # will be satisfied (bug #337178). However, if
+ # existing_node happens to be installed then we
+ # mask that since this is a common case that is
+ # triggered when --update is not enabled.
+ if existing_node.installed:
+ pass
+ elif pkg > existing_node:
+ backtrack_data.reverse()
+ to_be_masked = backtrack_data[0][0]
+
self._dynamic_config._backtrack_infos["slot conflict"] = backtrack_data
self._dynamic_config._need_restart = True
if "--debug" in self._frozen_config.myopts:
@@ -908,6 +921,7 @@ class depgraph(object):
msg.append("backtracking due to slot conflict:")
msg.append(" first package: %s" % existing_node)
msg.append(" second package: %s" % pkg)
+ msg.append(" package to mask: %s" % to_be_masked)
msg.append(" slot: %s" % pkg.slot_atom)
msg.append(" parents: %s" % \
[(str(parent), atom) \