From: Peter Marko Date: Fri, 8 Aug 2025 10:24:11 +0000 (+0200) Subject: oe/utils: extract method for parallel_make without d context X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8670e9c7db565401412dad979c2ee53a586b59d;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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. Signed-off-by: Peter Marko Signed-off-by: Mathieu Dubois-Briand --- diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 779c5e593f4..8aa15373f19 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=""): """ 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