1 |
Bug: https://bugs.gentoo.org/689226 |
2 |
Signed-off-by: Zac Medico <zmedico@g.o> |
3 |
--- |
4 |
lib/_emerge/depgraph.py | 23 ++++-- |
5 |
lib/portage/tests/resolver/test_blocker.py | 87 +++++++++++++++++++++- |
6 |
2 files changed, 102 insertions(+), 8 deletions(-) |
7 |
|
8 |
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py |
9 |
index 68b5bdb2e..c4c813f7c 100644 |
10 |
--- a/lib/_emerge/depgraph.py |
11 |
+++ b/lib/_emerge/depgraph.py |
12 |
@@ -2799,8 +2799,7 @@ class depgraph(object): |
13 |
# blocker validation is only able to account for one package per slot. |
14 |
is_slot_conflict_parent = any(dep.parent in conflict.pkgs[1:] for conflict in \ |
15 |
self._dynamic_config._package_tracker.slot_conflicts()) |
16 |
- if not buildpkgonly and \ |
17 |
- not nodeps and \ |
18 |
+ if not nodeps and \ |
19 |
not dep.collapsed_priority.ignored and \ |
20 |
not dep.collapsed_priority.optional and \ |
21 |
not is_slot_conflict_parent: |
22 |
@@ -6805,8 +6804,7 @@ class depgraph(object): |
23 |
for depclean and prune removal operations) |
24 |
@type required_sets: dict |
25 |
""" |
26 |
- if "--buildpkgonly" in self._frozen_config.myopts or \ |
27 |
- "recurse" not in self._dynamic_config.myparams: |
28 |
+ if "recurse" not in self._dynamic_config.myparams: |
29 |
return 1 |
30 |
|
31 |
complete_if_new_use = self._dynamic_config.myparams.get( |
32 |
@@ -7061,8 +7059,7 @@ class depgraph(object): |
33 |
# has been called before it, by checking that it is not None. |
34 |
self._dynamic_config._blocked_pkgs = digraph() |
35 |
|
36 |
- if "--buildpkgonly" in self._frozen_config.myopts or \ |
37 |
- "--nodeps" in self._frozen_config.myopts: |
38 |
+ if "--nodeps" in self._frozen_config.myopts: |
39 |
return True |
40 |
|
41 |
if True: |
42 |
@@ -7338,6 +7335,10 @@ class depgraph(object): |
43 |
# so apparently this one is unresolvable. |
44 |
unresolved_blocks = True |
45 |
|
46 |
+ if "--buildpkgonly" in self._frozen_config.myopts and not ( |
47 |
+ blocker.priority.buildtime and blocker.atom.blocker.overlap.forbid): |
48 |
+ depends_on_order.clear() |
49 |
+ |
50 |
# Make sure we don't unmerge any package that have been pulled |
51 |
# into the graph. |
52 |
if not unresolved_blocks and depends_on_order: |
53 |
@@ -8292,9 +8293,17 @@ class depgraph(object): |
54 |
retlist.extend(unsolvable_blockers) |
55 |
retlist = tuple(retlist) |
56 |
|
57 |
+ buildtime_blockers = [] |
58 |
+ if unsolvable_blockers and "--buildpkgonly" in self._frozen_config.myopts: |
59 |
+ for blocker in unsolvable_blockers: |
60 |
+ if blocker.priority.buildtime and blocker.atom.blocker.overlap.forbid: |
61 |
+ buildtime_blockers.append(blocker) |
62 |
+ |
63 |
if unsolvable_blockers and \ |
64 |
+ not buildtime_blockers and \ |
65 |
not self._accept_blocker_conflicts(): |
66 |
- self._dynamic_config._unsatisfied_blockers_for_display = unsolvable_blockers |
67 |
+ self._dynamic_config._unsatisfied_blockers_for_display = (tuple(buildtime_blockers) |
68 |
+ if buildtime_blockers else unsolvable_blockers) |
69 |
self._dynamic_config._serialized_tasks_cache = retlist |
70 |
self._dynamic_config._scheduler_graph = scheduler_graph |
71 |
# Blockers don't trigger the _skip_restart flag, since |
72 |
diff --git a/lib/portage/tests/resolver/test_blocker.py b/lib/portage/tests/resolver/test_blocker.py |
73 |
index 94a88b8b4..6534f99e6 100644 |
74 |
--- a/lib/portage/tests/resolver/test_blocker.py |
75 |
+++ b/lib/portage/tests/resolver/test_blocker.py |
76 |
@@ -1,4 +1,4 @@ |
77 |
-# Copyright 2014 Gentoo Foundation |
78 |
+# Copyright 2014-2019 Gentoo Authors |
79 |
# Distributed under the terms of the GNU General Public License v2 |
80 |
|
81 |
from portage.tests import TestCase |
82 |
@@ -46,3 +46,88 @@ class SlotConflictWithBlockerTestCase(TestCase): |
83 |
self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
84 |
finally: |
85 |
playground.cleanup() |
86 |
+ |
87 |
+ def testBlockerBuildpkgonly(self): |
88 |
+ ebuilds = { |
89 |
+ 'dev-libs/A-1': { |
90 |
+ 'EAPI': '7', |
91 |
+ 'DEPEND': '!!dev-libs/X' |
92 |
+ }, |
93 |
+ |
94 |
+ 'dev-libs/B-1': { |
95 |
+ 'EAPI': '7', |
96 |
+ 'BDEPEND': '!!dev-libs/X' |
97 |
+ }, |
98 |
+ |
99 |
+ 'dev-libs/C-1': { |
100 |
+ 'EAPI': '7', |
101 |
+ 'BDEPEND': '!dev-libs/X' |
102 |
+ }, |
103 |
+ |
104 |
+ 'dev-libs/D-1': { |
105 |
+ 'EAPI': '7', |
106 |
+ 'DEPEND': '!dev-libs/X' |
107 |
+ }, |
108 |
+ |
109 |
+ 'dev-libs/E-1': { |
110 |
+ 'EAPI': '7', |
111 |
+ 'RDEPEND': '!dev-libs/X !!dev-libs/X' |
112 |
+ }, |
113 |
+ |
114 |
+ 'dev-libs/F-1': { |
115 |
+ 'EAPI': '7', |
116 |
+ 'PDEPEND': '!dev-libs/X !!dev-libs/X' |
117 |
+ }, |
118 |
+ } |
119 |
+ |
120 |
+ installed = { |
121 |
+ 'dev-libs/X-1': {}, |
122 |
+ } |
123 |
+ |
124 |
+ test_cases = ( |
125 |
+ ResolverPlaygroundTestCase( |
126 |
+ ['dev-libs/A'], |
127 |
+ success = False, |
128 |
+ options = {'--buildpkgonly': True}, |
129 |
+ mergelist = ['dev-libs/A-1', '!!dev-libs/X']), |
130 |
+ |
131 |
+ ResolverPlaygroundTestCase( |
132 |
+ ['dev-libs/B'], |
133 |
+ success = False, |
134 |
+ options = {'--buildpkgonly': True}, |
135 |
+ mergelist = ['dev-libs/B-1', '!!dev-libs/X']), |
136 |
+ |
137 |
+ ResolverPlaygroundTestCase( |
138 |
+ ['dev-libs/C'], |
139 |
+ success = True, |
140 |
+ options = {'--buildpkgonly': True}, |
141 |
+ mergelist = ['dev-libs/C-1']), |
142 |
+ |
143 |
+ ResolverPlaygroundTestCase( |
144 |
+ ['dev-libs/D'], |
145 |
+ success = True, |
146 |
+ options = {'--buildpkgonly': True}, |
147 |
+ mergelist = ['dev-libs/D-1']), |
148 |
+ |
149 |
+ ResolverPlaygroundTestCase( |
150 |
+ ['dev-libs/E'], |
151 |
+ success = True, |
152 |
+ options = {'--buildpkgonly': True}, |
153 |
+ mergelist = ['dev-libs/E-1']), |
154 |
+ |
155 |
+ ResolverPlaygroundTestCase( |
156 |
+ ['dev-libs/F'], |
157 |
+ success = True, |
158 |
+ options = {'--buildpkgonly': True}, |
159 |
+ mergelist = ['dev-libs/F-1']), |
160 |
+ ) |
161 |
+ |
162 |
+ playground = ResolverPlayground(ebuilds=ebuilds, |
163 |
+ installed=installed, debug=False) |
164 |
+ try: |
165 |
+ for test_case in test_cases: |
166 |
+ playground.run_TestCase(test_case) |
167 |
+ self.assertEqual(test_case.test_success, True, test_case.fail_msg) |
168 |
+ finally: |
169 |
+ playground.debug = False |
170 |
+ playground.cleanup() |
171 |
-- |
172 |
2.21.0 |