summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-10-06 13:13:16 -0700
committerZac Medico <zmedico@gentoo.org>2010-10-06 13:13:16 -0700
commitbeeac7feedb90a9e93169390a4fa3116a0e247b6 (patch)
tree6cfa71e2e1a3fdb68ef6c38ac16b12aefd8c29d1
parent004fd4ac957fac9f3784d75026369373cabad1a0 (diff)
downloadportage-beeac7feedb90a9e93169390a4fa3116a0e247b6.tar.gz
portage-beeac7feedb90a9e93169390a4fa3116a0e247b6.tar.bz2
portage-beeac7feedb90a9e93169390a4fa3116a0e247b6.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 one less backtracking step.
-rw-r--r--pym/_emerge/depgraph.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 5ab42f68e..846d3ece5 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -924,6 +924,19 @@ class depgraph(object):
# behavior if this gets triggered somehow.
backtrack_data = fallback_data
+ if len(backtrack_data) > 1:
+ # 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[-1][0]
self._dynamic_config._backtrack_infos["slot conflict"] = backtrack_data