diff options
author | André Draszik <git@andred.net> | 2020-03-03 16:05:10 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-03-06 08:19:17 +0000 |
commit | 0d7f24ce8953772a6b029bb327d54d8e849ed039 (patch) | |
tree | 0257f0943c74f3d7937a3962668b52383f824c67 /meta/lib/oe | |
parent | 193f56f8b829e215646c0927aa23d03ad37e94ad (diff) | |
download | poky-0d7f24ce8953772a6b029bb327d54d8e849ed039.tar.gz |
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>
Diffstat (limited to 'meta/lib/oe')
-rw-r--r-- | meta/lib/oe/utils.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index e350b05ddf..aee4336482 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py | |||
@@ -248,9 +248,10 @@ def trim_version(version, num_parts=2): | |||
248 | trimmed = ".".join(parts[:num_parts]) | 248 | trimmed = ".".join(parts[:num_parts]) |
249 | return trimmed | 249 | return trimmed |
250 | 250 | ||
251 | def cpu_count(): | 251 | def cpu_count(at_least=1): |
252 | import multiprocessing | 252 | import multiprocessing |
253 | return multiprocessing.cpu_count() | 253 | cpus = multiprocessing.cpu_count() |
254 | return max(cpus, at_least) | ||
254 | 255 | ||
255 | def execute_pre_post_process(d, cmds): | 256 | def execute_pre_post_process(d, cmds): |
256 | if cmds is None: | 257 | if cmds is None: |