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:27 +0100 |
commit | e1ba46109ea4be3d3b310abaf7f2da3c84a83930 (patch) | |
tree | 6ecddb381be06b2016eee1ede16c5b706c348120 /meta/lib/oe | |
parent | 069a1c4a1520914234dc58b506663fcfd80433e3 (diff) | |
download | poky-e1ba46109ea4be3d3b310abaf7f2da3c84a83930.tar.gz |
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.
(From OE-Core rev: bbe0d3e26484f3f347262d40a8a9d415ce21fb43)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-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): | |||
74 | if "relocatable" in result: | 74 | if "relocatable" in result: |
75 | if path.endswith(".ko") and path.find("/lib/modules/") != -1 and is_kernel_module(path): | 75 | if path.endswith(".ko") and path.find("/lib/modules/") != -1 and is_kernel_module(path): |
76 | exec_type |= 16 | 76 | exec_type |= 16 |
77 | return exec_type | 77 | return (path, exec_type) |
78 | 78 | ||
79 | def is_static_lib(path): | 79 | def is_static_lib(path): |
80 | if path.endswith('.a') and not os.path.islink(path): | 80 | if path.endswith('.a') and not os.path.islink(path): |
@@ -86,7 +86,7 @@ def is_static_lib(path): | |||
86 | return start == magic | 86 | return start == magic |
87 | return False | 87 | return False |
88 | 88 | ||
89 | def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped=False): | 89 | def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, d, qa_already_stripped=False): |
90 | """ | 90 | """ |
91 | Strip executable code (like executables, shared libraries) _in_place_ | 91 | Strip executable code (like executables, shared libraries) _in_place_ |
92 | - Based on sysroot_strip in staging.bbclass | 92 | - Based on sysroot_strip in staging.bbclass |
@@ -107,6 +107,8 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped= | |||
107 | # | 107 | # |
108 | # First lets figure out all of the files we may have to process | 108 | # First lets figure out all of the files we may have to process |
109 | # | 109 | # |
110 | checkelf = [] | ||
111 | inodecache = {} | ||
110 | for root, dirs, files in os.walk(dstdir): | 112 | for root, dirs, files in os.walk(dstdir): |
111 | for f in files: | 113 | for f in files: |
112 | file = os.path.join(root, f) | 114 | file = os.path.join(root, f) |
@@ -132,7 +134,11 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped= | |||
132 | 134 | ||
133 | # It's a file (or hardlink), not a link | 135 | # It's a file (or hardlink), not a link |
134 | # ...but is it ELF, and is it already stripped? | 136 | # ...but is it ELF, and is it already stripped? |
135 | elf_file = is_elf(file) | 137 | checkelf.append(file) |
138 | inodecache[file] = s.st_ino | ||
139 | results = oe.utils.multiprocess_launch(is_elf, checkelf, d) | ||
140 | for (file, elf_file) in results: | ||
141 | #elf_file = is_elf(file) | ||
136 | if elf_file & 1: | 142 | if elf_file & 1: |
137 | if elf_file & 2: | 143 | if elf_file & 2: |
138 | if qa_already_stripped: | 144 | if qa_already_stripped: |
@@ -141,12 +147,12 @@ def strip_execs(pn, dstdir, strip_cmd, libdir, base_libdir, qa_already_stripped= | |||
141 | bb.warn("File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dstdir):], pn)) | 147 | bb.warn("File '%s' from %s was already stripped, this will prevent future debugging!" % (file[len(dstdir):], pn)) |
142 | continue | 148 | continue |
143 | 149 | ||
144 | if s.st_ino in inodes: | 150 | if inodecache[file] in inodes: |
145 | os.unlink(file) | 151 | os.unlink(file) |
146 | os.link(inodes[s.st_ino], file) | 152 | os.link(inodes[inodecache[file]], file) |
147 | else: | 153 | else: |
148 | # break hardlinks so that we do not strip the original. | 154 | # break hardlinks so that we do not strip the original. |
149 | inodes[s.st_ino] = file | 155 | inodes[inodecache[file]] = file |
150 | bb.utils.copyfile(file, file) | 156 | bb.utils.copyfile(file, file) |
151 | elffiles[file] = elf_file | 157 | elffiles[file] = elf_file |
152 | 158 | ||