From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 02/10] package: Rework PACKAGELOCK based upon sstate for do_packagedata
Date: Fri, 20 Jul 2018 11:39:40 +0100 [thread overview]
Message-ID: <20180720103948.30044-2-richard.purdie@linuxfoundation.org> (raw)
In-Reply-To: <20180720103948.30044-1-richard.purdie@linuxfoundation.org>
I think this lock dates from before we had sstate for do_packagedata.
Since WORKDIR is recipe specific and we write into WORKDIR, we no longer need
any write locks in the do_packagedata code itself, its handled by the sstate
task lock for the final copy in at the end. The final write lock can be simply
removed.
The only time we need read locking is when actually reading data from the
shared directory. We can therefore reduce the window the lock is held
significantly as well, hence improving the speed of packagedata tasks running
in parallel.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/classes/package.bbclass | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 07bc37879c6..6f7015d9129 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1411,9 +1411,6 @@ fi
pkgdest = d.getVar('PKGDEST')
pkgdatadir = d.getVar('PKGDESTWORK')
- # Take shared lock since we're only reading, not writing
- lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
-
data_file = pkgdatadir + d.expand("/${PN}" )
f = open(data_file, 'w')
f.write("PACKAGES: %s\n" % packages)
@@ -1518,7 +1515,6 @@ fi
if bb.data.inherits_class('allarch', d) and not bb.data.inherits_class('packagegroup', d):
write_extra_runtime_pkgs(global_variants, packages, pkgdatadir)
- bb.utils.unlockfile(lf)
}
emit_pkgdata[dirs] = "${PKGDESTWORK}/runtime ${PKGDESTWORK}/runtime-reverse ${PKGDESTWORK}/runtime-rprovides"
@@ -1629,9 +1625,6 @@ python package_do_shlibs() {
shlibswork_dir = d.getVar('SHLIBSWORKDIR')
- # Take shared lock since we're only reading, not writing
- lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
-
def linux_so(file, needed, sonames, renames, pkgver):
needs_ldconfig = False
ldir = os.path.dirname(file).replace(pkgdest + "/" + pkg, '')
@@ -1744,7 +1737,11 @@ python package_do_shlibs() {
use_ldconfig = bb.utils.contains('DISTRO_FEATURES', 'ldconfig', True, False, d)
needed = {}
+
+ # Take shared lock since we're only reading, not writing
+ lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
shlib_provider = oe.package.read_shlib_providers(d)
+ bb.utils.unlockfile(lf)
for pkg in shlib_pkgs:
private_libs = d.getVar('PRIVATE_LIBS_' + pkg) or d.getVar('PRIVATE_LIBS') or ""
@@ -1800,8 +1797,6 @@ python package_do_shlibs() {
d.setVar('pkg_postinst_%s' % pkg, postinst)
bb.debug(1, 'LIBNAMES: pkg %s sonames %s' % (pkg, sonames))
- bb.utils.unlockfile(lf)
-
assumed_libs = d.getVar('ASSUME_SHLIBS')
if assumed_libs:
libdir = d.getVar("libdir")
@@ -1914,9 +1909,6 @@ python package_do_pkgconfig () {
if hdr == 'Requires':
pkgconfig_needed[pkg] += exp.replace(',', ' ').split()
- # Take shared lock since we're only reading, not writing
- lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
-
for pkg in packages.split():
pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist")
if pkgconfig_provided[pkg] != []:
@@ -1925,6 +1917,9 @@ python package_do_pkgconfig () {
f.write('%s\n' % p)
f.close()
+ # Take shared lock since we're only reading, not writing
+ lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True)
+
# Go from least to most specific since the last one found wins
for dir in reversed(shlibs_dirs):
if not os.path.exists(dir):
@@ -1940,6 +1935,8 @@ python package_do_pkgconfig () {
for l in lines:
pkgconfig_provided[pkg].append(l.rstrip())
+ bb.utils.unlockfile(lf)
+
for pkg in packages.split():
deps = []
for n in pkgconfig_needed[pkg]:
@@ -1957,8 +1954,6 @@ python package_do_pkgconfig () {
for dep in deps:
fd.write(dep + '\n')
fd.close()
-
- bb.utils.unlockfile(lf)
}
def read_libdep_files(d):
--
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 ` Richard Purdie [this message]
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 ` [PATCH 07/10] package: Allow parallel processing of shlib analysis Richard Purdie
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-2-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