diff options
| author | Joshua Watt <jpewhacker@gmail.com> | 2018-02-12 13:39:58 -0600 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-02-16 18:05:40 +0000 |
| commit | feded5fe2755fc6523c235fd6e82a0972e197c08 (patch) | |
| tree | 91d80f0b7121167e9e7822ee6a450d56d6a06e60 /meta/classes/waf.bbclass | |
| parent | c723f7c92a15daba5c8ec1d801ce8debb47d59bf (diff) | |
| download | poky-feded5fe2755fc6523c235fd6e82a0972e197c08.tar.gz | |
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.
(From OE-Core rev: ccd1142d22b31ed85d8823b1bc9e11ccfd72b61f)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/waf.bbclass')
| -rw-r--r-- | meta/classes/waf.bbclass | 24 |
1 files changed, 1 insertions, 23 deletions
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 = "" | |||
| 3 | 3 | ||
| 4 | EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}" | 4 | EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}" |
| 5 | 5 | ||
| 6 | def get_waf_parallel_make(d): | ||
| 7 | pm = d.getVar('PARALLEL_MAKE') | ||
| 8 | if pm: | ||
| 9 | # look for '-j' and throw other options (e.g. '-l') away | ||
| 10 | # because they might have different meaning in bjam | ||
| 11 | pm = pm.split() | ||
| 12 | while pm: | ||
| 13 | v = None | ||
| 14 | opt = pm.pop(0) | ||
| 15 | if opt == '-j': | ||
| 16 | v = pm.pop(0) | ||
| 17 | elif opt.startswith('-j'): | ||
| 18 | v = opt[2:].strip() | ||
| 19 | else: | ||
| 20 | v = None | ||
| 21 | |||
| 22 | if v: | ||
| 23 | v = min(64, int(v)) | ||
| 24 | return '-j' + str(v) | ||
| 25 | |||
| 26 | return "" | ||
| 27 | |||
| 28 | python waf_preconfigure() { | 6 | python waf_preconfigure() { |
| 29 | import subprocess | 7 | import subprocess |
| 30 | from distutils.version import StrictVersion | 8 | from distutils.version import StrictVersion |
| @@ -47,7 +25,7 @@ waf_do_configure() { | |||
| 47 | 25 | ||
| 48 | do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+" | 26 | do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\s+" |
| 49 | waf_do_compile() { | 27 | waf_do_compile() { |
| 50 | ${S}/waf build ${@get_waf_parallel_make(d)} | 28 | ${S}/waf build ${@oe.utils.parallel_make_argument(d, '-j%d', limit=64)} |
| 51 | } | 29 | } |
| 52 | 30 | ||
| 53 | waf_do_install() { | 31 | waf_do_install() { |
