1 |
commit: ef125a7885f4f5a614265f3f8a97803f6a8c1264 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Mar 5 00:56:28 2013 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Mar 5 00:56:28 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ef125a78 |
7 |
|
8 |
Fix bug #460304. |
9 |
|
10 |
--- |
11 |
pym/_emerge/depgraph.py | 26 +++++++++++++++++++++++++ |
12 |
pym/portage/tests/resolver/test_slot_abi.py | 28 ++++++++++++++++++++++++++- |
13 |
2 files changed, 53 insertions(+), 1 deletions(-) |
14 |
|
15 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
16 |
index dddada0..9033285 100644 |
17 |
--- a/pym/_emerge/depgraph.py |
18 |
+++ b/pym/_emerge/depgraph.py |
19 |
@@ -1189,6 +1189,8 @@ class depgraph(object): |
20 |
for replacement_parent in self._iter_similar_available(dep.parent, |
21 |
dep.parent.slot_atom): |
22 |
|
23 |
+ selected_atoms = None |
24 |
+ |
25 |
for atom in replacement_parent.validated_atoms: |
26 |
if not atom.slot_operator == "=" or \ |
27 |
atom.blocker or \ |
28 |
@@ -1198,6 +1200,7 @@ class depgraph(object): |
29 |
# Discard USE deps, we're only searching for an approximate |
30 |
# pattern, and dealing with USE states is too complex for |
31 |
# this purpose. |
32 |
+ unevaluated_atom = atom.unevaluated_atom |
33 |
atom = atom.without_use |
34 |
|
35 |
if replacement_parent.built and \ |
36 |
@@ -1247,6 +1250,17 @@ class depgraph(object): |
37 |
# slot conflict). |
38 |
insignificant = True |
39 |
|
40 |
+ if not insignificant: |
41 |
+ # Evaluate USE conditionals and || deps, in order |
42 |
+ # to see if this atom is really desirable, since |
43 |
+ # otherwise we may trigger an undesirable rebuild |
44 |
+ # as in bug #460304. |
45 |
+ if selected_atoms is None: |
46 |
+ selected_atoms = self._select_atoms_probe( |
47 |
+ dep.child.root, replacement_parent) |
48 |
+ if unevaluated_atom not in selected_atoms: |
49 |
+ continue |
50 |
+ |
51 |
if debug: |
52 |
msg = [] |
53 |
msg.append("") |
54 |
@@ -1393,6 +1407,18 @@ class depgraph(object): |
55 |
|
56 |
return available_pkg is not None |
57 |
|
58 |
+ def _select_atoms_probe(self, root, pkg): |
59 |
+ selected_atoms = [] |
60 |
+ use = self._pkg_use_enabled(pkg) |
61 |
+ for k in pkg._dep_keys: |
62 |
+ v = pkg._metadata.get(k) |
63 |
+ if not v: |
64 |
+ continue |
65 |
+ selected_atoms.extend(self._select_atoms( |
66 |
+ root, v, myuse=use, parent=pkg)[pkg]) |
67 |
+ return frozenset(x.unevaluated_atom for |
68 |
+ x in selected_atoms) |
69 |
+ |
70 |
def _iter_similar_available(self, graph_pkg, atom): |
71 |
""" |
72 |
Given a package that's in the graph, do a rough check to |
73 |
|
74 |
diff --git a/pym/portage/tests/resolver/test_slot_abi.py b/pym/portage/tests/resolver/test_slot_abi.py |
75 |
index ca3662d..7263504 100644 |
76 |
--- a/pym/portage/tests/resolver/test_slot_abi.py |
77 |
+++ b/pym/portage/tests/resolver/test_slot_abi.py |
78 |
@@ -290,7 +290,33 @@ class SlotAbiTestCase(TestCase): |
79 |
["@world"], |
80 |
options = {"--update": True, "--deep": True}, |
81 |
success = True, |
82 |
- mergelist = ["net-misc/networkmanager-0.9.6.4-r1"]), |
83 |
+ mergelist = []), |
84 |
+ |
85 |
+ ) |
86 |
+ |
87 |
+ playground = ResolverPlayground(ebuilds=ebuilds, |
88 |
+ installed=installed, user_config=user_config, world=world, |
89 |
+ debug=False) |
90 |
+ try: |
91 |
+ for test_case in test_cases: |
92 |
+ playground.run_TestCase(test_case) |
93 |
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
94 |
+ finally: |
95 |
+ playground.cleanup() |
96 |
+ |
97 |
+ user_config = { |
98 |
+ "make.conf" : ("USE=\"-wimax\"",) |
99 |
+ } |
100 |
+ |
101 |
+ test_cases = ( |
102 |
+ |
103 |
+ # Demonstrate bug #460304 again, but with inverted USE |
104 |
+ # settings this time. |
105 |
+ ResolverPlaygroundTestCase( |
106 |
+ ["@world"], |
107 |
+ options = {"--update": True, "--deep": True}, |
108 |
+ success = True, |
109 |
+ mergelist = ['dev-libs/libnl-3.2.14', 'net-misc/networkmanager-0.9.6.4-r1']), |
110 |
|
111 |
) |