Reputation: 125
I'm playing with my own yocto layer/recipes to figure out how everything works together, and I'm seeing some very confusing behavior related to the build task. Here is my test recipe called condtest:
ICENSE = "GPLv2+ & LGPLv2+"
DISTRO = ""
do_print() {
echo "print"
}
addtask print
do_fetch() {
echo "fetch"
}
addtask fetch before build
do_build() {
echo "build"
}
addtask build
do_compile() {
:
}
addtask compile
So if I run bitbake -c fetch condtest
I see "fetch" echoed exactly as I would expect, so that makes sense. However, when I run bitbake -c build condtest
bitbake will not echo "build" and instead will begin fetching and compiling a bunch of packages. What confuses me further is that if I add the -e
flag to the two commands, their output is nearly identical, so I'm not sure why bitbake appears to begin building an entirely different recipe with the default build task instead of using the override build task that I defined in my recipe.
Upvotes: 0
Views: 1926
Reputation: 1939
The other packages are built because there are build time dependencies (and such dependencies are not needed for the fetch
task). Content of your build
task is not relevant, the dependencies are stored elsewhere (see the BitBake User Manual and section Build Dependencies for more information). You can generate graph of dependencies using the -g
in bitbake invocation (see the official docs).
If you want to disable default dependencies, check the documentation for the variable INHIBIT_DEFAULT_DEPS.
It wasn't part of your question, but I see these glitches in your recipe:
addtask
for standard tasks. You can find them (along with documentation) in the documentation.do_compile[noexec] = "1"
.DISTRO
variable (i.e. definition) belongs to the global configuration.Edit: I didn't answer why build
is not echoed, see the Richard's answer for the explanation.
Upvotes: 3
Reputation: 2358
The base bbclass file (meta/classes/base.bbclass) sets:
do_build[noexec] = "1
which means the content of the function is not executed and it is just a placeholder task for the dependency graph. This is why you never see output from the build task.
As mentioned in other answers, there are default dependencies which are why other recipes execute when you try and run "standard" tasks like do_build.
Upvotes: 4