diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-02 14:07:58 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-10 15:47:11 +0000 |
commit | aece74876271f692296c5f792104c627e15b5c3e (patch) | |
tree | e02326501eb4847567f59d4d2d178cb737ac337b /bitbake/lib/bb/cooker.py | |
parent | e39cfb1f9c491a1b8bc5730b83616ec56e3a6c64 (diff) | |
download | poky-aece74876271f692296c5f792104c627e15b5c3e.tar.gz |
bitbake: build/data: Don't expand python functions before execution [API change]
Right now, if you have some python code like:
X = "a"
def somefunction(d):
d.setVar("X", "b")
d.setVar("Y", "${X}")
then any sane person would expect that Y = "b" at the end of the
function. This is not the case, Y = "a".
This is due to the python function being expanded before execution, the
executed code would read d.setVar("Y", "a"). This understandably
confuses people, it also makes it near impossible to write ${} in a
python function without unintended things happening.
I think there is general agreement we should fix this and standardise
on non-expansion of python functions. We already don't expand anonymous
python (mostly).
I've checked OE-Core with buildhistory before and after this change and
there were a small number of issues this exposed which I've sent
patches for.
I propose we default to not expanding python code and then deal with
any consequences from that if/as/where identified. This will improve
new user understanding and usability of the system, it also allows
several long standing weird expansion issues to be fixed.
(Bitbake rev: 8bf33a8e92c0e188fa392030025756196c96fcbb)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index d990b05874..af3d77b3a8 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -653,7 +653,7 @@ class BBCooker: | |||
653 | data.expandKeys(envdata) | 653 | data.expandKeys(envdata) |
654 | for e in envdata.keys(): | 654 | for e in envdata.keys(): |
655 | if data.getVarFlag( e, 'python', envdata ): | 655 | if data.getVarFlag( e, 'python', envdata ): |
656 | logger.plain("\npython %s () {\n%s}\n", e, envdata.getVar(e, True)) | 656 | logger.plain("\npython %s () {\n%s}\n", e, envdata.getVar(e, False)) |
657 | 657 | ||
658 | 658 | ||
659 | def buildTaskData(self, pkgs_to_build, task, abort, allowincomplete=False): | 659 | def buildTaskData(self, pkgs_to_build, task, abort, allowincomplete=False): |