summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2019-09-26 12:57:51 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-27 13:02:16 +0100
commit68092163cccb23ed943facea77600c02e95192c4 (patch)
tree1818e235fc3e10579a762b839016a2ab6df5cc58
parent72051e74d609d628eab237a776394384c099504e (diff)
downloadpoky-68092163cccb23ed943facea77600c02e95192c4.tar.gz
classes/reproducible_build: Move SDE deploy to another directory
The deployment of the source date epoch file had a race condition where any task attempting to read from the file would race with creation of the sstate archive for the do_deploy_source_date_epoch task. The creation of the sstate archive requires moving the directory to a temporary location, then moving it back. This means that the file disappears for a short period of time, which will cause a failure if any other task is running and trying to open the file to get the current source date epoch. The solution is to copy the source date epoch file to a separate directory when deploying so the file never disappears. When the file is restored from sstate, it is moved to the correct location after being extracted. [YOCTO #13501] (From OE-Core rev: ac27d12fe5480e9b8cc93de6a32bf9631c52d7f4) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/reproducible_build.bbclass12
1 files changed, 10 insertions, 2 deletions
diff --git a/meta/classes/reproducible_build.bbclass b/meta/classes/reproducible_build.bbclass
index 8788ad7145..99b749a9ee 100644
--- a/meta/classes/reproducible_build.bbclass
+++ b/meta/classes/reproducible_build.bbclass
@@ -39,19 +39,27 @@ inherit ${@oe.utils.ifelse(d.getVar('BUILD_REPRODUCIBLE_BINARIES') == '1', 'repr
39 39
40SDE_DIR ="${WORKDIR}/source-date-epoch" 40SDE_DIR ="${WORKDIR}/source-date-epoch"
41SDE_FILE = "${SDE_DIR}/__source_date_epoch.txt" 41SDE_FILE = "${SDE_DIR}/__source_date_epoch.txt"
42SDE_DEPLOYDIR = "${WORKDIR}/deploy-source-date-epoch"
42 43
43SSTATETASKS += "do_deploy_source_date_epoch" 44SSTATETASKS += "do_deploy_source_date_epoch"
44 45
45do_deploy_source_date_epoch () { 46do_deploy_source_date_epoch () {
46 echo "Deploying SDE to ${SDE_DIR}." 47 echo "Deploying SDE to ${SDE_DIR}."
48 mkdir -p ${SDE_DEPLOYDIR}
49 if [ -e ${SDE_FILE} ]; then
50 cp -p ${SDE_FILE} ${SDE_DEPLOYDIR}/__source_date_epoch.txt
51 fi
47} 52}
48 53
49python do_deploy_source_date_epoch_setscene () { 54python do_deploy_source_date_epoch_setscene () {
50 sstate_setscene(d) 55 sstate_setscene(d)
56 sde_file = os.path.join(d.getVar('SDE_DEPLOYDIR'), '__source_date_epoch.txt')
57 if os.path.exists(sde_file):
58 os.rename(sde_file, d.getVar('SDE_FILE'))
51} 59}
52 60
53do_deploy_source_date_epoch[dirs] = "${SDE_DIR}" 61do_deploy_source_date_epoch[dirs] = "${SDE_DEPLOYDIR}"
54do_deploy_source_date_epoch[sstate-plaindirs] = "${SDE_DIR}" 62do_deploy_source_date_epoch[sstate-plaindirs] = "${SDE_DEPLOYDIR}"
55addtask do_deploy_source_date_epoch_setscene 63addtask do_deploy_source_date_epoch_setscene
56addtask do_deploy_source_date_epoch before do_configure after do_patch 64addtask do_deploy_source_date_epoch before do_configure after do_patch
57 65