summaryrefslogtreecommitdiffstats
path: root/lib/bb/codeparser.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-04-10 10:52:29 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-06 15:31:09 +0100
commit2b0194b408d6d1835f04b20cf5cbd6b0d255869b (patch)
tree1e4210082d9f34c97ce78a684b69d2a01127f0aa /lib/bb/codeparser.py
parentddf498b487fae35a36c3cd095f110fa6da5ded40 (diff)
downloadbitbake-2b0194b408d6d1835f04b20cf5cbd6b0d255869b.tar.gz
bitbake/cooker/codeparser: Ensure the code parser cache is saved for each parsing process
Before this change, the codeparser cache was only being saved for the main server process. This is suboptimal as it leaves code being re-evaluated at task execution time and increases parse time. We use the multiprocess Finalize() functionality to ensure each process saves out its cache. We need to update the cache save function to be multiprocess friendly with locking. (From Poky rev: c8928e93dd8a08d6768623f6491c9ba31d0aa06f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/codeparser.py')
-rw-r--r--lib/bb/codeparser.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/bb/codeparser.py b/lib/bb/codeparser.py
index 84d1c09f2..fdba06f67 100644
--- a/lib/bb/codeparser.py
+++ b/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():