]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
meta/lib/oe/sstatesig.py: do not error out if sstate files fail on os.stat()
authorAlexander Kanavin <alex.kanavin@gmail.com>
Tue, 27 Feb 2024 11:16:11 +0000 (12:16 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 25 Aug 2024 14:36:26 +0000 (15:36 +0100)
There's an ongoing issue with the autobuilder NFS:
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/6463/steps/14/logs/stdio

The file entry exists, but os.stat returns a 'file not found; error. It's not
clear how and why such entries appear, but they do produce printdiff test failures
and should not be relevant in context of the printdiff.

[RP: Move wrapping to get_time() function to cover all cases and add comment]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/sstatesig.py

index b6f8ab92cb60df837b5445cfbfcebe9ec1cfea90..f883497292dbf049336e34cc09b5346b925a26b6 100644 (file)
@@ -399,7 +399,13 @@ def find_siginfo(pn, taskname, taskhashlist, d):
             return siginfo.rpartition('.')[2]
 
     def get_time(fullpath):
-        return os.stat(fullpath).st_mtime
+        # NFS can end up in a weird state where the file exists but has no stat info.
+        # If that happens, we assume it doesn't acutally exist and show a warning
+        try:
+            return os.stat(fullpath).st_mtime
+        except FileNotFoundError:
+            bb.warn("Could not obtain mtime for {}".format(fullpath))
+            return None
 
     # First search in stamps dir
     localdata = d.createCopy()
@@ -422,13 +428,17 @@ def find_siginfo(pn, taskname, taskhashlist, d):
         if taskhashlist:
             for taskhash in taskhashlist:
                 if fullpath.endswith('.%s' % taskhash):
-                    hashfiles[taskhash] = {'path':fullpath, 'sstate':False, 'time':get_time(fullpath)}
+                    mtime = get_time(fullpath)
+                    if mtime:
+                        hashfiles[taskhash] = {'path':fullpath, 'sstate':False, 'time':mtime}
                     if len(hashfiles) == len(taskhashlist):
                         foundall = True
                         break
         else:
             hashval = get_hashval(fullpath)
-            hashfiles[hashval] = {'path':fullpath, 'sstate':False, 'time':get_time(fullpath)}
+            mtime = get_time(fullpath)
+            if mtime:
+                hashfiles[hashval] = {'path':fullpath, 'sstate':False, 'time':mtime}
 
     if not taskhashlist or (len(hashfiles) < 2 and not foundall):
         # That didn't work, look in sstate-cache
@@ -459,7 +469,9 @@ def find_siginfo(pn, taskname, taskhashlist, d):
                 actual_hashval = get_hashval(fullpath)
                 if actual_hashval in hashfiles:
                     continue
-                hashfiles[actual_hashval] = {'path':fullpath, 'sstate':True, 'time':get_time(fullpath)}
+                mtime = get_time(fullpath)
+                if mtime:
+                    hashfiles[actual_hashval] = {'path':fullpath, 'sstate':True, 'time':mtime}
 
     return hashfiles