summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/build.py
diff options
context:
space:
mode:
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