[oe-commits] [openembedded-core] 02/06: lib/oe/utils: allow to set a lower bound on returned cpu_count()

git at git.openembedded.org git at git.openembedded.org
Tue Mar 3 22:53:19 UTC 2020


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 3b91800dc852c0dfc3ff7ab79573c086ac2ba2d3
Author: André Draszik <git at andred.net>
AuthorDate: Tue Mar 3 16:05:10 2020 +0000

    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.
    
    Signed-off-by: André Draszik <git at andred.net>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oe/utils.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index e350b05..aee4336 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -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:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list