bitbake: lib/bb/parse: properly handle OSError when updating mtime cache

If a file no longer exists, drop it from the cache silently instead of
generating a traceback. This was visible in some cases when a recipe was
deleted when bitbake was resident in memory.

(Bitbake rev: fe105b9042bdac4afd9f38fcf92bfdc2c04ec23f)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton 2015-08-17 12:12:28 +01:00 committed by Richard Purdie
parent 97067755b9
commit 9b05ef581c
1 changed files with 6 additions and 1 deletions

View File

@ -71,7 +71,12 @@ def cached_mtime_noerror(f):
return __mtime_cache[f]
def update_mtime(f):
__mtime_cache[f] = os.stat(f)[stat.ST_MTIME]
try:
__mtime_cache[f] = os.stat(f)[stat.ST_MTIME]
except OSError:
if f in __mtime_cache:
del __mtime_cache[f]
return 0
return __mtime_cache[f]
def update_cache(f):