diff options
| author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2023-09-10 17:52:32 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-12 12:44:47 +0100 |
| commit | 40fdebda20af3546186cc63e3c2c71dfd2ad6bc0 (patch) | |
| tree | bd0045e06765845599bcf659da57b1db6dff7c23 | |
| parent | 48c80dcb15b31ca5e9899d7a442e489fbc8be00d (diff) | |
| download | poky-40fdebda20af3546186cc63e3c2c71dfd2ad6bc0.tar.gz | |
lib/oe/utils: Refactor to make multiprocess_launch callable without d
This is a preparation for making the strip_execs function callable from
devtool without going via tinfoil and a bitbake server process.
(From OE-Core rev: af8ee73cdef90b83556a7ac5e139a08108706486)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/conf/bitbake.conf | 2 | ||||
| -rw-r--r-- | meta/lib/oe/utils.py | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 47b564fbab..8b26461874 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf | |||
| @@ -975,5 +975,5 @@ BB_UNIHASH ?= "${BB_TASKHASH}" | |||
| 975 | oe.sstatesig.find_sstate_manifest[vardepsexclude] = "BBEXTENDCURR BBEXTENDVARIANT OVERRIDES PACKAGE_EXTRA_ARCHS" | 975 | oe.sstatesig.find_sstate_manifest[vardepsexclude] = "BBEXTENDCURR BBEXTENDVARIANT OVERRIDES PACKAGE_EXTRA_ARCHS" |
| 976 | oe.utils.get_multilib_datastore[vardepsexclude] = "DEFAULTTUNE_MULTILIB_ORIGINAL OVERRIDES" | 976 | oe.utils.get_multilib_datastore[vardepsexclude] = "DEFAULTTUNE_MULTILIB_ORIGINAL OVERRIDES" |
| 977 | oe.path.format_display[vardepsexclude] = "TOPDIR" | 977 | oe.path.format_display[vardepsexclude] = "TOPDIR" |
| 978 | oe.utils.multiprocess_launch[vardepsexclude] = "BB_NUMBER_THREADS" | 978 | oe.utils.get_bb_number_threads[vardepsexclude] = "BB_NUMBER_THREADS" |
| 979 | oe.packagedata.emit_pkgdata[vardepsexclude] = "BB_NUMBER_THREADS" | 979 | oe.packagedata.emit_pkgdata[vardepsexclude] = "BB_NUMBER_THREADS" |
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index 1658f3555d..a3b1bb1087 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
| @@ -264,10 +264,17 @@ def execute_pre_post_process(d, cmds): | |||
| 264 | bb.note("Executing %s ..." % cmd) | 264 | bb.note("Executing %s ..." % cmd) |
| 265 | bb.build.exec_func(cmd, d) | 265 | bb.build.exec_func(cmd, d) |
| 266 | 266 | ||
| 267 | # For each item in items, call the function 'target' with item as the first | 267 | def get_bb_number_threads(d): |
| 268 | return int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1) | ||
| 269 | |||
| 270 | def multiprocess_launch(target, items, d, extraargs=None): | ||
| 271 | max_process = get_bb_number_threads(d) | ||
| 272 | return multiprocess_launch_mp(target, items, max_process, extraargs) | ||
| 273 | |||
| 274 | # For each item in items, call the function 'target' with item as the first | ||
| 268 | # argument, extraargs as the other arguments and handle any exceptions in the | 275 | # argument, extraargs as the other arguments and handle any exceptions in the |
| 269 | # parent thread | 276 | # parent thread |
| 270 | def multiprocess_launch(target, items, d, extraargs=None): | 277 | def multiprocess_launch_mp(target, items, max_process, extraargs=None): |
| 271 | 278 | ||
| 272 | class ProcessLaunch(multiprocessing.Process): | 279 | class ProcessLaunch(multiprocessing.Process): |
| 273 | def __init__(self, *args, **kwargs): | 280 | def __init__(self, *args, **kwargs): |
| @@ -302,7 +309,6 @@ def multiprocess_launch(target, items, d, extraargs=None): | |||
| 302 | self.update() | 309 | self.update() |
| 303 | return self._result | 310 | return self._result |
| 304 | 311 | ||
| 305 | max_process = int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1) | ||
| 306 | launched = [] | 312 | launched = [] |
| 307 | errors = [] | 313 | errors = [] |
| 308 | results = [] | 314 | results = [] |
