summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2022-01-22 01:02:51 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-26 06:27:00 +0000
commite8e1e829f47f31bd073937ced77ec26bb177a3ae (patch)
treed57f8db63f2dcba277b95033749d287fbd2759c1 /meta/classes
parent15324dd951e25219e5f0d91f33afee4bc22b9d62 (diff)
downloadpoky-e8e1e829f47f31bd073937ced77ec26bb177a3ae.tar.gz
sstate: A third fix for for touching files inside pseudo
This continues where commit676757f "sstate: fix touching files inside pseudo" and commit 29fc8599 "sstate: another fix for touching files inside pseudo" left off. The previous changes switched from trying to check if the sstate file is writable before touching it, to always touching the sstate file and ignoring any errors. However, if the sstate file is actually a symbolic link that links to nothing, this would actually result in an empty sstate file being created. And this in turn leads to that future setscene tasks will fail when they try to unpack the empty file. Change the code so that if an sstate file linking to nothing already exists, it is overwritten with the new sstate file. Also change it so that the temporary file that is used is always removed, even if ln fails to link the sstate file to it. (From OE-Core rev: 552197a0c4c9f75a9177c00b197ea91296ed9fc4) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/sstate.bbclass14
1 files changed, 9 insertions, 5 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index b45da4fb23..17dcf4cc17 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -862,14 +862,18 @@ sstate_create_package () {
862 fi 862 fi
863 chmod 0664 $TFILE 863 chmod 0664 $TFILE
864 # Skip if it was already created by some other process 864 # Skip if it was already created by some other process
865 if [ ! -e ${SSTATE_PKG} ]; then 865 if [ -h ${SSTATE_PKG} ] && [ ! -e ${SSTATE_PKG} ]; then
866 # There is a symbolic link, but it links to nothing.
867 # Forcefully replace it with the new file.
868 ln -f $TFILE ${SSTATE_PKG} || true
869 elif [ ! -e ${SSTATE_PKG} ]; then
866 # Move into place using ln to attempt an atomic op. 870 # Move into place using ln to attempt an atomic op.
867 # Abort if it already exists 871 # Abort if it already exists
868 ln $TFILE ${SSTATE_PKG} && rm $TFILE 872 ln $TFILE ${SSTATE_PKG} || true
869 else 873 else
870 rm $TFILE 874 touch ${SSTATE_PKG} 2>/dev/null || true
871 fi 875 fi
872 touch ${SSTATE_PKG} 2>/dev/null || true 876 rm $TFILE
873} 877}
874 878
875python sstate_sign_package () { 879python sstate_sign_package () {
@@ -905,7 +909,7 @@ sstate_unpack_package () {
905 909
906 tar -I "$ZSTD" -xvpf ${SSTATE_PKG} 910 tar -I "$ZSTD" -xvpf ${SSTATE_PKG}
907 # update .siginfo atime on local/NFS mirror if it is a symbolic link 911 # update .siginfo atime on local/NFS mirror if it is a symbolic link
908 [ ! -h ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true 912 [ ! -h ${SSTATE_PKG}.siginfo ] || [ ! -e ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true
909 # update each symbolic link instead of any referenced file 913 # update each symbolic link instead of any referenced file
910 touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true 914 touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true
911 [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true 915 [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true