1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 00:20:08 +00:00

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>
This commit is contained in:
Richard Purdie
2019-12-12 22:58:17 +00:00
parent 402b552239
commit 3a83fec814
+5 -1
View File
@@ -776,6 +776,7 @@ sstate_task_postfunc[dirs] = "${WORKDIR}"
sstate_create_package () {
# Exit early if it already exists
if [ -e ${SSTATE_PKG} ]; then
touch ${SSTATE_PKG}
return
fi
@@ -803,10 +804,13 @@ sstate_create_package () {
chmod 0664 $TFILE
# Skip if it was already created by some other process
if [ ! -e ${SSTATE_PKG} ]; then
mv -f $TFILE ${SSTATE_PKG}
# Move into place using ln to attempt an atomic op.
# Abort if it already exists
ln $TFILE ${SSTATE_PKG} && rm $TFILE
else
rm $TFILE
fi
touch ${SSTATE_PKG}
}
python sstate_sign_package () {