How can I add a task after do_deploy()?

h0ch5tr4355 picture h0ch5tr4355 · Apr 13, 2017 · Viewed 7.8k times · Source

I have written a recipe where I want to execute a task after do_deploy():

[...]

inherit deploy

[...]

do_deploy () {
    echo "do_deploy() has been called."
}
addtask deploy after do_compile

do_after_deploy () {
    echo "do_after_deploy() has been called."
}
addtask after_deploy after do_deploy

When I build the recipe the do_deploy() task is executed. However, the after_deploy() task is not.

When I manually execute the task with bitbake my_recipe -c after_deploy the instructions in the task are executed.

What is the reason for this? Is do_deploy() the very last task and BitBake doesn't let me add tasks after it?

Answer

Jussi Kukkonen picture Jussi Kukkonen · Apr 13, 2017

do_deploy() gets executed by default because base.bbclass happens to make do_build (the default task) depend on do_deploy.

You should be able to make your new task run by default with

addtask after_deploy after do_deploy before do_build