summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/codeparser.py14
-rw-r--r--bitbake/lib/bb/cooker.py5
2 files changed, 15 insertions, 4 deletions
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py
index 84d1c09..fdba06f 100644
--- a/bitbake/lib/bb/codeparser.py
+++ b/bitbake/lib/bb/codeparser.py
@@ -70,8 +70,22 @@ def parser_cache_save(d):
if not cachefile:
return
+ lf = bb.utils.lockfile(cachefile + ".lock")
+
+ p = pickle.Unpickler(file(cachefile, "rb"))
+ data, version = p.load()
+
+ if version == PARSERCACHE_VERSION:
+ for h in data[0]:
+ if h not in pythonparsecache:
+ pythonparsecache[h] = data[0][h]
+ for h in data[1]:
+ if h not in pythonparsecache:
+ shellparsecache[h] = data[1][h]
+
p = pickle.Pickler(file(cachefile, "wb"), -1)
p.dump([[pythonparsecache, shellparsecache], PARSERCACHE_VERSION])
+ bb.utils.unlockfile(lf)
class PythonParser():
class ValueVisitor():
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 3c7b60e..9861265 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -1112,6 +1112,7 @@ class CookerParser(object):
def start(self):
def init(cfg):
signal.signal(signal.SIGINT, signal.SIG_IGN)
+ multiprocessing.util.Finalize(None, bb.codeparser.parser_cache_save, args=(self.cooker.configuration.data, ), exitpriority=1)
parse_file.cfg = cfg
bb.event.fire(bb.event.ParseStarted(self.toparse), self.cfgdata)
@@ -1137,10 +1138,6 @@ class CookerParser(object):
sync.start()
atexit.register(lambda: sync.join())
- codesync = threading.Thread(target=bb.codeparser.parser_cache_save(self.cooker.configuration.data))
- codesync.start()
- atexit.register(lambda: codesync.join())
-
def load_cached(self):
for filename, appends in self.fromcache:
cached, infos = self.bb_cache.load(filename, appends, self.cfgdata)
OpenPOWER on IntegriCloud