mirror of
https://git.yoctoproject.org/poky
synced 2026-05-08 17:19:20 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
48c80dcb15
commit
40fdebda20
@@ -975,5 +975,5 @@ BB_UNIHASH ?= "${BB_TASKHASH}"
|
|||||||
oe.sstatesig.find_sstate_manifest[vardepsexclude] = "BBEXTENDCURR BBEXTENDVARIANT OVERRIDES PACKAGE_EXTRA_ARCHS"
|
oe.sstatesig.find_sstate_manifest[vardepsexclude] = "BBEXTENDCURR BBEXTENDVARIANT OVERRIDES PACKAGE_EXTRA_ARCHS"
|
||||||
oe.utils.get_multilib_datastore[vardepsexclude] = "DEFAULTTUNE_MULTILIB_ORIGINAL OVERRIDES"
|
oe.utils.get_multilib_datastore[vardepsexclude] = "DEFAULTTUNE_MULTILIB_ORIGINAL OVERRIDES"
|
||||||
oe.path.format_display[vardepsexclude] = "TOPDIR"
|
oe.path.format_display[vardepsexclude] = "TOPDIR"
|
||||||
oe.utils.multiprocess_launch[vardepsexclude] = "BB_NUMBER_THREADS"
|
oe.utils.get_bb_number_threads[vardepsexclude] = "BB_NUMBER_THREADS"
|
||||||
oe.packagedata.emit_pkgdata[vardepsexclude] = "BB_NUMBER_THREADS"
|
oe.packagedata.emit_pkgdata[vardepsexclude] = "BB_NUMBER_THREADS"
|
||||||
|
|||||||
@@ -264,10 +264,17 @@ def execute_pre_post_process(d, cmds):
|
|||||||
bb.note("Executing %s ..." % cmd)
|
bb.note("Executing %s ..." % cmd)
|
||||||
bb.build.exec_func(cmd, d)
|
bb.build.exec_func(cmd, d)
|
||||||
|
|
||||||
# For each item in items, call the function 'target' with item as the first
|
def get_bb_number_threads(d):
|
||||||
|
return int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1)
|
||||||
|
|
||||||
|
def multiprocess_launch(target, items, d, extraargs=None):
|
||||||
|
max_process = get_bb_number_threads(d)
|
||||||
|
return multiprocess_launch_mp(target, items, max_process, extraargs)
|
||||||
|
|
||||||
|
# For each item in items, call the function 'target' with item as the first
|
||||||
# argument, extraargs as the other arguments and handle any exceptions in the
|
# argument, extraargs as the other arguments and handle any exceptions in the
|
||||||
# parent thread
|
# parent thread
|
||||||
def multiprocess_launch(target, items, d, extraargs=None):
|
def multiprocess_launch_mp(target, items, max_process, extraargs=None):
|
||||||
|
|
||||||
class ProcessLaunch(multiprocessing.Process):
|
class ProcessLaunch(multiprocessing.Process):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@@ -302,7 +309,6 @@ def multiprocess_launch(target, items, d, extraargs=None):
|
|||||||
self.update()
|
self.update()
|
||||||
return self._result
|
return self._result
|
||||||
|
|
||||||
max_process = int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1)
|
|
||||||
launched = []
|
launched = []
|
||||||
errors = []
|
errors = []
|
||||||
results = []
|
results = []
|
||||||
|
|||||||
Reference in New Issue
Block a user