summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorHolger Freyther <ich@tamarin.(none)>2009-05-19 13:22:30 +0200
committerRichard Purdie <rpurdie@linux.intel.com>2010-02-15 17:07:53 +0000
commitc011d42eda4b830ec2a609817b61d166ff0413d4 (patch)
tree3fa500506d92c55b447d22673dbf630c3fcc3229 /bitbake
parent793c88dd92747890e910c598e19f1778865883d2 (diff)
downloadpoky-c011d42eda4b830ec2a609817b61d166ff0413d4.tar.gz
bitbake: [parser] prepare to cache some .bbcclass and .inc files
Our parser is shit but instead to replace it now we will see how long we can drive the wave by caching parsed files. This will not go through the feeder again but we can just reevaluate the StatementGroup. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index f313009ab8..9b8ad0b9ec 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -78,6 +78,22 @@ def inherit(files, d):
78 include(fn, file, d, "inherit") 78 include(fn, file, d, "inherit")
79 __inherit_cache = data.getVar('__inherit_cache', d) or [] 79 __inherit_cache = data.getVar('__inherit_cache', d) or []
80 80
81def get_statements(filename, absolsute_filename, base_name, file):
82 statements = ast.StatementGroup()
83
84 lineno = 0
85 while 1:
86 lineno = lineno + 1
87 s = file.readline()
88 if not s: break
89 s = s.rstrip()
90 feeder(lineno, s, filename, base_name, statements)
91 if __inpython__:
92 # add a blank line to close out any python definition
93 feeder(IN_PYTHON_EOF, "", filename, base_name, statements)
94
95 return statements
96
81def handle(fn, d, include): 97def handle(fn, d, include):
82 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__ 98 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__
83 __body__ = [] 99 __body__ = []
@@ -113,17 +129,8 @@ def handle(fn, d, include):
113 if include: 129 if include:
114 bb.parse.mark_dependency(d, abs_fn) 130 bb.parse.mark_dependency(d, abs_fn)
115 131
116 statements = ast.StatementGroup() 132 # actual loading
117 lineno = 0 133 statements = get_statements(fn, abs_fn, base_name, f)
118 while 1:
119 lineno = lineno + 1
120 s = f.readline()
121 if not s: break
122 s = s.rstrip()
123 feeder(lineno, s, fn, base_name, statements)
124 if __inpython__:
125 # add a blank line to close out any python definition
126 feeder(IN_PYTHON_EOF, "", fn, base_name, statements)
127 134
128 # DONE WITH PARSING... time to evaluate 135 # DONE WITH PARSING... time to evaluate
129 if ext != ".bbclass": 136 if ext != ".bbclass":