如何将食谱限制为仅限本机和 nativesdk?
How to restrict a recipe to native and nativesdk only?
我有一个配方,我想阻止它为目标构建。
我知道,给定一个食谱 xyz.bb
,添加 BBCLASSEXTEND += " native nativesdk"
'magically' 可以实现以下所有条件:
$ bitbake xyz # 1
$ bitbake nativesdk-xyz # 2
$ bitbake xyz-native # 3
我只想要 数字 2 和 3。我明确地 NOT 希望数字 #1 成为可能(也许 xyz
有 GPL v3 许可证,所以我从不希望它出现在目标图像中)
我尝试将配方命名为 xyz-native.bb
并添加 BBCLASSEXTEND += " nativesdk"
,但这产生了如下可构建的目标。
$ bitbake xyz-native # which is what I want
$ bitbake nativesdk-xyz-native # which is NOT what I want
我能看到的唯一其他选择是将 xyz.bb
重命名为 xyz.inc
,然后创建 nativesdk-xyz.bb
和 xyz-native.bb
,两者都只需要共同的 xyz.inc
文件。
我错过了什么?
您应该创建 2 个相互包含的 bitbake 配方。第一个 bitbake 配方将是 native 和 nativesdk,第二个将用于目标。在target bitbake recipe中,你可以像这样在do install步骤中删除与目标文件相关的东西。
xyx.bb(目标配方)
do_install_append() {
rm -f ${D}the_files_which_you_want_do_delete
}
您错过了为创建的食谱添加所需的 类 - native 和 nativesdk,
$ grep -rn inherit test-layer/recipes-example/example/
test-layer/recipes-example/example/nativesdk-example_0.1.bb:5:inherit nativesdk
test-layer/recipes-example/example/example-native_0.1.bb:5:inherit native
然后您将看到 native 和 nativesdk 配方:
$ bitbake -s | grep example
example-native :0.1-r0
nativesdk-example :0.1-r0
如果您的情况是许可,那么有一个更好的解决方案:只需设置 INCOMPATIBLE_LICENSES
并且 bitbake 不会让任何不兼容的图像进入图像。
如果你有其他神秘的原因想要拒绝让配方的目标构建成功那么你可以使用一些匿名 Python 来检查 class-target
是否在 OVERRIDES
如果是,请提高 SkipRecipe
.
我有一个配方,我想阻止它为目标构建。
我知道,给定一个食谱 xyz.bb
,添加 BBCLASSEXTEND += " native nativesdk"
'magically' 可以实现以下所有条件:
$ bitbake xyz # 1
$ bitbake nativesdk-xyz # 2
$ bitbake xyz-native # 3
我只想要 数字 2 和 3。我明确地 NOT 希望数字 #1 成为可能(也许 xyz
有 GPL v3 许可证,所以我从不希望它出现在目标图像中)
我尝试将配方命名为 xyz-native.bb
并添加 BBCLASSEXTEND += " nativesdk"
,但这产生了如下可构建的目标。
$ bitbake xyz-native # which is what I want
$ bitbake nativesdk-xyz-native # which is NOT what I want
我能看到的唯一其他选择是将 xyz.bb
重命名为 xyz.inc
,然后创建 nativesdk-xyz.bb
和 xyz-native.bb
,两者都只需要共同的 xyz.inc
文件。
我错过了什么?
您应该创建 2 个相互包含的 bitbake 配方。第一个 bitbake 配方将是 native 和 nativesdk,第二个将用于目标。在target bitbake recipe中,你可以像这样在do install步骤中删除与目标文件相关的东西。
xyx.bb(目标配方)
do_install_append() {
rm -f ${D}the_files_which_you_want_do_delete
}
您错过了为创建的食谱添加所需的 类 - native 和 nativesdk,
$ grep -rn inherit test-layer/recipes-example/example/
test-layer/recipes-example/example/nativesdk-example_0.1.bb:5:inherit nativesdk
test-layer/recipes-example/example/example-native_0.1.bb:5:inherit native
然后您将看到 native 和 nativesdk 配方:
$ bitbake -s | grep example
example-native :0.1-r0
nativesdk-example :0.1-r0
如果您的情况是许可,那么有一个更好的解决方案:只需设置 INCOMPATIBLE_LICENSES
并且 bitbake 不会让任何不兼容的图像进入图像。
如果你有其他神秘的原因想要拒绝让配方的目标构建成功那么你可以使用一些匿名 Python 来检查 class-target
是否在 OVERRIDES
如果是,请提高 SkipRecipe
.