diff options
Diffstat (limited to 'bitbake/lib/bb/build.py')
-rw-r--r-- | bitbake/lib/bb/build.py | 17 |
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 | |||
31 | import shlex | 31 | import shlex |
32 | import glob | 32 | import glob |
33 | import time | 33 | import time |
34 | import stat | ||
34 | import bb | 35 | import bb |
35 | import bb.msg | 36 | import bb.msg |
36 | import bb.process | 37 | import bb.process |
@@ -42,6 +43,20 @@ logger = logging.getLogger('BitBake.Build') | |||
42 | 43 | ||
43 | NULL = open(os.devnull, 'r+') | 44 | NULL = open(os.devnull, 'r+') |
44 | 45 | ||
46 | __mtime_cache = {} | ||
47 | |||
48 | def 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 | |||
56 | def 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 |