1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 17:19:20 +00:00

lib/oe/utils: allow to set a lower bound on returned cpu_count()

This will be needed for making xz compression more deterministic,
as xz archives are created differently in single- vs multi-threaded
modes.

This means that due to bitbake's default of using as many threads
as there are cores in the system, files compressed with xz
will be different if built on a multi-core system compared to
single-core systems.

Allowing cpu_count() here to return a lower bound, will allow
forcing xz to always use multi-threaded operation.

(From OE-Core rev: c6dda204e15c5b27559f7617b18a7b3ce604e2f8)

Signed-off-by: André Draszik <git@andred.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
André Draszik
2020-03-03 16:05:10 +00:00
committed by Richard Purdie
parent 193f56f8b8
commit 0d7f24ce89
+3 -2
View File
@@ -248,9 +248,10 @@ def trim_version(version, num_parts=2):
trimmed = ".".join(parts[:num_parts])
return trimmed
def cpu_count():
def cpu_count(at_least=1):
import multiprocessing
return multiprocessing.cpu_count()
cpus = multiprocessing.cpu_count()
return max(cpus, at_least)
def execute_pre_post_process(d, cmds):
if cmds is None: