diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-20 09:36:06 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-24 11:52:07 +0100 |
commit | bbe0d3e26484f3f347262d40a8a9d415ce21fb43 (patch) | |
tree | 165a373492f5515404fb43d86e7956b002765962 /meta/lib/oe/package.py | |
parent | 7ad0c0d6ab12bebeac097fc0f5210c876dcfe9be (diff) | |
download | openembedded-core-bbe0d3e26484f3f347262d40a8a9d415ce21fb43.tar.gz openembedded-core-bbe0d3e26484f3f347262d40a8a9d415ce21fb43.tar.bz2 openembedded-core-bbe0d3e26484f3f347262d40a8a9d415ce21fb43.zip |
package: Call file to determine elf status in parallel
This allows the calls to is_elf (which calls file) to happen in parallel
allowing a speedup of do_package and do_populate_sysroot for native
recipes.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package.py')
-rw-r--r-- | meta/lib/oe/package.py | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index a435d661a6..4255143371 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -74,7 +74,7 @@ def is_elf(path): if "relocatable" in result: if path.endswith(".ko") and path.find("/lib/modules/") != -1 and is_kernel_module(path): exec_type |= 16 - return exec_type + return (path, exec_type) def is_static_lib(path): if path.endswith('.a') and not os.path.islink(path): @@ -86,7 +86,7 @@ def is_static_lib(path): return start == magic return False -def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped=False): +def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, qa_already_stripped=False): """ Strip executable code (like executables, shared libraries) _in_place_ - Based on sysroot_strip in staging.bbclass @@ -107,6 +107,8 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped= # # First lets figure out all of the files we may have to process # + checkelf = [] + inodecache = {} for root, dirs, files in os.walk(dstdir): for f in files: file = os.path.join(root, f) @@ -132,7 +134,11 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped= # It's a file (or hardlink), not a link # ...but is it ELF, and is it already stripped? - elf_file = is_elf(file) + checkelf.append(file) + inodecache[file] = s.st_ino + results = oe.utils.multiprocess_launch(is_elf, checkelf, d) + for (file, elf_file) in results: + #elf_file = is_elf(file) if elf_file & 1: if elf_file & 2: if qa_already_stripped: @@ -141,12 +147,12 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped= bb.warn("File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dstdir):], pn)) continue - if s.st_ino in inodes: + if inodecache[file] in inodes: os.unlink(file) - os.link(inodes[s.st_ino], file) + os.link(inodes[inodecache[file]], file) else: # break hardlinks so that we do not strip the original. - inodes[s.st_ino] = file + inodes[inodecache[file]] = file bb.utils.copyfile(file, file) elffiles[file] = elf_file |