aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/build.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bb/build.py')
-rw-r--r--lib/bb/build.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/bb/build.py b/lib/bb/build.py
index 65cc851df..0f6aa1a14 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -31,6 +31,7 @@ import logging
import shlex
import glob
import time
+import stat
import bb
import bb.msg
import bb.process
@@ -42,6 +43,20 @@ logger = logging.getLogger('BitBake.Build')
NULL = open(os.devnull, 'r+')
+__mtime_cache = {}
+
+def cached_mtime_noerror(f):
+ if f not in __mtime_cache:
+ try:
+ __mtime_cache[f] = os.stat(f)[stat.ST_MTIME]
+ except OSError:
+ return 0
+ return __mtime_cache[f]
+
+def reset_cache():
+ global __mtime_cache
+ __mtime_cache = {}
+
# When we execute a Python function, we'd like certain things
# in all namespaces, hence we add them to __builtins__.
# 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):
stamp = bb.parse.siggen.stampfile(stamp, file_name, taskname, extrainfo)
stampdir = os.path.dirname(stamp)
- if bb.parse.cached_mtime_noerror(stampdir) == 0:
+ if cached_mtime_noerror(stampdir) == 0:
bb.utils.mkdirhier(stampdir)
return stamp