1 |
It's useful to enable --with-bdeps by default so that @world updates |
2 |
will update all packages that are not eligible for removal by |
3 |
emerge --depclean. However, many users of binary packages do not want |
4 |
unnecessary build time dependencies installed, therefore do not |
5 |
auto-enable --with-bdeps for installation actions when the --usepkg |
6 |
option is enabled. |
7 |
|
8 |
X-Gentoo-bug: 598444 |
9 |
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=598444 |
10 |
--- |
11 |
man/emerge.1 | 18 ++- |
12 |
pym/_emerge/create_depgraph_params.py | 4 + |
13 |
pym/_emerge/depgraph.py | 4 +- |
14 |
pym/portage/tests/resolver/ResolverPlayground.py | 5 + |
15 |
pym/portage/tests/resolver/test_bdeps.py | 197 +++++++++++++++++++++++ |
16 |
5 files changed, 223 insertions(+), 5 deletions(-) |
17 |
create mode 100644 pym/portage/tests/resolver/test_bdeps.py |
18 |
|
19 |
diff --git a/man/emerge.1 b/man/emerge.1 |
20 |
index 5b61220..970bb5b 100644 |
21 |
--- a/man/emerge.1 |
22 |
+++ b/man/emerge.1 |
23 |
@@ -986,9 +986,21 @@ The default is set to "y" (on). |
24 |
.TP |
25 |
.BR "\-\-with\-bdeps < y | n >" |
26 |
In dependency calculations, pull in build time dependencies |
27 |
-that are not strictly required. This defaults to \'n\' for |
28 |
-installation actions, meaning they will not be installed, and |
29 |
-\'y\' for the \fB\-\-depclean\fR action, meaning they will not be removed. |
30 |
+that are not strictly required. This option is enabled automatically for |
31 |
+installation actions, meaning they will be installed, and is also enabled |
32 |
+automatically for the \fB\-\-depclean\fR action, meaning they will not be |
33 |
+removed. In order to prevent this option from being enabled automatically, |
34 |
+\fB\-\-with-bdeps=n\fR must be specified either in the command line or |
35 |
+via \fBEMERGE_DEFAULT_OPTS\fR. |
36 |
+ |
37 |
+Since many users of binary packages do not want unnecessary build time |
38 |
+dependencies installed, this option is not enabled automatically for |
39 |
+installation actions when the \fB\-\-usepkg\fR option is enabled. In |
40 |
+order to pull in build time dependencies for binary packages with |
41 |
+\fB\-\-usepkg\fR, \fB\-\-with-bdeps=y\fR must be specified explicitly. |
42 |
+This also applies to options that enable the \fB\-\-usepkg\fR option |
43 |
+implicitly, such as \fB\-\-getbinpkg\fR. |
44 |
+ |
45 |
This setting can be added to |
46 |
\fBEMERGE_DEFAULT_OPTS\fR (see make.conf(5)) and later overridden via the |
47 |
command line. |
48 |
diff --git a/pym/_emerge/create_depgraph_params.py b/pym/_emerge/create_depgraph_params.py |
49 |
index 2c64928..676aac5 100644 |
50 |
--- a/pym/_emerge/create_depgraph_params.py |
51 |
+++ b/pym/_emerge/create_depgraph_params.py |
52 |
@@ -13,6 +13,8 @@ def create_depgraph_params(myopts, myaction): |
53 |
# deep: go into the dependencies of already merged packages |
54 |
# empty: pretend nothing is merged |
55 |
# complete: completely account for all known dependencies |
56 |
+ # bdeps: satisfy build time dependencies of packages that are |
57 |
+ # already built, even though they are not strictly required |
58 |
# remove: build graph for use in removing packages |
59 |
# rebuilt_binaries: replace installed packages with rebuilt binaries |
60 |
# rebuild_if_new_slot: rebuild or reinstall packages when |
61 |
@@ -32,6 +34,8 @@ def create_depgraph_params(myopts, myaction): |
62 |
bdeps = myopts.get("--with-bdeps") |
63 |
if bdeps is not None: |
64 |
myparams["bdeps"] = bdeps |
65 |
+ elif myaction == "remove" or "--usepkg" not in myopts: |
66 |
+ myparams["bdeps"] = "auto" |
67 |
|
68 |
ignore_built_slot_operator_deps = myopts.get("--ignore-built-slot-operator-deps") |
69 |
if ignore_built_slot_operator_deps is not None: |
70 |
diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py |
71 |
index ce0fde1..02a3226 100644 |
72 |
--- a/pym/_emerge/depgraph.py |
73 |
+++ b/pym/_emerge/depgraph.py |
74 |
@@ -2362,7 +2362,7 @@ class depgraph(object): |
75 |
if ebuild is None: |
76 |
changed = False |
77 |
else: |
78 |
- if self._dynamic_config.myparams.get("bdeps", "n") == "y": |
79 |
+ if self._dynamic_config.myparams.get("bdeps") in ("y", "auto"): |
80 |
depvars = Package._dep_keys |
81 |
else: |
82 |
depvars = Package._runtime_keys |
83 |
@@ -2998,7 +2998,7 @@ class depgraph(object): |
84 |
|
85 |
ignore_build_time_deps = False |
86 |
if pkg.built and not removal_action: |
87 |
- if self._dynamic_config.myparams.get("bdeps", "n") == "y": |
88 |
+ if self._dynamic_config.myparams.get("bdeps") in ("y", "auto"): |
89 |
# Pull in build time deps as requested, but marked them as |
90 |
# "optional" since they are not strictly required. This allows |
91 |
# more freedom in the merge order calculation for solving |
92 |
diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/portage/tests/resolver/ResolverPlayground.py |
93 |
index d1434f7..d803719 100644 |
94 |
--- a/pym/portage/tests/resolver/ResolverPlayground.py |
95 |
+++ b/pym/portage/tests/resolver/ResolverPlayground.py |
96 |
@@ -558,6 +558,7 @@ class ResolverPlaygroundTestCase(object): |
97 |
def __init__(self, request, **kwargs): |
98 |
self.all_permutations = kwargs.pop("all_permutations", False) |
99 |
self.ignore_mergelist_order = kwargs.pop("ignore_mergelist_order", False) |
100 |
+ self.ignore_cleanlist_order = kwargs.pop("ignore_cleanlist_order", False) |
101 |
self.ambiguous_merge_order = kwargs.pop("ambiguous_merge_order", False) |
102 |
self.ambiguous_slot_collision_solutions = kwargs.pop("ambiguous_slot_collision_solutions", False) |
103 |
self.check_repo_names = kwargs.pop("check_repo_names", False) |
104 |
@@ -675,6 +676,10 @@ class ResolverPlaygroundTestCase(object): |
105 |
str((node1, node2))) + \ |
106 |
", got: " + str(got)) |
107 |
|
108 |
+ elif key == "cleanlist" and self.ignore_cleanlist_order: |
109 |
+ got = set(got) |
110 |
+ expected = set(expected) |
111 |
+ |
112 |
elif key == "slot_collision_solutions" and \ |
113 |
self.ambiguous_slot_collision_solutions: |
114 |
# Tests that use all_permutations can have multiple |
115 |
diff --git a/pym/portage/tests/resolver/test_bdeps.py b/pym/portage/tests/resolver/test_bdeps.py |
116 |
new file mode 100644 |
117 |
index 0000000..19159bd |
118 |
--- /dev/null |
119 |
+++ b/pym/portage/tests/resolver/test_bdeps.py |
120 |
@@ -0,0 +1,197 @@ |
121 |
+# Copyright 2017 Gentoo Foundation |
122 |
+# Distributed under the terms of the GNU General Public License v2 |
123 |
+ |
124 |
+from portage.tests import TestCase |
125 |
+from portage.tests.resolver.ResolverPlayground import ( |
126 |
+ ResolverPlayground, |
127 |
+ ResolverPlaygroundTestCase, |
128 |
+) |
129 |
+ |
130 |
+class BdepsTestCase(TestCase): |
131 |
+ |
132 |
+ def testImageMagickUpdate(self): |
133 |
+ |
134 |
+ ebuilds = { |
135 |
+ "app-misc/A-1" : { |
136 |
+ "EAPI": "6", |
137 |
+ "DEPEND": "app-misc/B", |
138 |
+ "RDEPEND": "app-misc/C", |
139 |
+ }, |
140 |
+ |
141 |
+ "app-misc/B-1" : { |
142 |
+ "EAPI": "6" |
143 |
+ }, |
144 |
+ "app-misc/B-2" : { |
145 |
+ "EAPI": "6", |
146 |
+ }, |
147 |
+ |
148 |
+ "app-misc/C-1" : { |
149 |
+ "EAPI": "6", |
150 |
+ "DEPEND": "app-misc/D", |
151 |
+ }, |
152 |
+ "app-misc/C-2" : { |
153 |
+ "EAPI": "6", |
154 |
+ "DEPEND": "app-misc/D", |
155 |
+ }, |
156 |
+ |
157 |
+ "app-misc/D-1" : { |
158 |
+ "EAPI": "6", |
159 |
+ }, |
160 |
+ "app-misc/D-2" : { |
161 |
+ "EAPI": "6", |
162 |
+ }, |
163 |
+ } |
164 |
+ |
165 |
+ installed = { |
166 |
+ "app-misc/A-1" : { |
167 |
+ "EAPI": "6", |
168 |
+ "DEPEND": "app-misc/B", |
169 |
+ "RDEPEND": "app-misc/C", |
170 |
+ }, |
171 |
+ |
172 |
+ "app-misc/B-1" : { |
173 |
+ "EAPI": "6", |
174 |
+ }, |
175 |
+ "app-misc/C-1" : { |
176 |
+ "EAPI": "6", |
177 |
+ "DEPEND": "app-misc/D", |
178 |
+ }, |
179 |
+ |
180 |
+ "app-misc/D-1" : { |
181 |
+ "EAPI": "6", |
182 |
+ }, |
183 |
+ } |
184 |
+ |
185 |
+ binpkgs = { |
186 |
+ "app-misc/A-1" : { |
187 |
+ "EAPI": "6", |
188 |
+ "DEPEND": "app-misc/B", |
189 |
+ "RDEPEND": "app-misc/C", |
190 |
+ }, |
191 |
+ |
192 |
+ "app-misc/B-1" : { |
193 |
+ "EAPI": "6", |
194 |
+ }, |
195 |
+ "app-misc/B-2" : { |
196 |
+ "EAPI": "6", |
197 |
+ }, |
198 |
+ |
199 |
+ "app-misc/C-1" : { |
200 |
+ "EAPI": "6", |
201 |
+ "DEPEND": "app-misc/D", |
202 |
+ }, |
203 |
+ "app-misc/C-2" : { |
204 |
+ "EAPI": "6", |
205 |
+ "DEPEND": "app-misc/D", |
206 |
+ }, |
207 |
+ |
208 |
+ "app-misc/D-1" : { |
209 |
+ "EAPI": "6", |
210 |
+ }, |
211 |
+ "app-misc/D-2" : { |
212 |
+ "EAPI": "6", |
213 |
+ }, |
214 |
+ } |
215 |
+ |
216 |
+ world = ( |
217 |
+ "app-misc/A", |
218 |
+ ) |
219 |
+ |
220 |
+ test_cases = ( |
221 |
+ |
222 |
+ # Enable --with-bdeps automatically when |
223 |
+ # --usepkg has not been specified. |
224 |
+ ResolverPlaygroundTestCase( |
225 |
+ ["@world"], |
226 |
+ options = { |
227 |
+ "--update": True, |
228 |
+ "--deep": True, |
229 |
+ }, |
230 |
+ success = True, |
231 |
+ ambiguous_merge_order = True, |
232 |
+ mergelist = [ |
233 |
+ "app-misc/D-2", |
234 |
+ ("app-misc/B-2", "app-misc/C-2"), |
235 |
+ ] |
236 |
+ ), |
237 |
+ |
238 |
+ # Do not enable --with-bdeps automatically when |
239 |
+ # --usepkg has been specified, since many users of binary |
240 |
+ # packages do not want unnecessary build time dependencies |
241 |
+ # installed. In this case we miss an update to for |
242 |
+ # app-misc/D-2, since DEPEND is not pulled in for |
243 |
+ # the [binary]app-misc/C-2 update. |
244 |
+ ResolverPlaygroundTestCase( |
245 |
+ ["@world"], |
246 |
+ options = { |
247 |
+ "--update": True, |
248 |
+ "--deep": True, |
249 |
+ "--usepkg": True, |
250 |
+ }, |
251 |
+ success = True, |
252 |
+ mergelist = [ |
253 |
+ "[binary]app-misc/C-2", |
254 |
+ ] |
255 |
+ ), |
256 |
+ |
257 |
+ # Use --with-bdeps=y to pull in build-time dependencies of |
258 |
+ # binary packages. |
259 |
+ ResolverPlaygroundTestCase( |
260 |
+ ["@world"], |
261 |
+ options = { |
262 |
+ "--update": True, |
263 |
+ "--deep": True, |
264 |
+ "--usepkg": True, |
265 |
+ "--with-bdeps": "y", |
266 |
+ }, |
267 |
+ success = True, |
268 |
+ ambiguous_merge_order = True, |
269 |
+ mergelist = [ |
270 |
+ ( |
271 |
+ "[binary]app-misc/D-2", |
272 |
+ "[binary]app-misc/B-2", |
273 |
+ "[binary]app-misc/C-2", |
274 |
+ ), |
275 |
+ ] |
276 |
+ ), |
277 |
+ |
278 |
+ # For --depclean, do not remove build-time dependencies by |
279 |
+ # default. |
280 |
+ ResolverPlaygroundTestCase( |
281 |
+ [], |
282 |
+ options = { |
283 |
+ "--depclean": True, |
284 |
+ }, |
285 |
+ success = True, |
286 |
+ cleanlist = [], |
287 |
+ ), |
288 |
+ |
289 |
+ # For --depclean, remove build-time dependencies if |
290 |
+ # --with-bdeps=n has been specified. |
291 |
+ ResolverPlaygroundTestCase( |
292 |
+ [], |
293 |
+ options = { |
294 |
+ "--depclean": True, |
295 |
+ "--with-bdeps": "n", |
296 |
+ }, |
297 |
+ success = True, |
298 |
+ ignore_cleanlist_order = True, |
299 |
+ cleanlist = [ |
300 |
+ "app-misc/D-1", |
301 |
+ "app-misc/B-1", |
302 |
+ ], |
303 |
+ ), |
304 |
+ ) |
305 |
+ |
306 |
+ playground = ResolverPlayground(debug=False, |
307 |
+ ebuilds=ebuilds, installed=installed, |
308 |
+ binpkgs=binpkgs, world=world) |
309 |
+ try: |
310 |
+ for test_case in test_cases: |
311 |
+ playground.run_TestCase(test_case) |
312 |
+ self.assertEqual(test_case.test_success, True, |
313 |
+ test_case.fail_msg) |
314 |
+ finally: |
315 |
+ # Disable debug so that cleanup works. |
316 |
+ playground.debug = False |
317 |
+ playground.cleanup() |
318 |
-- |
319 |
2.10.2 |