summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Freihofer <adrian.freihofer@gmail.com>2023-09-10 17:52:33 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-12 12:44:47 +0100
commitb31f99a6cbd138049d2370fa367ff55e1ec4b31d (patch)
tree14a9785bbb788e5b32b597ce68c548fae550e2d9
parent40fdebda20af3546186cc63e3c2c71dfd2ad6bc0 (diff)
downloadpoky-b31f99a6cbd138049d2370fa367ff55e1ec4b31d.tar.gz
lib/oe/package: Refactor to make strip_execs callable without d
This allows to call strip_execs function from devtool without going via tinfoil and a bitbake server process. (From OE-Core rev: 3bde26d64a0c8c3ef8ffbcb398f2a268759321af) Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-global/staging.bbclass3
-rw-r--r--meta/lib/oe/package.py7
2 files changed, 6 insertions, 4 deletions
diff --git a/meta/classes-global/staging.bbclass b/meta/classes-global/staging.bbclass
index 3a300c32e7..d229f40107 100644
--- a/meta/classes-global/staging.bbclass
+++ b/meta/classes-global/staging.bbclass
@@ -92,7 +92,8 @@ python sysroot_strip () {
92 qa_already_stripped = 'already-stripped' in (d.getVar('INSANE_SKIP:' + pn) or "").split() 92 qa_already_stripped = 'already-stripped' in (d.getVar('INSANE_SKIP:' + pn) or "").split()
93 strip_cmd = d.getVar("STRIP") 93 strip_cmd = d.getVar("STRIP")
94 94
95 oe.package.strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, 95 max_process = oe.utils.get_bb_number_threads(d)
96 oe.package.strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, max_process,
96 qa_already_stripped=qa_already_stripped) 97 qa_already_stripped=qa_already_stripped)
97} 98}
98 99
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 9d70925b9b..1dd20f85eb 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -114,7 +114,7 @@ def is_static_lib(path):
114 return start == magic 114 return start == magic
115 return False 115 return False
116 116
117def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, qa_already_stripped=False): 117def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, max_process, qa_already_stripped=False):
118 """ 118 """
119 Strip executable code (like executables, shared libraries) _in_place_ 119 Strip executable code (like executables, shared libraries) _in_place_
120 - Based on sysroot_strip in staging.bbclass 120 - Based on sysroot_strip in staging.bbclass
@@ -122,6 +122,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, qa_already_stripp
122 :param strip_cmd: Strip command (usually ${STRIP}) 122 :param strip_cmd: Strip command (usually ${STRIP})
123 :param libdir: ${libdir} - strip .so files in this directory 123 :param libdir: ${libdir} - strip .so files in this directory
124 :param base_libdir: ${base_libdir} - strip .so files in this directory 124 :param base_libdir: ${base_libdir} - strip .so files in this directory
125 :param max_process: number of stripping processes started in parallel
125 :param qa_already_stripped: Set to True if already-stripped' in ${INSANE_SKIP} 126 :param qa_already_stripped: Set to True if already-stripped' in ${INSANE_SKIP}
126 This is for proper logging and messages only. 127 This is for proper logging and messages only.
127 """ 128 """
@@ -164,7 +165,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, qa_already_stripp
164 # ...but is it ELF, and is it already stripped? 165 # ...but is it ELF, and is it already stripped?
165 checkelf.append(file) 166 checkelf.append(file)
166 inodecache[file] = s.st_ino 167 inodecache[file] = s.st_ino
167 results = oe.utils.multiprocess_launch(is_elf, checkelf, d) 168 results = oe.utils.multiprocess_launch_mp(is_elf, checkelf, max_process)
168 for (file, elf_file) in results: 169 for (file, elf_file) in results:
169 #elf_file = is_elf(file) 170 #elf_file = is_elf(file)
170 if elf_file & 1: 171 if elf_file & 1:
@@ -192,7 +193,7 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, qa_already_stripp
192 elf_file = int(elffiles[file]) 193 elf_file = int(elffiles[file])
193 sfiles.append((file, elf_file, strip_cmd)) 194 sfiles.append((file, elf_file, strip_cmd))
194 195
195 oe.utils.multiprocess_launch(runstrip, sfiles, d) 196 oe.utils.multiprocess_launch_mp(runstrip, sfiles, max_process)
196 197
197 198
198def file_translate(file): 199def file_translate(file):