1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-07 03:04:04 +00:00

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>
This commit is contained in:
Peter Marko
2025-08-08 12:24:11 +02:00
committed by Richard Purdie
parent 22dfa89719
commit ed49517562
+18 -8
View File
@@ -174,18 +174,14 @@ def any_distro_features(d, features, truevalue="1", falsevalue=""):
"""
return bb.utils.contains_any("DISTRO_FEATURES", features, truevalue, falsevalue, d)
def parallel_make(d, makeinst=False):
def parallel_make_value(pm):
"""
Return the integer value for the number of parallel threads to use when
building, scraped out of PARALLEL_MAKE. If no parallelization option is
found, returns None
building, scraped out of given string. If no parallelization option is
found, returns empty string
e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer.
e.g. if string is "-j 10", this will return 10 as an integer.
"""
if makeinst:
pm = (d.getVar('PARALLEL_MAKEINST') or '').split()
else:
pm = (d.getVar('PARALLEL_MAKE') or '').split()
# look for '-j' and throw other options (e.g. '-l') away
while pm:
opt = pm.pop(0)
@@ -200,6 +196,20 @@ def parallel_make(d, makeinst=False):
return ''
def parallel_make(d, makeinst=False):
"""
Return the integer value for the number of parallel threads to use when
building, scraped out of PARALLEL_MAKE. If no parallelization option is
found, returns empty string
e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer.
"""
if makeinst:
pm = (d.getVar('PARALLEL_MAKEINST') or '').split()
else:
pm = (d.getVar('PARALLEL_MAKE') or '').split()
return parallel_make_value(pm)
def parallel_make_argument(d, fmt, limit=None, makeinst=False):
"""
Helper utility to construct a parallel make argument from the number of