summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2022-01-29 23:07:32 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-16 09:48:51 +0000
commit094a3ba047ea59bab0660f7fcdbc163bba68c503 (patch)
treeab3fae344b4848d5aa97b61ddbefb11095774ec4
parent4cd2d8de2a19b213118c0b696bbc5c4506f60af0 (diff)
downloadpoky-094a3ba047ea59bab0660f7fcdbc163bba68c503.tar.gz
sstate: A third fix for for touching files inside pseudo
This continues where commit 676757f "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. Change-Id: I3800f98d0f2a0dd076352df85fad7c81460e733d (From OE-Core rev: f3cd092bf9f66d8d73075e5b777d89d8598691dd) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 c2720cde92..00a0e8fbd7 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -841,14 +841,18 @@ sstate_create_package () {
841 fi 841 fi
842 chmod 0664 $TFILE 842 chmod 0664 $TFILE
843 # Skip if it was already created by some other process 843 # Skip if it was already created by some other process
844 if [ ! -e ${SSTATE_PKG} ]; then 844 if [ -h ${SSTATE_PKG} ] && [ ! -e ${SSTATE_PKG} ]; then
845 # There is a symbolic link, but it links to nothing.
846 # Forcefully replace it with the new file.
847 ln -f $TFILE ${SSTATE_PKG} || true
848 elif [ ! -e ${SSTATE_PKG} ]; then
845 # Move into place using ln to attempt an atomic op. 849 # Move into place using ln to attempt an atomic op.
846 # Abort if it already exists 850 # Abort if it already exists
847 ln $TFILE ${SSTATE_PKG} && rm $TFILE 851 ln $TFILE ${SSTATE_PKG} || true
848 else 852 else
849 rm $TFILE 853 touch ${SSTATE_PKG} 2>/dev/null || true
850 fi 854 fi
851 touch ${SSTATE_PKG} 2>/dev/null || true 855 rm $TFILE
852} 856}
853 857
854python sstate_sign_package () { 858python sstate_sign_package () {
@@ -878,7 +882,7 @@ python sstate_report_unihash() {
878sstate_unpack_package () { 882sstate_unpack_package () {
879 tar -xvzf ${SSTATE_PKG} 883 tar -xvzf ${SSTATE_PKG}
880 # update .siginfo atime on local/NFS mirror if it is a symbolic link 884 # update .siginfo atime on local/NFS mirror if it is a symbolic link
881 [ ! -h ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true 885 [ ! -h ${SSTATE_PKG}.siginfo ] || [ ! -e ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true
882 # update each symbolic link instead of any referenced file 886 # update each symbolic link instead of any referenced file
883 touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true 887 touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true
884 [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true 888 [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true