summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2010-09-20 08:25:37 +0200
committerZac Medico <zmedico@gentoo.org>2010-09-19 23:34:53 -0700
commit4bc78ab0b563697b98527eebcdfe474863383cf0 (patch)
tree68a44f3e39e7cb0933b6231841cfdd706af55229
parent146dea1276fcecb641ee57f080a4d8f2ccce1396 (diff)
downloadportage-4bc78ab0b563697b98527eebcdfe474863383cf0.tar.gz
portage-4bc78ab0b563697b98527eebcdfe474863383cf0.tar.bz2
portage-4bc78ab0b563697b98527eebcdfe474863383cf0.zip
Always mask the higher version when backtracking due to a slot conflict
-rw-r--r--pym/_emerge/depgraph.py14
-rw-r--r--pym/portage/tests/resolver/test_backtracking.py30
2 files changed, 40 insertions, 4 deletions
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py
index 529dd2ae9..9122232ff 100644
--- a/pym/_emerge/depgraph.py
+++ b/pym/_emerge/depgraph.py
@@ -906,21 +906,27 @@ class depgraph(object):
conflict_atoms = self._dynamic_config._slot_conflict_parent_atoms.intersection(parent_atoms)
if conflict_atoms:
parent_atoms = conflict_atoms
- if pkg >= existing_node:
+
+ if pkg > existing_node:
+ to_be_masked = pkg
+ else:
+ to_be_masked = existing_node
+
+ if pkg.cpv == existing_node.cpv:
# We only care about the parent atoms
# when they trigger a downgrade.
parent_atoms = set()
self._dynamic_config._runtime_pkg_mask.setdefault(
- existing_node, {})["slot conflict"] = parent_atoms
+ to_be_masked, {})["slot conflict"] = parent_atoms
self._dynamic_config._need_restart = True
if "--debug" in self._frozen_config.myopts:
msg = []
msg.append("")
msg.append("")
msg.append("backtracking due to slot conflict:")
- msg.append(" package: %s" % existing_node)
- msg.append(" slot: %s" % existing_node.slot_atom)
+ msg.append(" package: %s" % to_be_masked)
+ msg.append(" slot: %s" % to_be_masked.slot_atom)
msg.append(" parents: %s" % \
[(str(parent), atom) \
for parent, atom in parent_atoms])
diff --git a/pym/portage/tests/resolver/test_backtracking.py b/pym/portage/tests/resolver/test_backtracking.py
index d219c6bd5..91a739aaf 100644
--- a/pym/portage/tests/resolver/test_backtracking.py
+++ b/pym/portage/tests/resolver/test_backtracking.py
@@ -29,3 +29,33 @@ class BacktrackingTestCase(TestCase):
self.assertEqual(test_case.test_success, True, test_case.fail_msg)
finally:
playground.cleanup()
+
+ def testBacktrackingGoodVersionFirst(self):
+ """
+ When backtracking due to slot conflicts, we masked the version that has been pulled
+ in first. This is not always a good idea. Mask the highest version instead.
+ """
+
+ ebuilds = {
+ "dev-libs/A-1": { "DEPEND": "=dev-libs/C-1 dev-libs/B" },
+ "dev-libs/B-1": { "DEPEND": "=dev-libs/C-1" },
+ "dev-libs/B-2": { "DEPEND": "=dev-libs/C-2" },
+ "dev-libs/C-1": { },
+ "dev-libs/C-2": { },
+ }
+
+ test_cases = (
+ ResolverPlaygroundTestCase(
+ ["dev-libs/A"],
+ mergelist = ["dev-libs/C-1", "dev-libs/B-1", "dev-libs/A-1", ],
+ success = True),
+ )
+
+ playground = ResolverPlayground(ebuilds=ebuilds)
+
+ try:
+ for test_case in test_cases:
+ playground.run_TestCase(test_case)
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg)
+ finally:
+ playground.cleanup()