<html><head></head><body><div>On Fri, 2018-02-16 at 21:14 +0100, Martin Jansa wrote:</div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div dir="ltr"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = max(limit, v)</span><br><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">this seems to be doing the opposite of what the limit was used for before:</span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = min(64, int(v))</span><br></span></div></div></blockquote><div><br></div><div>Hmm, you're right</div><div><br></div><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 12, 2018 at 8:39 PM, Joshua Watt <span dir="ltr">&lt;<a href="mailto:jpewhacker@gmail.com" target="_blank">jpewhacker@gmail.com</a>&gt;</span> wrote:<br><blockquote type="cite" style="margin:0 0 0 .8ex; border-left:2px #729fcf solid;padding-left:1ex">The code to extract the integer number of parallel build threads and<br>
construct a new argument from them has started to be copied in multiple<br>
locations, so create two new helper utilities to aid recipes.<br>
<br>
The first helper (parallel_make()) extracts the integer number of<br>
parallel build threads from PARALLEL_MAKE. The second<br>
(parallel_make_argument()) does the same and then puts the result back<br>
into a format string, optionally clamping it to some maximum value.<br>
<br>
Additionally, rework the oe-core recipes that were manually doing this<br>
to use the new helper utilities.<br>
<br>
Signed-off-by: Joshua Watt &lt;<a href="mailto:JPEWhacker@gmail.com">JPEWhacker@gmail.com</a>&gt;<br>
---<br>
&nbsp;meta/classes/go.bbclass&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | 19 +---------------<br>
&nbsp;meta/classes/waf.bbclass&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 24 +-------------------<br>
&nbsp;meta/lib/oe/utils.py&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| 43 ++++++++++++++++++++++++++++++<wbr>++++++<br>
&nbsp;meta/recipes-core/ovmf/<a href="http://ovmf_git.bb" rel="noreferrer" target="_blank">ovmf_<wbr>git.bb</a>&nbsp; &nbsp;|&nbsp; 2 +-<br>
&nbsp;meta/recipes-support/boost/<wbr>boost.inc | 24 +-------------------<br>
&nbsp;5 files changed, 47 insertions(+), 65 deletions(-)<br>
<br>
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass<br>
index 09b01a84c37..7ecd8c92541 100644<br>
--- a/meta/classes/go.bbclass<br>
+++ b/meta/classes/go.bbclass<br>
@@ -1,23 +1,6 @@<br>
&nbsp;inherit goarch ptest<br>
<br>
-def get_go_parallel_make(d):<br>
-&nbsp; &nbsp; pm = (d.getVar('PARALLEL_MAKE') or '').split()<br>
-&nbsp; &nbsp; # look for '-j' and throw other options (e.g. '-l') away<br>
-&nbsp; &nbsp; # because they might have a different meaning in golang<br>
-&nbsp; &nbsp; while pm:<br>
-&nbsp; &nbsp; &nbsp; &nbsp; opt = pm.pop(0)<br>
-&nbsp; &nbsp; &nbsp; &nbsp; if opt == '-j':<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = pm.pop(0)<br>
-&nbsp; &nbsp; &nbsp; &nbsp; elif opt.startswith('-j'):<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = opt[2:].strip()<br>
-&nbsp; &nbsp; &nbsp; &nbsp; else:<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue<br>
-<br>
-&nbsp; &nbsp; &nbsp; &nbsp; return '-p %d' % int(v)<br>
-<br>
-&nbsp; &nbsp; return ""<br>
-<br>
-GO_PARALLEL_BUILD ?= "${@get_go_parallel_make(d)}"<br>
+GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_<wbr>argument(d, '-p %d')}"<br>
<br>
&nbsp;GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go"<br>
&nbsp;GOROOT_class-nativesdk = "${STAGING_DIR_TARGET}${<wbr>libdir}/go"<br>
diff --git a/meta/classes/waf.bbclass b/meta/classes/waf.bbclass<br>
index bdbdc56767c..f9a851d0759 100644<br>
--- a/meta/classes/waf.bbclass<br>
+++ b/meta/classes/waf.bbclass<br>
@@ -3,28 +3,6 @@ DISABLE_STATIC = ""<br>
<br>
&nbsp;EXTRA_OECONF_append = " ${PACKAGECONFIG_CONFARGS}"<br>
<br>
-def get_waf_parallel_make(d):<br>
-&nbsp; &nbsp; pm = d.getVar('PARALLEL_MAKE')<br>
-&nbsp; &nbsp; if pm:<br>
-&nbsp; &nbsp; &nbsp; &nbsp; # look for '-j' and throw other options (e.g. '-l') away<br>
-&nbsp; &nbsp; &nbsp; &nbsp; # because they might have different meaning in bjam<br>
-&nbsp; &nbsp; &nbsp; &nbsp; pm = pm.split()<br>
-&nbsp; &nbsp; &nbsp; &nbsp; while pm:<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = None<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; opt = pm.pop(0)<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if opt == '-j':<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = pm.pop(0)<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif opt.startswith('-j'):<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = opt[2:].strip()<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = None<br>
-<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if v:<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = min(64, int(v))<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return '-j' + str(v)<br>
-<br>
-&nbsp; &nbsp; return ""<br>
-<br>
&nbsp;python waf_preconfigure() {<br>
&nbsp; &nbsp; &nbsp;import subprocess<br>
&nbsp; &nbsp; &nbsp;from distutils.version import StrictVersion<br>
@@ -47,7 +25,7 @@ waf_do_configure() {<br>
<br>
&nbsp;do_compile[progress] = "outof:^\[\s*(\d+)/\s*(\d+)\]\<wbr>s+"<br>
&nbsp;waf_do_compile()&nbsp; {<br>
-&nbsp; &nbsp; &nbsp; &nbsp;${S}/waf build ${@get_waf_parallel_make(d)}<br>
+&nbsp; &nbsp; &nbsp; &nbsp;${S}/waf build ${@oe.utils.parallel_make_<wbr>argument(d, '-j%d', limit=64)}<br>
&nbsp;}<br>
<br>
&nbsp;waf_do_install() {<br>
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py<br>
index 7a79d752b69..ec91927233a 100644<br>
--- a/meta/lib/oe/utils.py<br>
+++ b/meta/lib/oe/utils.py<br>
@@ -156,6 +156,49 @@ def any_distro_features(d, features, truevalue="1", falsevalue=""):<br>
&nbsp; &nbsp; &nbsp;"""<br>
&nbsp; &nbsp; &nbsp;return bb.utils.contains_any("DISTRO_<wbr>FEATURES", features, truevalue, falsevalue, d)<br>
<br>
+def parallel_make(d):<br>
+&nbsp; &nbsp; """<br>
+&nbsp; &nbsp; Return the integer value for the number of parallel threads to use when<br>
+&nbsp; &nbsp; building, scraped out of PARALLEL_MAKE. If no parallelization option is<br>
+&nbsp; &nbsp; found, returns None<br>
+<br>
+&nbsp; &nbsp; e.g. if PARALLEL_MAKE = "-j 10", this will return 10 as an integer.<br>
+&nbsp; &nbsp; """<br>
+&nbsp; &nbsp; pm = (d.getVar('PARALLEL_MAKE') or '').split()<br>
+&nbsp; &nbsp; # look for '-j' and throw other options (e.g. '-l') away<br>
+&nbsp; &nbsp; while pm:<br>
+&nbsp; &nbsp; &nbsp; &nbsp; opt = pm.pop(0)<br>
+&nbsp; &nbsp; &nbsp; &nbsp; if opt == '-j':<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = pm.pop(0)<br>
+&nbsp; &nbsp; &nbsp; &nbsp; elif opt.startswith('-j'):<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = opt[2:].strip()<br>
+&nbsp; &nbsp; &nbsp; &nbsp; else:<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; continue<br>
+<br>
+&nbsp; &nbsp; &nbsp; &nbsp; return int(v)<br>
+<br>
+&nbsp; &nbsp; return None<br>
+<br>
+def parallel_make_argument(d, fmt, limit=None):<br>
+&nbsp; &nbsp; """<br>
+&nbsp; &nbsp; Helper utility to construct a parallel make argument from the number of<br>
+&nbsp; &nbsp; parallel threads specified in PARALLEL_MAKE.<br>
+<br>
+&nbsp; &nbsp; Returns the input format string `fmt` where a single '%d' will be expanded<br>
+&nbsp; &nbsp; with the number of parallel threads to use. If `limit` is specified, the<br>
+&nbsp; &nbsp; number of parallel threads will be no larger than it. If no parallelization<br>
+&nbsp; &nbsp; option is found in PARALLEL_MAKE, returns an empty string<br>
+<br>
+&nbsp; &nbsp; e.g. if PARALLEL_MAKE = "-j 10", parallel_make_argument(d, "-n %d") will return<br>
+&nbsp; &nbsp; "-n 10"<br>
+&nbsp; &nbsp; """<br>
+&nbsp; &nbsp; v = parallel_make(d)<br>
+&nbsp; &nbsp; if v:<br>
+&nbsp; &nbsp; &nbsp; &nbsp; if limit:<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = max(limit, v)<br>
+&nbsp; &nbsp; &nbsp; &nbsp; return fmt % v<br>
+&nbsp; &nbsp; return ''<br>
+<br>
&nbsp;def packages_filter_out_system(d):<br>
&nbsp; &nbsp; &nbsp;"""<br>
&nbsp; &nbsp; &nbsp;Return a list of packages from PACKAGES with the "system" packages such as<br>
diff --git a/meta/recipes-core/ovmf/<a href="http://ovmf_git.bb" rel="noreferrer" target="_blank">ovmf_<wbr>git.bb</a> b/meta/recipes-core/ovmf/<a href="http://ovmf_git.bb" rel="noreferrer" target="_blank">ovmf_<wbr>git.bb</a><br>
index fa0d66291d1..8750b3c528d 100644<br>
--- a/meta/recipes-core/ovmf/<a href="http://ovmf_git.bb" rel="noreferrer" target="_blank">ovmf_<wbr>git.bb</a><br>
+++ b/meta/recipes-core/ovmf/<a href="http://ovmf_git.bb" rel="noreferrer" target="_blank">ovmf_<wbr>git.bb</a><br>
@@ -151,7 +151,7 @@ do_compile_class-native() {<br>
<br>
&nbsp;do_compile_class-target() {<br>
&nbsp; &nbsp; &nbsp;export LFLAGS="${LDFLAGS}"<br>
-&nbsp; &nbsp; PARALLEL_JOBS="${@ '${PARALLEL_MAKE}'.replace('-<wbr>j', '-n ')}"<br>
+&nbsp; &nbsp; PARALLEL_JOBS="${@oe.utils.<wbr>parallel_make_argument(d, '-n %d')}"<br>
&nbsp; &nbsp; &nbsp;OVMF_ARCH="X64"<br>
&nbsp; &nbsp; &nbsp;if [ "${TARGET_ARCH}" != "x86_64" ] ; then<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;OVMF_ARCH="IA32"<br>
diff --git a/meta/recipes-support/boost/<wbr>boost.inc b/meta/recipes-support/boost/<wbr>boost.inc<br>
index 41fc90fb211..0461ec6fcf1 100644<br>
--- a/meta/recipes-support/boost/<wbr>boost.inc<br>
+++ b/meta/recipes-support/boost/<wbr>boost.inc<br>
@@ -135,29 +135,7 @@ BJAM_TOOLS&nbsp; &nbsp;= "--ignore-site-config \<br>
<br>
&nbsp;# use PARALLEL_MAKE to speed up the build, but limit it by -j 64, greater parallelism causes bjam to segfault or to ignore -j<br>
&nbsp;# <a href="https://svn.boost.org/trac/boost/ticket/7634" rel="noreferrer" target="_blank">https://svn.boost.org/trac/<wbr>boost/ticket/7634</a><br>
-def get_boost_parallel_make(d):<br>
-&nbsp; &nbsp; pm = d.getVar('PARALLEL_MAKE')<br>
-&nbsp; &nbsp; if pm:<br>
-&nbsp; &nbsp; &nbsp; &nbsp; # look for '-j' and throw other options (e.g. '-l') away<br>
-&nbsp; &nbsp; &nbsp; &nbsp; # because they might have different meaning in bjam<br>
-&nbsp; &nbsp; &nbsp; &nbsp; pm = pm.split()<br>
-&nbsp; &nbsp; &nbsp; &nbsp; while pm:<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = None<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; opt = pm.pop(0)<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if opt == '-j':<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = pm.pop(0)<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; elif opt.startswith('-j'):<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = opt[2:].strip()<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else:<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = None<br>
-<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if v:<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v = min(64, int(v))<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return '-j' + str(v)<br>
-<br>
-&nbsp; &nbsp; return ""<br>
-<br>
-BOOST_PARALLEL_MAKE = "${@get_boost_parallel_make(d)<wbr>}"<br>
+BOOST_PARALLEL_MAKE = "${@oe.utils.parallel_make_<wbr>argument(d, '-j%d', limit=64)}"<br>
&nbsp;BJAM_OPTS&nbsp; &nbsp; = '${BOOST_PARALLEL_MAKE} -d+2 -q \<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ${BJAM_TOOLS} \<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -sBOOST_BUILD_USER_CONFIG=${<wbr>WORKDIR}/user-config.jam \<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.3<br>
<br>
--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
</font></span></blockquote></div><br></div>
</blockquote></body></html>