Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Adrian Freihofer <adrian.freihofer@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Adrian Freihofer <adrian.freihofer@siemens.com>
Subject: [PATCH v4 08/13] refactor: make multiprocess_launch callable without d
Date: Sun, 27 Aug 2023 21:29:50 +0200	[thread overview]
Message-ID: <20230827193200.4083340-9-adrian.freihofer@siemens.com> (raw)
In-Reply-To: <20230827193200.4083340-1-adrian.freihofer@siemens.com>

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/lib/oe/package.py |  5 +++--
 meta/lib/oe/utils.py   | 12 +++++++++---
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 9d70925b9b7..ffca7559ba7 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -164,7 +164,8 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, qa_already_stripp
                 # ...but is it ELF, and is it already stripped?
                 checkelf.append(file)
                 inodecache[file] = s.st_ino
-    results = oe.utils.multiprocess_launch(is_elf, checkelf, d)
+    max_process = int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1)
+    results = oe.utils.multiprocess_launch_mp(is_elf, checkelf, max_process)
     for (file, elf_file) in results:
                 #elf_file = is_elf(file)
                 if elf_file & 1:
@@ -192,7 +193,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, qa_already_stripp
         elf_file = int(elffiles[file])
         sfiles.append((file, elf_file, strip_cmd))
 
-    oe.utils.multiprocess_launch(runstrip, sfiles, d)
+    oe.utils.multiprocess_launch_mp(runstrip, sfiles, max_process)
 
 
 def file_translate(file):
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 69ca8987f3d..430e874d90a 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -264,10 +264,17 @@ def execute_pre_post_process(d, cmds):
             bb.note("Executing %s ..." % cmd)
             bb.build.exec_func(cmd, d)
 
-# For each item in items, call the function 'target' with item as the first 
+def multiprocess_launch_max_process(d):
+    return int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1)
+
+def multiprocess_launch(target, items, d, extraargs=None):
+    max_process = multiprocess_launch_max_process(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
 # parent thread
-def multiprocess_launch(target, items, d, extraargs=None):
+def multiprocess_launch_mp(target, items, max_process, extraargs=None):
 
     class ProcessLaunch(multiprocessing.Process):
         def __init__(self, *args, **kwargs):
@@ -302,7 +309,6 @@ def multiprocess_launch(target, items, d, extraargs=None):
             self.update()
             return self._result
 
-    max_process = int(d.getVar("BB_NUMBER_THREADS") or os.cpu_count() or 1)
     launched = []
     errors = []
     results = []
-- 
2.41.0



  parent reply	other threads:[~2023-08-27 19:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-27 19:29 [PATCH v4 00/13] devtool ide plugin Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 01/13] vscode: add minimal configuration Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 02/13] cmake.bbclass: refactor cmake args Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 03/13] cmake.bbclass: cleanup spaces and tabs Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 04/13] cmake.bbclass: support qemu Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 05/13] devtool: new ide plugin Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 06/13] tests: add a C++ example recipe Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 07/13] cmake-example: workaround for pseudo breakeage Adrian Freihofer
2023-08-27 19:29 ` Adrian Freihofer [this message]
2023-08-27 19:29 ` [PATCH v4 09/13] refactor: make strip_execs callable without d Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 10/13] devtool: refactor deploy-target Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 11/13] devtool: ide make deploy-target quicker Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 12/13] oe-selftest devtool: ide tests Adrian Freihofer
2023-08-27 19:29 ` [PATCH v4 13/13] docs: cover devtool ide Adrian Freihofer
2023-08-30 14:36 ` [OE-core] [PATCH v4 00/13] devtool ide plugin Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230827193200.4083340-9-adrian.freihofer@siemens.com \
    --to=adrian.freihofer@gmail.com \
    --cc=adrian.freihofer@siemens.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox