【发布时间】:2019-04-29 09:35:14
【问题描述】:
我需要一些关于如何处理配方任务中的错误的建议。考虑一下 Yocto 食谱配方的以下 sn-p:
do_compile_custom() {
oe_runmake // oe_runmake command fails
}
addtask compile_custom after do_compile before do_install
当oe_runmake 失败时,我想执行一些自定义命令并继续构建,所以我认为这应该可以工作。
do_compile_custom() {
oe_runmake || true // oe_runmake command fails
if [ $? -ne 0 ]; then
bberror "MAKE FAILED"
fi
}
addtask compile_custom after do_compile before do_install
但是当oe_runmake失败时,退出任务,剩下的任务不执行。没看到
失败
在我的构建日志中。
我开始研究 bitbake 事件,所以我接下来要做的是在我的配方中添加一个事件处理程序,一开始没有任何事件过滤器来查看所有接收到的事件。
do_compile_custom() {
oe_runmake // oe_runmake command fails
}
addtask compile_custom after do_compile before do_install
addhandler failure_eventhandler
python failure_eventhandler() {
from bb.event import getName
print("strtogrep The name of the Event is %s" % getName(e))
}
通过这个配方的实现,从处理程序中我只能看到打印的 3 个事件:
| The name of the Event is RecipePreFinalise
| The name of the Event is RecipeTaskPreProcess
| The name of the Event is RecipeParsed
从 bitbake 中定义的所有事件中,我希望在任务失败后得到 TaskFailed 事件,但从未收到。有人对如何处理这个问题有一些建议吗?
【问题讨论】:
标签: yocto bitbake openembedded