]> code.ossystems Code Review - openembedded-core.git/commitdiff
sstate.bbclass: Do not fail if files cannot be touched
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>
Thu, 30 Apr 2020 17:49:55 +0000 (19:49 +0200)
committerSteve Sakoman <steve@sakoman.com>
Mon, 11 May 2020 16:14:42 +0000 (06:14 -1000)
It may be that a file is not allowed to be touched, e.g., if it is a
symbolic link into a global sstate cache served over NFS.

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>
meta/classes/sstate.bbclass

index c73c3b42a7fa82635e7bddbcb751462543cc38d0..aa9c30b4e106ecc50e93378345e13dafb3a75227 100644 (file)
@@ -690,7 +690,10 @@ def sstate_package(ss, d):
     if not os.path.exists(siginfo):
         bb.siggen.dump_this_task(siginfo, d)
     else:
-        os.utime(siginfo, None)
+        try:
+            os.utime(siginfo, None)
+        except PermissionError:
+            pass
 
     return
 
@@ -776,7 +779,7 @@ sstate_task_postfunc[dirs] = "${WORKDIR}"
 sstate_create_package () {
        # Exit early if it already exists
        if [ -e ${SSTATE_PKG} ]; then
-               touch ${SSTATE_PKG}
+               [ ! -w ${SSTATE_PKG} ] || touch ${SSTATE_PKG}
                return
        fi
 
@@ -810,7 +813,7 @@ sstate_create_package () {
        else
                rm $TFILE
        fi
-       touch ${SSTATE_PKG}
+       [ ! -w ${SSTATE_PKG} ] || touch ${SSTATE_PKG}
 }
 
 python sstate_sign_package () {
@@ -1122,7 +1125,11 @@ python sstate_eventhandler() {
         if not os.path.exists(siginfo):
             bb.siggen.dump_this_task(siginfo, d)
         else:
-            os.utime(siginfo, None)
+            try:
+                os.utime(siginfo, None)
+            except PermissionError:
+                pass
+
 }
 
 SSTATE_PRUNE_OBSOLETEWORKDIR ?= "1"