python - bitbake conditional inclusion of depends statement -
how include depends line in bitbake file condition ? want below:
if (some env varible) depends += "recipe-1" else depends += "recipe-2'
i have tried below in .bb file:
depends += "${@ 'recipe-2' if '${env_var}' else 'recipe-1'}"
before exported env_var bb_env_extrawhite
export bb_env_extrawhite="$bb_env_extrawhite env_var"
this working when env_var set:
env env_var="value" bitbake test-recipe
if env_var not set, throwing error while parsing bitbake depends line
expansionerror: failure expanding variable depends, expression ${@ 'recipe-2' if '${env_var}' else 'recipe-1'} triggered exception syntaxerror: eol while scanning string literal (depends, line 1)
try:
depends += "${@ 'recipe-2' if d.getvar('env_var') else 'recipe-1'}"
the reason why ${env_var}
gets expanded value of variable. if unset, doesn't expanded , triggers error see. using getvar
result rest of python expression can deal none
or value.
note there proposed changes might improve behaviour make bit more usable , understandable people above continue work regardless.
Comments
Post a Comment