summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/utils.py
diff options
context:
space:
mode:
authorPeter Marko <peter.marko@siemens.com>2025-08-08 12:24:11 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-08-11 18:04:25 +0100
commited4951756287fe7ea4720fe93b0b4145a615e464 (patch)
tree3996e8cf605d624980b8915dfb222e250553a17e /meta/lib/oe/utils.py
parent22dfa897193b84bd535bf025c6aee5e6adad7f84 (diff)
downloadpoky-ed4951756287fe7ea4720fe93b0b4145a615e464.tar.gz
oe/utils: extract method for parallel_make without d context
oeqa does not have general access to d variable context and needs to determine parallel make settings. Extract the code from parallel_make into reusable parallel_make_value. Also correct function description of return value from None to empty string. (From OE-Core rev: c8670e9c7db565401412dad979c2ee53a586b59d) Signed-off-by: Peter Marko <peter.marko@siemens.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/utils.py')
-rw-r--r--meta/lib/oe/utils.py26
1 files changed, 18 insertions, 8 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 779c5e593f..8aa15373f1 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -174,18 +174,14 @@ def any_distro_features(d, features, truevalue="1", falsevalue=""):
174 """ 174 """
175 return bb.utils.contains_any("DISTRO_FEATURES", features, truevalue, falsevalue, d) 175 return bb.utils.contains_any("DISTRO_FEATURES", features, truevalue, falsevalue, d)
176 176
177def parallel_make(d, makeinst=False): 177def parallel_make_value(pm):
178 """ 178 """
179 Return the integer value for the number of parallel threads to use when 179 Return the integer value for the number of parallel threads to use when
180 building, scraped out of PARALLEL_MAKE. If no parallelization option is 180 building, scraped out of given string. If no parallelization option is
181 found, returns None 181 found, returns empty string
182 182
183 e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer. 183 e.g. if string is "-j 10", this will return 10 as an integer.
184 """ 184 """
185 if makeinst:
186 pm = (d.getVar('PARALLEL_MAKEINST') or '').split()
187 else:
188 pm = (d.getVar('PARALLEL_MAKE') or '').split()
189 # look for '-j' and throw other options (e.g. '-l') away 185 # look for '-j' and throw other options (e.g. '-l') away
190 while pm: 186 while pm:
191 opt = pm.pop(0) 187 opt = pm.pop(0)
@@ -200,6 +196,20 @@ def parallel_make(d, makeinst=False):
200 196
201 return '' 197 return ''
202 198
199def parallel_make(d, makeinst=False):
200 """
201 Return the integer value for the number of parallel threads to use when
202 building, scraped out of PARALLEL_MAKE. If no parallelization option is
203 found, returns empty string
204
205 e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer.
206 """
207 if makeinst:
208 pm = (d.getVar('PARALLEL_MAKEINST') or '').split()
209 else:
210 pm = (d.getVar('PARALLEL_MAKE') or '').split()
211 return parallel_make_value(pm)
212
203def parallel_make_argument(d, fmt, limit=None, makeinst=False): 213def parallel_make_argument(d, fmt, limit=None, makeinst=False):
204 """ 214 """
205 Helper utility to construct a parallel make argument from the number of 215 Helper utility to construct a parallel make argument from the number of