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>
This commit is contained in:
Adrian Freihofer 2023-09-10 17:52:33 +02:00 committed by Richard Purdie
parent 40fdebda20
commit b31f99a6cb
2 changed files with 6 additions and 4 deletions

View File

@ -92,7 +92,8 @@ python sysroot_strip () {
qa_already_stripped = 'already-stripped' in (d.getVar('INSANE_SKIP:' + pn) or "").split()
strip_cmd = d.getVar("STRIP")
oe.package.strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d,
max_process = oe.utils.get_bb_number_threads(d)
oe.package.strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, max_process,
qa_already_stripped=qa_already_stripped)
}

View File

@ -114,7 +114,7 @@ def is_static_lib(path):
return start == magic
return False
def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, qa_already_stripped=False):
def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, max_process, qa_already_stripped=False):
"""
Strip executable code (like executables, shared libraries) _in_place_
- 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
:param strip_cmd: Strip command (usually ${STRIP})
:param libdir: ${libdir} - strip .so files in this directory
:param base_libdir: ${base_libdir} - strip .so files in this directory
:param max_process: number of stripping processes started in parallel
:param qa_already_stripped: Set to True if already-stripped' in ${INSANE_SKIP}
This is for proper logging and messages only.
"""
@ -164,7 +165,7 @@ 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)
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):