From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 07/10] package: Allow parallel processing of shlib analysis
Date: Fri, 20 Jul 2018 11:39:45 +0100 [thread overview]
Message-ID: <20180720103948.30044-7-richard.purdie@linuxfoundation.org> (raw)
In-Reply-To: <20180720103948.30044-1-richard.purdie@linuxfoundation.org>
This function is a bit more invasive to add parallelism to but
allows the shlibs analysis to happen in multiple threads. In order
to return values correctly/safely the data types needed tweaking
to avoid lists and use immutable objects.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/classes/package.bbclass | 39 ++++++++++++++++++++++++------------
1 file changed, 26 insertions(+), 13 deletions(-)
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 03fe18de580..74c96b9b725 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1631,25 +1631,28 @@ python package_do_shlibs() {
shlibswork_dir = d.getVar('SHLIBSWORKDIR')
- def linux_so(file, needed, sonames, renames, pkgver):
+ def linux_so(file, pkg, pkgver, d):
needs_ldconfig = False
+ needed = set()
+ sonames = set()
+ renames = []
ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '')
cmd = d.getVar('OBJDUMP') + " -p " + pipes.quote(file) + " 2>/dev/null"
fd = os.popen(cmd)
lines = fd.readlines()
fd.close()
- rpath = []
+ rpath = tuple()
for l in lines:
m = re.match("\s+RPATH\s+([^\s]*)", l)
if m:
rpaths = m.group(1).replace("$ORIGIN", ldir).split(":")
- rpath = list(map(os.path.normpath, rpaths))
+ rpath = tuple(map(os.path.normpath, rpaths))
for l in lines:
m = re.match("\s+NEEDED\s+([^\s]*)", l)
if m:
dep = m.group(1)
- if dep not in needed[pkg]:
- needed[pkg].append((dep, file, rpath))
+ if dep not in needed:
+ needed.add((dep, file, rpath))
m = re.match("\s+SONAME\s+([^\s]*)", l)
if m:
this_soname = m.group(1)
@@ -1657,12 +1660,12 @@ python package_do_shlibs() {
if not prov in sonames:
# if library is private (only used by package) then do not build shlib for it
if not private_libs or this_soname not in private_libs:
- sonames.append(prov)
+ sonames.add(prov)
if libdir_re.match(os.path.dirname(file)):
needs_ldconfig = True
if snap_symlinks and (os.path.basename(file) != this_soname):
renames.append((file, os.path.join(os.path.dirname(file), this_soname)))
- return needs_ldconfig
+ return (needs_ldconfig, needed, sonames, renames)
def darwin_so(file, needed, sonames, renames, pkgver):
if not os.path.exists(file):
@@ -1761,9 +1764,10 @@ python package_do_shlibs() {
if not pkgver:
pkgver = ver
- needed[pkg] = []
- sonames = list()
- renames = list()
+ needed[pkg] = set()
+ sonames = set()
+ renames = []
+ linuxlist = []
for file in pkgfiles[pkg]:
soname = None
if cpath.islink(file):
@@ -1773,8 +1777,17 @@ python package_do_shlibs() {
elif targetos.startswith("mingw"):
mingw_dll(file, needed, sonames, renames, pkgver)
elif os.access(file, os.X_OK) or lib_re.match(file):
- ldconfig = linux_so(file, needed, sonames, renames, pkgver)
- needs_ldconfig = needs_ldconfig or ldconfig
+ linuxlist.append(file)
+
+ if linuxlist:
+ results = oe.utils.multiprocess_launch(linux_so, linuxlist, d, extraargs=(pkg, pkgver, d))
+ for r in results:
+ ldconfig = r[0]
+ needed[pkg] |= r[1]
+ sonames |= r[2]
+ renames.extend(r[3])
+ needs_ldconfig = needs_ldconfig or ldconfig
+
for (old, new) in renames:
bb.note("Renaming %s to %s" % (old, new))
os.rename(old, new)
@@ -1840,7 +1853,7 @@ python package_do_shlibs() {
for k in shlib_provider[n[0]].keys():
shlib_provider_path.append(k)
match = None
- for p in n[2] + shlib_provider_path + libsearchpath:
+ for p in list(n[2]) + shlib_provider_path + libsearchpath:
if p in shlib_provider[n[0]]:
match = p
break
--
2.17.1
next prev parent reply other threads:[~2018-07-20 10:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-20 10:39 [PATCH 01/10] utils: Add multiprocess_launch API and testcase Richard Purdie
2018-07-20 10:39 ` [PATCH 02/10] package: Rework PACKAGELOCK based upon sstate for do_packagedata Richard Purdie
2018-07-20 10:39 ` [PATCH 03/10] package_ipk|deb: Use oe.utils.multiprocess_launch Richard Purdie
2018-07-20 10:39 ` [PATCH 04/10] package: Drop subshell usage for dwarfsrcfile generation Richard Purdie
2018-07-20 10:39 ` [PATCH 05/10] package: Don't use subshell to execute file Richard Purdie
2018-07-20 10:39 ` [PATCH 06/10] package: Allow parallel processing of debug splitting Richard Purdie
2018-07-20 10:39 ` Richard Purdie [this message]
2018-07-20 10:39 ` [PATCH 08/10] package: Refactor to remove isElf/is_elf function duplication Richard Purdie
2018-07-20 10:39 ` [PATCH 09/10] package: Call file to determine elf status in parallel Richard Purdie
2018-07-20 10:39 ` [PATCH 10/10] sstate/bitbake.conf: Use pigz if available Richard Purdie
2018-07-20 11:02 ` ✗ patchtest: failure for "utils: Add multiprocess_launch..." and 9 more Patchwork
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=20180720103948.30044-7-richard.purdie@linuxfoundation.org \
--to=richard.purdie@linuxfoundation.org \
--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