summaryrefslogtreecommitdiffstats
path: root/meta/classes/sstate.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-12-12 22:58:17 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-13 13:07:01 +0000
commit3a83fec8142741d79c3462255847e5aa0e5d47fd (patch)
tree2ae1d0b74548de51bd9fb2fdff03554082a4768c /meta/classes/sstate.bbclass
parent402b552239e836a1766a6f53fb02587e14963827 (diff)
downloadpoky-3a83fec8142741d79c3462255847e5aa0e5d47fd.tar.gz
sstate: Improve move into place op and touch file
Depending on the kernel and coreutils version, mv operations test for existence of files and can potentially race. It also leads to the file always changing which leads to potential problems if using and NFS share and there are other readers. Using ln instead means we don't overwrite the file if it already exists meaning other readers aren't disrupted and should work more reliably on NFS which is used for sstate on the autobuilder. Since we're not overwriting files, touch the file to show activity as would have been done it it were reused from sstate. (From OE-Core rev: d8e9a22a4e23616ad01627c1e472296b1e26f13c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r--meta/classes/sstate.bbclass6
1 files changed, 5 insertions, 1 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 356fe7ec18..b4ffffcd98 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -776,6 +776,7 @@ sstate_task_postfunc[dirs] = "${WORKDIR}"
776sstate_create_package () { 776sstate_create_package () {
777 # Exit early if it already exists 777 # Exit early if it already exists
778 if [ -e ${SSTATE_PKG} ]; then 778 if [ -e ${SSTATE_PKG} ]; then
779 touch ${SSTATE_PKG}
779 return 780 return
780 fi 781 fi
781 782
@@ -803,10 +804,13 @@ sstate_create_package () {
803 chmod 0664 $TFILE 804 chmod 0664 $TFILE
804 # Skip if it was already created by some other process 805 # Skip if it was already created by some other process
805 if [ ! -e ${SSTATE_PKG} ]; then 806 if [ ! -e ${SSTATE_PKG} ]; then
806 mv -f $TFILE ${SSTATE_PKG} 807 # Move into place using ln to attempt an atomic op.
808 # Abort if it already exists
809 ln $TFILE ${SSTATE_PKG} && rm $TFILE
807 else 810 else
808 rm $TFILE 811 rm $TFILE
809 fi 812 fi
813 touch ${SSTATE_PKG}
810} 814}
811 815
812python sstate_sign_package () { 816python sstate_sign_package () {