From ef125a7885f4f5a614265f3f8a97803f6a8c1264 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 4 Mar 2013 16:56:28 -0800 Subject: [PATCH] Fix bug #460304. --- pym/_emerge/depgraph.py | 26 +++++++++++++++++++ pym/portage/tests/resolver/test_slot_abi.py | 28 ++++++++++++++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index dddada072..90332851a 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -1189,6 +1189,8 @@ class depgraph(object): for replacement_parent in self._iter_similar_available(dep.parent, dep.parent.slot_atom): + selected_atoms = None + for atom in replacement_parent.validated_atoms: if not atom.slot_operator == "=" or \ atom.blocker or \ @@ -1198,6 +1200,7 @@ class depgraph(object): # Discard USE deps, we're only searching for an approximate # pattern, and dealing with USE states is too complex for # this purpose. + unevaluated_atom = atom.unevaluated_atom atom = atom.without_use if replacement_parent.built and \ @@ -1247,6 +1250,17 @@ class depgraph(object): # slot conflict). insignificant = True + if not insignificant: + # Evaluate USE conditionals and || deps, in order + # to see if this atom is really desirable, since + # otherwise we may trigger an undesirable rebuild + # as in bug #460304. + if selected_atoms is None: + selected_atoms = self._select_atoms_probe( + dep.child.root, replacement_parent) + if unevaluated_atom not in selected_atoms: + continue + if debug: msg = [] msg.append("") @@ -1393,6 +1407,18 @@ class depgraph(object): return available_pkg is not None + def _select_atoms_probe(self, root, pkg): + selected_atoms = [] + use = self._pkg_use_enabled(pkg) + for k in pkg._dep_keys: + v = pkg._metadata.get(k) + if not v: + continue + selected_atoms.extend(self._select_atoms( + root, v, myuse=use, parent=pkg)[pkg]) + return frozenset(x.unevaluated_atom for + x in selected_atoms) + def _iter_similar_available(self, graph_pkg, atom): """ Given a package that's in the graph, do a rough check to diff --git a/pym/portage/tests/resolver/test_slot_abi.py b/pym/portage/tests/resolver/test_slot_abi.py index ca3662d6d..7263504b8 100644 --- a/pym/portage/tests/resolver/test_slot_abi.py +++ b/pym/portage/tests/resolver/test_slot_abi.py @@ -290,7 +290,33 @@ class SlotAbiTestCase(TestCase): ["@world"], options = {"--update": True, "--deep": True}, success = True, - mergelist = ["net-misc/networkmanager-0.9.6.4-r1"]), + mergelist = []), + + ) + + playground = ResolverPlayground(ebuilds=ebuilds, + installed=installed, user_config=user_config, world=world, + debug=False) + 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() + + user_config = { + "make.conf" : ("USE=\"-wimax\"",) + } + + test_cases = ( + + # Demonstrate bug #460304 again, but with inverted USE + # settings this time. + ResolverPlaygroundTestCase( + ["@world"], + options = {"--update": True, "--deep": True}, + success = True, + mergelist = ['dev-libs/libnl-3.2.14', 'net-misc/networkmanager-0.9.6.4-r1']), ) -- 2.26.2