summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-09-26 15:33:19 +0800
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-28 12:05:15 +0100
commitd85dc37b736f789780e9ceefc00ed16e0db7d90a (patch)
tree9605bfc9ead4333bb0f8b32fb08b2f91b644d480 /bitbake
parentcf09c7a1e35a0dc3219fa196e8811c50957be4a2 (diff)
downloadpoky-d85dc37b736f789780e9ceefc00ed16e0db7d90a.tar.gz
codeparser.py: Fix storing of hash values as object references can be corrupted
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/codeparser.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py
index 7d40835cb8..ba3009212b 100644
--- a/bitbake/lib/bb/codeparser.py
+++ b/bitbake/lib/bb/codeparser.py
@@ -4,7 +4,7 @@ from bb import msg, utils
4import ast 4import ast
5import codegen 5import codegen
6 6
7PARSERCACHE_VERSION = 1 7PARSERCACHE_VERSION = 2
8 8
9try: 9try:
10 import cPickle as pickle 10 import cPickle as pickle
@@ -177,11 +177,11 @@ class PythonParser():
177 177
178 def parse_python(self, node): 178 def parse_python(self, node):
179 179
180 h = hash(node) 180 h = hash(str(node))
181 181
182 if h in pythonparsecache: 182 if h in pythonparsecache:
183 self.references = pythonparsecache[h].references 183 self.references = pythonparsecache[h]["refs"]
184 self.execs = pythonparsecache[h].execs 184 self.execs = pythonparsecache[h]["execs"]
185 return 185 return
186 186
187 code = compile(check_indent(str(node)), "<string>", "exec", 187 code = compile(check_indent(str(node)), "<string>", "exec",
@@ -196,7 +196,9 @@ class PythonParser():
196 self.references.update(visitor.var_execs) 196 self.references.update(visitor.var_execs)
197 self.execs = visitor.direct_func_calls 197 self.execs = visitor.direct_func_calls
198 198
199 pythonparsecache[h] = self 199 pythonparsecache[h] = {}
200 pythonparsecache[h]["refs"] = self.references
201 pythonparsecache[h]["execs"] = self.execs
200 202
201class ShellParser(): 203class ShellParser():
202 def __init__(self): 204 def __init__(self):
@@ -209,10 +211,10 @@ class ShellParser():
209 commands it executes. 211 commands it executes.
210 """ 212 """
211 213
212 h = hash(value) 214 h = hash(str(value))
213 215
214 if h in shellparsecache: 216 if h in shellparsecache:
215 self.execs = shellparsecache[h].execs 217 self.execs = shellparsecache[h]["execs"]
216 return self.execs 218 return self.execs
217 219
218 try: 220 try:
@@ -224,7 +226,8 @@ class ShellParser():
224 self.process_tokens(token) 226 self.process_tokens(token)
225 self.execs = set(cmd for cmd in self.allexecs if cmd not in self.funcdefs) 227 self.execs = set(cmd for cmd in self.allexecs if cmd not in self.funcdefs)
226 228
227 shellparsecache[h] = self 229 shellparsecache[h] = {}
230 shellparsecache[h]["execs"] = self.execs
228 231
229 return self.execs 232 return self.execs
230 233