Skip to contentSkip to conversation

BBHandler: Ensure parser state engine is correctly reset for new parsing

PATCH In review Richard Purdie 1 participant 2 messages Dec 7, 2012 – Dec 8, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 BBHandler: Ensure parser state engine is correctly reset for new parsing

The classes variable in particular could be in an odd state if parsing of a previous recipe had abruptly ended.

---

bitbake/lib/bb/parse/parse_py/BBHandler.py +3 -2
index 2e0647b..c4e579d 100644
@@ -107,14 +107,15 @@ def get_statements(filename, absolute_filename, base_name):
         return statements
 
 def handle(fn, d, include):
-    global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__
+    global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__, __inpython__, classes
     __body__ = []
     __infunc__ = ""
     __classname__ = ""
     __residue__ = []
-
+    __inpython__ = False
 
     if include == 0:
+        classes = [ None, ]
         logger.debug(2, "BB %s: handle(data)", fn)
     else:
         logger.debug(2, "BB %s: handle(data, include)", fn)
#1 lore raw
Quoted 17 lines · Richard Purdie

The classes variable in particular could be in an odd state if parsing of a previous recipe had abruptly ended.

---

bitbake/lib/bb/parse/parse_py/BBHandler.py +1 -1
index 2e0647b..c4e579d 100644
@@ -107,14 +107,15 @@ def get_statements(filename, absolute_filename, base_name):
         return statements
 
 def handle(fn, d, include):
-    global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__
+    global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__, __inpython__, classes
     __body__ = []
     __infunc__ = ""

bitbake/lib/bb/parse/parse_py/BBHandler.py def get_statements(filename, absolute_filename, base_name): · line 121

Quoted 10 lines
bitbake/lib/bb/parse/parse_py/BBHandler.py +2 -1
     __classname__ = ""
     __residue__ = []
-
+    __inpython__ = False
 
     if include == 0:
+        classes = [ None, ]
         logger.debug(2, "BB %s: handle(data)", fn)
     else:
         logger.debug(2, "BB %s: handle(data, include)", fn)

This patch doesn't work. To cut a long story short, "classes" is getting cached inside the ast statement cache and shouldn't be. This is likely the source of the problems.

Trying to fix that leads to a voyage of discovery of other breakage :(

Its likely going to end up with the EXPORT_FUNCTION implementation needing rewriting, or at least how/where its getting its class lists from.

Cheers,

Richard