From ccd1142d22b31ed85d8823b1bc9e11ccfd72b61f Mon Sep 17 00:00:00 2001 From: Joshua Watt Date: Mon, 12 Feb 2018 13:39:58 -0600 Subject: utils.py: add parallel make helpers The code to extract the integer number of parallel build threads and construct a new argument from them has started to be copied in multiple locations, so create two new helper utilities to aid recipes. The first helper (parallel_make()) extracts the integer number of parallel build threads from PARALLEL_MAKE. The second (parallel_make_argument()) does the same and then puts the result back into a format string, optionally clamping it to some maximum value. Additionally, rework the oe-core recipes that were manually doing this to use the new helper utilities. Signed-off-by: Joshua Watt Signed-off-by: Richard Purdie --- meta/classes/waf.bbclass | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'meta/classes/waf.bbclass') diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass index bdbdc56767..f9a851d075 100644 --- a/meta/classes/waf.bbclass +++ b/meta/classes/waf.bbclass @@ -3,28 +3,6 @@ DISABLE_STATIC = "" EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}" -def get_waf_parallel_make(d): - pm = d.getVar('PARALLEL_MAKE') - if pm: - # look for '-j' and throw other options (e.g. '-l') away - # because they might have different meaning in bjam - pm = pm.split() - while pm: - v = None - opt = pm.pop(0) - if opt == '-j': - v = pm.pop(0) - elif opt.startswith('-j'): - v = opt[2:].strip() - else: - v = None - - if v: - v = min(64, int(v)) - return '-j' + str(v) - - return "" - python waf_preconfigure() { import subprocess from distutils.version import StrictVersion @@ -47,7 +25,7 @@ waf_do_configure() { do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+" waf_do_compile() { - ${S}/waf build ${@get_waf_parallel_make(d)} + ${S}/waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)} } waf_do_install() { -- cgit 1.2.3-korg