summaryrefslogtreecommitdiff
path: root/poky/meta/lib/oe/sstatesig.py
diff options
context:
space:
mode:
Diffstat (limited to 'poky/meta/lib/oe/sstatesig.py')
-rw-r--r--poky/meta/lib/oe/sstatesig.py27
1 files changed, 22 insertions, 5 deletions
diff --git a/poky/meta/lib/oe/sstatesig.py b/poky/meta/lib/oe/sstatesig.py
index b6f8ab92cb..1f97606763 100644
--- a/poky/meta/lib/oe/sstatesig.py
+++ b/poky/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
@@ -552,6 +564,7 @@ def OEOuthashBasic(path, sigfile, task, d):
if task == "package":
include_timestamps = True
include_root = False
+ source_date_epoch = float(d.getVar("SOURCE_DATE_EPOCH"))
hash_version = d.getVar('HASHEQUIV_HASH_VERSION')
extra_sigdata = d.getVar("HASHEQUIV_EXTRA_SIGDATA")
@@ -643,7 +656,11 @@ def OEOuthashBasic(path, sigfile, task, d):
raise Exception(msg).with_traceback(e.__traceback__)
if include_timestamps:
- update_hash(" %10d" % s.st_mtime)
+ # Need to clamp to SOURCE_DATE_EPOCH
+ if s.st_mtime > source_date_epoch:
+ update_hash(" %10d" % source_date_epoch)
+ else:
+ update_hash(" %10d" % s.st_mtime)
update_hash(" ")
if stat.S_ISBLK(s.st_mode) or stat.S_ISCHR(s.st_mode):