Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH v2 1/4] lib/oe/utils: allow to set a lower bound on returned cpu_count()
@ 2020-03-03 16:05 André Draszik
  2020-03-03 16:05 ` [PATCH v2 2/4] bitbake.conf: more deterministic xz compression (threads) André Draszik
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: André Draszik @ 2020-03-03 16:05 UTC (permalink / raw)
  To: openembedded-core

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@andred.net>
---
 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 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):
     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:
-- 
2.23.0.rc1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-03-04  6:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-03 16:05 [PATCH v2 1/4] lib/oe/utils: allow to set a lower bound on returned cpu_count() André Draszik
2020-03-03 16:05 ` [PATCH v2 2/4] bitbake.conf: more deterministic xz compression (threads) André Draszik
2020-03-03 16:05 ` [PATCH v2 3/4] bitbake.conf: omit XZ threads and RAM from sstate signatures André Draszik
2020-03-03 16:05 ` [PATCH v2 4/4] reproducible: try to ensure reproducible xz archives André Draszik
2020-03-03 16:08   ` André Draszik
2020-03-04  0:31     ` Otavio Salvador
2020-03-04  6:03       ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox