Skip to contentSkip to conversation

question about EXPORT_FUNCTIONS from bitbake user manual

DISCUSSION Robert P. J. Day 2 participants 3 messages Jan 16, 2024

lore
Share & tools
lore
#0 lore raw

hoping that bitbake doc questions have been subsumed under the YP
docs mailing list ...

i'm reading the section, "Flexible Inheritance for Class Functions", here:

https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html?highlight=inheritance#flexible-inheritance-for-class-functions

and i understand the point of examples like autotools.bbclass defining task functions like "autotools_do_install" so recipes that "inherit autotools" can define their own "do_install" function that, somewhere internally, calls "autotools_do_install".

but what if the recipe that inherits autotools does *not* define its
own do_install() function? would it still pick up the autotools_do_install? what if that recipe tried to:

do_install:append = ...

would that even make sense? which install function would it be appending to?

in short, while that section explains how to invoke the "base" task
function, it is not clear what happens if you don't invoke it that way, and just try to take advantage of the "default" do_install.

rday

#1 lore raw
Quoted 17 lines · Robert P. J. Day

hoping that bitbake doc questions have been subsumed under the YP
docs mailing list ...

i'm reading the section, "Flexible Inheritance for Class Functions", here:

https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html?highlight=inheritance#flexible-inheritance-for-class-functions

and i understand the point of examples like autotools.bbclass defining task functions like "autotools_do_install" so recipes that "inherit autotools" can define their own "do_install" function that, somewhere internally, calls "autotools_do_install".

but what if the recipe that inherits autotools does *not* define its
own do_install() function? would it still pick up the autotools_do_install? what if that recipe tried to:

Quoted 8 lines

do_install:append = ...

would that even make sense? which install function would it be appending to?

in short, while that section explains how to invoke the "base" task
function, it is not clear what happens if you don't invoke it that way, and just try to take advantage of the "default" do_install.

If you have:

autotools_do_compile () {
	:
}

EXPORT_FUNCTIONS do_compile

then do_compile will be magically mapped to autotools_do_compile, if there is no do_compile function defined by anything.

If you have another similar class (lets say cmake) and have

inherit autotools cmake

then the last one is defined to "win" and do_compile would make to cmake_do_compile.

This allows for functions that could do this as well:

do_compile () {
autotools_do_compile
cmake_do_compile
}

Cheers,

Richard

#2 lore raw
Quoted 47 lines · Richard Purdie
Quoted 17 lines · Robert P. J. Day

hoping that bitbake doc questions have been subsumed under the YP
docs mailing list ...

i'm reading the section, "Flexible Inheritance for Class Functions", here:

https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html?highlight=inheritance#flexible-inheritance-for-class-functions

and i understand the point of examples like autotools.bbclass defining task functions like "autotools_do_install" so recipes that "inherit autotools" can define their own "do_install" function that, somewhere internally, calls "autotools_do_install".

but what if the recipe that inherits autotools does *not* define its
own do_install() function? would it still pick up the autotools_do_install? what if that recipe tried to:

Quoted 8 lines

do_install:append = ...

would that even make sense? which install function would it be appending to?

in short, while that section explains how to invoke the "base" task
function, it is not clear what happens if you don't invoke it that way, and just try to take advantage of the "default" do_install.

If you have:

autotools_do_compile () {
	:
}

EXPORT_FUNCTIONS do_compile

then do_compile will be magically mapped to autotools_do_compile, if there is no do_compile function defined by anything.

If you have another similar class (lets say cmake) and have

inherit autotools cmake

then the last one is defined to "win" and do_compile would make to cmake_do_compile.

This allows for functions that could do this as well:

Quoted 8 lines

do_compile () {
autotools_do_compile
cmake_do_compile
}

Cheers,

Richard

ah, that clears things up, thanks. maybe i'll submit a patch to add
that to the doc.

rday