1 |
When disjunctive dependencies are queued, group together disjunctions |
2 |
from the same dependency string so that any overlap between them will |
3 |
trigger expansion to DNF. |
4 |
|
5 |
Bug: https://bugs.gentoo.org/701996 |
6 |
Signed-off-by: Zac Medico <zmedico@g.o> |
7 |
--- |
8 |
lib/_emerge/depgraph.py | 8 +++- |
9 |
.../test_virtual_minimize_children.py | 39 +++++++++++++++++++ |
10 |
2 files changed, 45 insertions(+), 2 deletions(-) |
11 |
|
12 |
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py |
13 |
index f80b077bc..78226a3ea 100644 |
14 |
--- a/lib/_emerge/depgraph.py |
15 |
+++ b/lib/_emerge/depgraph.py |
16 |
@@ -3850,10 +3850,11 @@ class depgraph(object): |
17 |
Yields non-disjunctive deps. Raises InvalidDependString when |
18 |
necessary. |
19 |
""" |
20 |
+ disjunctions = [] |
21 |
for x in dep_struct: |
22 |
if isinstance(x, list): |
23 |
if x and x[0] == "||": |
24 |
- self._queue_disjunction(pkg, dep_root, dep_priority, [x]) |
25 |
+ disjunctions.append(x) |
26 |
else: |
27 |
for y in self._queue_disjunctive_deps( |
28 |
pkg, dep_root, dep_priority, x): |
29 |
@@ -3863,10 +3864,13 @@ class depgraph(object): |
30 |
# or whatever other metadata gets implemented for this |
31 |
# purpose. |
32 |
if x.cp.startswith('virtual/'): |
33 |
- self._queue_disjunction(pkg, dep_root, dep_priority, [x]) |
34 |
+ disjunctions.append(x) |
35 |
else: |
36 |
yield x |
37 |
|
38 |
+ if disjunctions: |
39 |
+ self._queue_disjunction(pkg, dep_root, dep_priority, disjunctions) |
40 |
+ |
41 |
def _queue_disjunction(self, pkg, dep_root, dep_priority, dep_struct): |
42 |
self._dynamic_config._dep_disjunctive_stack.append( |
43 |
(pkg, dep_root, dep_priority, dep_struct)) |
44 |
diff --git a/lib/portage/tests/resolver/test_virtual_minimize_children.py b/lib/portage/tests/resolver/test_virtual_minimize_children.py |
45 |
index b566cb592..720fbe57b 100644 |
46 |
--- a/lib/portage/tests/resolver/test_virtual_minimize_children.py |
47 |
+++ b/lib/portage/tests/resolver/test_virtual_minimize_children.py |
48 |
@@ -285,3 +285,42 @@ class VirtualMinimizeChildrenTestCase(TestCase): |
49 |
finally: |
50 |
playground.debug = False |
51 |
playground.cleanup() |
52 |
+ |
53 |
+ |
54 |
+ def testVirtualWine(self): |
55 |
+ ebuilds = { |
56 |
+ 'virtual/wine-0-r6': { |
57 |
+ 'RDEPEND': '|| ( app-emulation/wine-staging app-emulation/wine-any ) ' |
58 |
+ '|| ( app-emulation/wine-vanilla app-emulation/wine-staging app-emulation/wine-any )' |
59 |
+ }, |
60 |
+ 'app-emulation/wine-staging-4': {}, |
61 |
+ 'app-emulation/wine-any-4': {}, |
62 |
+ 'app-emulation/wine-vanilla-4': {}, |
63 |
+ } |
64 |
+ |
65 |
+ test_cases = ( |
66 |
+ # Test bug 701996, where separate disjunctions where not |
67 |
+ # converted to DNF, causing both wine-vanilla and |
68 |
+ # wine-staging to be pulled in. |
69 |
+ ResolverPlaygroundTestCase( |
70 |
+ [ |
71 |
+ 'virtual/wine', |
72 |
+ ], |
73 |
+ success=True, |
74 |
+ mergelist=( |
75 |
+ 'app-emulation/wine-staging-4', |
76 |
+ 'virtual/wine-0-r6', |
77 |
+ ), |
78 |
+ ), |
79 |
+ ) |
80 |
+ |
81 |
+ playground = ResolverPlayground(debug=False, ebuilds=ebuilds) |
82 |
+ |
83 |
+ try: |
84 |
+ for test_case in test_cases: |
85 |
+ playground.run_TestCase(test_case) |
86 |
+ self.assertEqual(test_case.test_success, True, |
87 |
+ test_case.fail_msg) |
88 |
+ finally: |
89 |
+ playground.debug = False |
90 |
+ playground.cleanup() |
91 |
-- |
92 |
2.21.0 |