diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2024-02-27 12:16:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-08-25 15:36:30 +0100 |
commit | 6200a0260b059ce9862d68ebcd4954b1d43c14cf (patch) | |
tree | 076519c35cd84539be0982615c206682693e4b3e | |
parent | 0cf0991cb24cfd9c209e22b0429f96b7b36f1591 (diff) | |
download | poky-6200a0260b059ce9862d68ebcd4954b1d43c14cf.tar.gz |
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 <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oe/sstatesig.py | 20 |
1 files changed, 16 insertions, 4 deletions
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): | |||
399 | return siginfo.rpartition('.')[2] | 399 | return siginfo.rpartition('.')[2] |
400 | 400 | ||
401 | def get_time(fullpath): | 401 | def get_time(fullpath): |
402 | return os.stat(fullpath).st_mtime | 402 | # NFS can end up in a weird state where the file exists but has no stat info. |
403 | # If that happens, we assume it doesn't acutally exist and show a warning | ||
404 | try: | ||
405 | return os.stat(fullpath).st_mtime | ||
406 | except FileNotFoundError: | ||
407 | bb.warn("Could not obtain mtime for {}".format(fullpath)) | ||
408 | return None | ||
403 | 409 | ||
404 | # First search in stamps dir | 410 | # First search in stamps dir |
405 | localdata = d.createCopy() | 411 | localdata = d.createCopy() |
@@ -422,13 +428,17 @@ def find_siginfo(pn, taskname, taskhashlist, d): | |||
422 | if taskhashlist: | 428 | if taskhashlist: |
423 | for taskhash in taskhashlist: | 429 | for taskhash in taskhashlist: |
424 | if fullpath.endswith('.%s' % taskhash): | 430 | if fullpath.endswith('.%s' % taskhash): |
425 | hashfiles[taskhash] = {'path':fullpath, 'sstate':False, 'time':get_time(fullpath)} | 431 | mtime = get_time(fullpath) |
432 | if mtime: | ||
433 | hashfiles[taskhash] = {'path':fullpath, 'sstate':False, 'time':mtime} | ||
426 | if len(hashfiles) == len(taskhashlist): | 434 | if len(hashfiles) == len(taskhashlist): |
427 | foundall = True | 435 | foundall = True |
428 | break | 436 | break |
429 | else: | 437 | else: |
430 | hashval = get_hashval(fullpath) | 438 | hashval = get_hashval(fullpath) |
431 | hashfiles[hashval] = {'path':fullpath, 'sstate':False, 'time':get_time(fullpath)} | 439 | mtime = get_time(fullpath) |
440 | if mtime: | ||
441 | hashfiles[hashval] = {'path':fullpath, 'sstate':False, 'time':mtime} | ||
432 | 442 | ||
433 | if not taskhashlist or (len(hashfiles) < 2 and not foundall): | 443 | if not taskhashlist or (len(hashfiles) < 2 and not foundall): |
434 | # That didn't work, look in sstate-cache | 444 | # That didn't work, look in sstate-cache |
@@ -459,7 +469,9 @@ def find_siginfo(pn, taskname, taskhashlist, d): | |||
459 | actual_hashval = get_hashval(fullpath) | 469 | actual_hashval = get_hashval(fullpath) |
460 | if actual_hashval in hashfiles: | 470 | if actual_hashval in hashfiles: |
461 | continue | 471 | continue |
462 | hashfiles[actual_hashval] = {'path':fullpath, 'sstate':True, 'time':get_time(fullpath)} | 472 | mtime = get_time(fullpath) |
473 | if mtime: | ||
474 | hashfiles[actual_hashval] = {'path':fullpath, 'sstate':True, 'time':mtime} | ||
463 | 475 | ||
464 | return hashfiles | 476 | return hashfiles |
465 | 477 | ||