diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-04-20 08:25:32 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-04-23 17:26:04 +0100 |
commit | a67ad9544af1c0d561ae1d5c95abe5147ac7bc17 (patch) | |
tree | c65a33f43e960821ffbcbc4e09531a0d0bd359d2 | |
parent | 9da1b6e59a4d4234a276bb2ffd37fdb7d9b3183c (diff) | |
download | poky-a67ad9544af1c0d561ae1d5c95abe5147ac7bc17.tar.gz |
package: Fix PACKAGELOCK handling
PACKAGELOCK is there to protect readers of PKGDATA_DIR from writes and files
changing whilst they're being read. With various changes to the codebase,
the lock code has become confused as the files are now written by the sstate
code in do_packagedata, not in do_package directly any longer.
This change cleans up the code so read sites take the shared lock (anything in
do_package), write sites take the full lock (do_packagedata sstate).
The lock from do_package sstate is no longer needed since it doesn't write
outside WORKDIR.
(From OE-Core rev: d46cadbbb42aa71f9436d640891d6ccc8f8e3618)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/package.bbclass | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 0436d919e7..e03d4502c4 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass | |||
@@ -1615,7 +1615,7 @@ python package_do_shlibs() { | |||
1615 | shlibswork_dir = d.getVar('SHLIBSWORKDIR') | 1615 | shlibswork_dir = d.getVar('SHLIBSWORKDIR') |
1616 | 1616 | ||
1617 | # Take shared lock since we're only reading, not writing | 1617 | # Take shared lock since we're only reading, not writing |
1618 | lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}")) | 1618 | lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True) |
1619 | 1619 | ||
1620 | def linux_so(file, needed, sonames, renames, pkgver): | 1620 | def linux_so(file, needed, sonames, renames, pkgver): |
1621 | needs_ldconfig = False | 1621 | needs_ldconfig = False |
@@ -1900,7 +1900,7 @@ python package_do_pkgconfig () { | |||
1900 | pkgconfig_needed[pkg] += exp.replace(',', ' ').split() | 1900 | pkgconfig_needed[pkg] += exp.replace(',', ' ').split() |
1901 | 1901 | ||
1902 | # Take shared lock since we're only reading, not writing | 1902 | # Take shared lock since we're only reading, not writing |
1903 | lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}")) | 1903 | lf = bb.utils.lockfile(d.expand("${PACKAGELOCK}"), True) |
1904 | 1904 | ||
1905 | for pkg in packages.split(): | 1905 | for pkg in packages.split(): |
1906 | pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist") | 1906 | pkgs_file = os.path.join(shlibswork_dir, pkg + ".pclist") |
@@ -2233,11 +2233,9 @@ do_package[dirs] = "${SHLIBSWORKDIR} ${PKGDESTWORK} ${D}" | |||
2233 | do_package[vardeps] += "${PACKAGEBUILDPKGD} ${PACKAGESPLITFUNCS} ${PACKAGEFUNCS} ${@gen_packagevar(d)}" | 2233 | do_package[vardeps] += "${PACKAGEBUILDPKGD} ${PACKAGESPLITFUNCS} ${PACKAGEFUNCS} ${@gen_packagevar(d)}" |
2234 | addtask package after do_install | 2234 | addtask package after do_install |
2235 | 2235 | ||
2236 | PACKAGELOCK = "${STAGING_DIR}/package-output.lock" | ||
2237 | SSTATETASKS += "do_package" | 2236 | SSTATETASKS += "do_package" |
2238 | do_package[cleandirs] = "${PKGDEST} ${PKGDESTWORK}" | 2237 | do_package[cleandirs] = "${PKGDEST} ${PKGDESTWORK}" |
2239 | do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST} ${PKGDESTWORK}" | 2238 | do_package[sstate-plaindirs] = "${PKGD} ${PKGDEST} ${PKGDESTWORK}" |
2240 | do_package[sstate-lockfile-shared] = "${PACKAGELOCK}" | ||
2241 | do_package_setscene[dirs] = "${STAGING_DIR}" | 2239 | do_package_setscene[dirs] = "${STAGING_DIR}" |
2242 | 2240 | ||
2243 | python do_package_setscene () { | 2241 | python do_package_setscene () { |
@@ -2252,9 +2250,12 @@ do_packagedata () { | |||
2252 | addtask packagedata before do_build after do_package | 2250 | addtask packagedata before do_build after do_package |
2253 | 2251 | ||
2254 | SSTATETASKS += "do_packagedata" | 2252 | SSTATETASKS += "do_packagedata" |
2253 | # PACKAGELOCK protects readers of PKGDATA_DIR against writes | ||
2254 | # whilst code is reading in do_package | ||
2255 | PACKAGELOCK = "${STAGING_DIR}/package-output.lock" | ||
2255 | do_packagedata[sstate-inputdirs] = "${PKGDESTWORK}" | 2256 | do_packagedata[sstate-inputdirs] = "${PKGDESTWORK}" |
2256 | do_packagedata[sstate-outputdirs] = "${PKGDATA_DIR}" | 2257 | do_packagedata[sstate-outputdirs] = "${PKGDATA_DIR}" |
2257 | do_packagedata[sstate-lockfile-shared] = "${PACKAGELOCK}" | 2258 | do_packagedata[sstate-lockfile] = "${PACKAGELOCK}" |
2258 | do_packagedata[stamp-extra-info] = "${MACHINE_ARCH}" | 2259 | do_packagedata[stamp-extra-info] = "${MACHINE_ARCH}" |
2259 | 2260 | ||
2260 | python do_packagedata_setscene () { | 2261 | python do_packagedata_setscene () { |