From 6200a0260b059ce9862d68ebcd4954b1d43c14cf Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Tue, 27 Feb 2024 12:16:11 +0100 Subject: meta/lib/oe/sstatesig.py: do not error out if sstate files fail on os.stat() 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] (From OE-Core rev: b7e702752b6a2dfc8493639a8529cf1a16793f03) Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- meta/lib/oe/sstatesig.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'meta/lib') diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py index b6f8ab92cb..f883497292 100644 --- a/meta/lib/oe/sstatesig.py +++ b/meta/lib/oe/sstatesig.py @@ -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 -- cgit v1.2.3-54-g00ecf