diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-04-21 18:48:49 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-29 10:59:54 +0100 |
commit | db409697db2ea0931cdcd2015d089b6b0ea39bbb (patch) | |
tree | 9017ebe42175471efebd888cc8a36e3638726c8f /bitbake | |
parent | 4eeae70a451e25143036bc2d4118d64b2ab1d850 (diff) | |
download | poky-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')
-rw-r--r-- | bitbake/lib/bb/build.py | 17 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 3 |
2 files changed, 18 insertions, 2 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 |
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 9c101f2e72..ddf5fedb83 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -35,7 +35,7 @@ from contextlib import closing | |||
35 | from functools import wraps | 35 | from functools import wraps |
36 | from collections import defaultdict | 36 | from collections import defaultdict |
37 | import bb, bb.exceptions, bb.command | 37 | import bb, bb.exceptions, bb.command |
38 | from bb import utils, data, parse, event, cache, providers, taskdata, runqueue | 38 | from bb import utils, data, parse, event, cache, providers, taskdata, runqueue, build |
39 | import Queue | 39 | import Queue |
40 | import signal | 40 | import signal |
41 | import prserv.serv | 41 | import prserv.serv |
@@ -1343,6 +1343,7 @@ class BBCooker: | |||
1343 | return True | 1343 | return True |
1344 | return retval | 1344 | return retval |
1345 | 1345 | ||
1346 | build.reset_cache() | ||
1346 | self.buildSetVars() | 1347 | self.buildSetVars() |
1347 | 1348 | ||
1348 | taskdata, runlist, fulltargetlist = self.buildTaskData(targets, task, self.configuration.abort) | 1349 | taskdata, runlist, fulltargetlist = self.buildTaskData(targets, task, self.configuration.abort) |