[poky] question about task override

Richard Purdie richard.purdie at linuxfoundation.org
Wed Dec 15 05:11:03 PST 2010


On Wed, 2010-12-15 at 03:24 -0800, Tian, Kevin wrote:
> I'm not sure whether "task override" is the right term here. Let me describe it:
> 
> It's possible to have multiple places define same task, e.g:
> 
> a.bbclass:
> 	do_install () {
>      ...
>      }
> 
> b.bbclass:
>      b_do_install() {
>      ...
>      }
> 
> c.bb:
> 	inherit a b
>      
> I know that if c.bb defines its own do_install, that would be the one being used which
> simply overrides a.bbclass and b.bbclass.
> 
> However I don't know if c.bb doesn't define its own do_install, which one from a.bbclass
> or b.bbclass will take effect here? In inherit order?

As an example you will see base.bbclass defines base_do_install and then
later there is EXPORT_FUNCTIONS do_install.

What this means is that if there is no do_install defined,
base_do_install also becomes do_install.

The reason for this is that it means a recipe can define do_install and
yet still call base_do_install.

So in your above example, you'd really want c.bb to be able to do:

do_install () {
        a_do_install
        b_do_install
}

> A second question is how and where b_do_install is converted into a plain do_install. I tried
> to search the source but failed to locate the exact lines. For example, patch_do_patch is
> one mysterious function which I don't how it becomes do_patch.

Its done with EXPORT_FUNCTIONS.

> Then comes the third question. How to reference a specific version of do_install from 
> another place? I want to add one exclusive variable dependency for do_deploy in 
> kernel.bbclass, however neither of below works:
> 
> (meta/conf/distro/poky.conf)
> do_deploy[vardepsexclude] = "DATE TIME"
> kernel_do_deploy[vardepsexclude] = "DATE TIME"
> 
> There's one example in poky.conf:
> 
> patch_do_patch[vardepsexclude] = "DATE SRCDATE"
> 
> which works. Does that mean I have to change do_deploy in kernel.bbclass to
> kernel_do_deploy which is unique in global namespace and then can be referenced
> from other places?

You should probably add

do_deploy[vardepsexclude] = "DATE TIME"

alongside the definition of the function in kernel.bbclass. If that
doesn't work we need to work out why as it should.

kernel.bbclass could change to be kernel_do_deploy and add an
EXPORT_FUNCTION, we've just not had the need for a do_deploy() which
called kernel_do_deploy() before.

Cheers,

Richard




More information about the poky mailing list