]> code.ossystems Code Review - openembedded-core.git/commitdiff
package: Fix race between do_package and do_packagedata
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 15 Aug 2019 20:55:16 +0000 (21:55 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 21 Aug 2019 12:21:46 +0000 (13:21 +0100)
do_package has PKGDESTWORK as a cleandir and do_packagedata has it as an sstate-input
dir. This means do_package wipes out the directory at both do_package and do_package_setscene.

do_package_setscene and do_packagedata_setscene can run in parallel when installing from
sstate which means they can wipe out parts of each other leading to interesting
build failures.

We therefore have to add in a hardlink copy so that the directories can work independently
of each other.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/package.bbclass

index e67bb5bd97d21f10d357b50d7e9cd78ed50565d2..114d6559f5e3ccd045b969fe713d3b4c586745b4 100644 (file)
@@ -2252,14 +2252,18 @@ python do_package_setscene () {
 }
 addtask do_package_setscene
 
-do_packagedata () {
-       :
+# Copy from PKGDESTWORK to tempdirectory as tempdirectory can be cleaned at both
+# do_package_setscene and do_packagedata_setscene leading to races
+python do_packagedata () {
+    src = d.expand("${PKGDESTWORK}")
+    dest = d.expand("${WORKDIR}/pkgdata-pdata-input")
+    oe.path.copyhardlinktree(src, dest)
 }
 
 addtask packagedata before do_build after do_package
 
 SSTATETASKS += "do_packagedata"
-do_packagedata[sstate-inputdirs] = "${PKGDESTWORK}"
+do_packagedata[sstate-inputdirs] = "${WORKDIR}/pkgdata-pdata-input"
 do_packagedata[sstate-outputdirs] = "${PKGDATA_DIR}"
 do_packagedata[stamp-extra-info] = "${MACHINE_ARCH}"