【发布时间】:2016-05-18 01:10:19
【问题描述】:
如何在带有条件的 bitbake 文件中包含依赖行? 我想要类似下面的东西:
if (some env varible)
DEPENDS += "recipe-1"
else
DEPENDS += "recipe-2'
我在 .bb 文件中尝试过:
DEPENDS += "${@ 'recipe-2' if '${ENV_VAR}' else 'recipe-1'}"
在此之前我将 ENV_VAR 导出到 BB_ENV_EXTRAWHITE
export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE ENV_VAR"
这仅在设置 ENV_VAR 时有效:
env ENV_VAR="value" bitbake test-recipe
如果未设置 ENV_VAR,则在解析 bitbake DEPENDS 行时会引发错误
ExpansionError: Failure expanding variable DEPENDS, expression was
${@ 'recipe-2' if '${ENV_VAR}' else 'recipe-1'}
which triggered exception SyntaxError: EOL while scanning string literal (DEPENDS, line 1)
【问题讨论】:
-
它与python打交道吗?
-
我在 bitbake 中使用 python 表达式。 DEPENDS += "${@ 'recipe-2' if '${ENV_VAR}' else 'recipe-1'}" 语法:DEPENDS += "${@ python expression}"
-
recipe-2' if '${ENV_VAR}' else 'recipe-1不是正确的 Python 表达式,因为${ENV_VAR}在 shell 中返回ENV_VAR的值。我错了吗?