summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/build.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-04-21 18:48:49 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-29 10:59:54 +0100
commitdb409697db2ea0931cdcd2015d089b6b0ea39bbb (patch)
tree9017ebe42175471efebd888cc8a36e3638726c8f /bitbake/lib/bb/build.py
parent4eeae70a451e25143036bc2d4118d64b2ab1d850 (diff)
downloadpoky-db409697db2ea0931cdcd2015d089b6b0ea39bbb.tar.gz
bitbake: bitbake: reset build mtime cache before the build
Introduced build mtime cache structure. Reset it before the build to prevent bitbake from crashing when build/tmp/stamps hierarchy is removed. [YOCTO: #7562] (Bitbake rev: f8590547a198a78334debdf14bf40acb50c22ecc) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/build.py')
-rw-r--r--bitbake/lib/bb/build.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 65cc851df4..0f6aa1a14c 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -31,6 +31,7 @@ import logging
31import shlex 31import shlex
32import glob 32import glob
33import time 33import time
34import stat
34import bb 35import bb
35import bb.msg 36import bb.msg
36import bb.process 37import bb.process
@@ -42,6 +43,20 @@ logger = logging.getLogger('BitBake.Build')
42 43
43NULL = open(os.devnull, 'r+') 44NULL = open(os.devnull, 'r+')
44 45
46__mtime_cache = {}
47
48def cached_mtime_noerror(f):
49 if f not in __mtime_cache:
50 try:
51 __mtime_cache[f] = os.stat(f)[stat.ST_MTIME]
52 except OSError:
53 return 0
54 return __mtime_cache[f]
55
56def reset_cache():
57 global __mtime_cache
58 __mtime_cache = {}
59
45# When we execute a Python function, we'd like certain things 60# When we execute a Python function, we'd like certain things
46# in all namespaces, hence we add them to __builtins__. 61# in all namespaces, hence we add them to __builtins__.
47# If we do not do this and use the exec globals, they will 62# If we do not do this and use the exec globals, they will
@@ -535,7 +550,7 @@ def stamp_internal(taskname, d, file_name, baseonly=False):
535 stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname, extrainfo) 550 stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname, extrainfo)
536 551
537 stampdir = os.path.dirname(stamp) 552 stampdir = os.path.dirname(stamp)
538 if bb.parse.cached_mtime_noerror(stampdir) == 0: 553 if cached_mtime_noerror(stampdir) == 0:
539 bb.utils.mkdirhier(stampdir) 554 bb.utils.mkdirhier(stampdir)
540 555
541 return stamp 556 return stamp