The attempt to provide a helpful error message for addhook and other
statements in .conf files fails for a number of reasons. First, the
exception class is not imported into confparse.py, second, the super
statement calls it "StatementNotAllowedInConf" while the class is just
"StatementNotAllowed", and third, the init def lacks the two
trailing underscores, so the ParseError init is anyway called
directly, causing an assert error (after fixing the first two bugs)
since the p argument ends up being passed as the message
parameter.
Since this is only used in confparse.py, I tried moving the exception
class definition to confparse.py, but ran into some cyclic import
issue, so I left it in init.py, but still chose the longer name.
Add e.g. "addtask foo" to local.conf to test this. Before:
ERROR: exception in bake.run()
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/oebakery/cmd/cmds.py", line 137, in call
ret = function(*args)
[snip snip...]
File "/usr/lib/python2.7/dist-packages/ply/yacc.py", line 975, in parseopt_notrack
p.callable(pslice)
File "/mnt/xfs/devel/oe-lite/meta/core/lib/oelite/parse/confparse.py", line 25, in p_addtask
raise StatementNotAllowed(self, p, "addtask")
NameError: global name 'StatementNotAllowed' is not defined
CRITICAL: bake failed: Exception: global name 'StatementNotAllowed' is not defined
After:
Parse error
addtask statement not allowed in /mnt/xfs/devel/oe-lite/conf/local.conf at line 17
12 ASYNC_STAGE = True
13 __ASYNC_CHRPATH = True
14 ASYNC_SPLIT = True
15 __ASYNC_PACKAGE = True
16
-> 17 addtask foo
Included from /mnt/xfs/devel/oe-lite/meta/core/conf/oe-lite.conf
The attempt to provide a helpful error message for addhook and other statements in .conf files fails for a number of reasons. First, the exception class is not imported into confparse.py, second, the super statement calls it "StatementNotAllowedInConf" while the class is just "StatementNotAllowed", and third, the init def lacks the two trailing underscores, so the ParseError init is anyway called directly, causing an assert error (after fixing the first two bugs) since the p argument ends up being passed as the message parameter.
Since this is only used in confparse.py, I tried moving the exception class definition to confparse.py, but ran into some cyclic import issue, so I left it in init.py, but still chose the longer name.
Add e.g. "addtask foo" to local.conf to test this. Before:
ERROR: exception in bake.run()
Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/oebakery/cmd/cmds.py", line 137, in call ret = function(*args) [snip snip...] File "/usr/lib/python2.7/dist-packages/ply/yacc.py", line 975, in parseopt_notrack p.callable(pslice) File "/mnt/xfs/devel/oe-lite/meta/core/lib/oelite/parse/confparse.py", line 25, in p_addtask raise StatementNotAllowed(self, p, "addtask") NameError: global name 'StatementNotAllowed' is not defined
CRITICAL: bake failed: Exception: global name 'StatementNotAllowed' is not defined
After:
Parse error addtask statement not allowed in /mnt/xfs/devel/oe-lite/conf/local.conf at line 17 12 ASYNC_STAGE = True 13 __ASYNC_CHRPATH = True 14 ASYNC_SPLIT = True 15 __ASYNC_PACKAGE = True 16 -> 17 addtask foo Included from /mnt/xfs/devel/oe-lite/meta/core/conf/oe-lite.conf
CRITICAL: bake failed: Parse error