summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2022-01-29 22:44:53 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-10 13:25:48 +0000
commit7527a35037973348602eec89f0443ac729ef64bc (patch)
treedf4cd58ab50f15ec422e1906af93371fce46f195 /meta
parentb1bb20b5c0da635be1dfb23f65b4d5e10b6a637a (diff)
downloadpoky-7527a35037973348602eec89f0443ac729ef64bc.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: 3eceda67a1098ab9641cb1b7fc789048b7daeae8) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> (cherry picked from commit b2a5d9bc61e0b2b7e0f187a262a514952ed30563) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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 da29225983..caa25815e0 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -827,14 +827,18 @@ sstate_create_package () {
827 fi 827 fi
828 chmod 0664 $TFILE 828 chmod 0664 $TFILE
829 # Skip if it was already created by some other process 829 # Skip if it was already created by some other process
830 if [ ! -e ${SSTATE_PKG} ]; then 830 if [ -h ${SSTATE_PKG} ] && [ ! -e ${SSTATE_PKG} ]; then
831 # There is a symbolic link, but it links to nothing.
832 # Forcefully replace it with the new file.
833 ln -f $TFILE ${SSTATE_PKG} || true
834 elif [ ! -e ${SSTATE_PKG} ]; then
831 # Move into place using ln to attempt an atomic op. 835 # Move into place using ln to attempt an atomic op.
832 # Abort if it already exists 836 # Abort if it already exists
833 ln $TFILE ${SSTATE_PKG} && rm $TFILE 837 ln $TFILE ${SSTATE_PKG} || true
834 else 838 else
835 rm $TFILE 839 touch ${SSTATE_PKG} 2>/dev/null || true
836 fi 840 fi
837 touch ${SSTATE_PKG} 2>/dev/null || true 841 rm $TFILE
838} 842}
839 843
840python sstate_sign_package () { 844python sstate_sign_package () {
@@ -864,7 +868,7 @@ python sstate_report_unihash() {
864sstate_unpack_package () { 868sstate_unpack_package () {
865 tar -xvzf ${SSTATE_PKG} 869 tar -xvzf ${SSTATE_PKG}
866 # update .siginfo atime on local/NFS mirror if it is a symbolic link 870 # update .siginfo atime on local/NFS mirror if it is a symbolic link
867 [ ! -h ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true 871 [ ! -h ${SSTATE_PKG}.siginfo ] || [ ! -e ${SSTATE_PKG}.siginfo ] || touch -a ${SSTATE_PKG}.siginfo 2>/dev/null || true
868 # update each symbolic link instead of any referenced file 872 # update each symbolic link instead of any referenced file
869 touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true 873 touch --no-dereference ${SSTATE_PKG} 2>/dev/null || true
870 [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true 874 [ ! -e ${SSTATE_PKG}.sig ] || touch --no-dereference ${SSTATE_PKG}.sig 2>/dev/null || true