Poky Project Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: "Tian, Kevin" <kevin.tian@intel.com>
Cc: "paul.eggleton@linux.intel.com" <paul.eggleton@linux.intel.com>,
	"poky@pokylinux.org" <poky@pokylinux.org>
Subject: Re: question about task override
Date: Wed, 15 Dec 2010 13:11:03 +0000	[thread overview]
Message-ID: <1292418663.26558.2234.camel@rex> (raw)
In-Reply-To: <625BA99ED14B2D499DC4E29D8138F1504D5F4091FC@shsmsx502.ccr.corp.intel.com>

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



  parent reply	other threads:[~2010-12-15 13:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15 11:24 question about task override Tian, Kevin
2010-12-15 12:49 ` Paul Eggleton
2010-12-16  2:59   ` Tian, Kevin
2010-12-15 13:11 ` Richard Purdie [this message]
2010-12-16  1:47   ` Tian, Kevin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1292418663.26558.2234.camel@rex \
    --to=richard.purdie@linuxfoundation.org \
    --cc=kevin.tian@intel.com \
    --cc=paul.eggleton@linux.intel.com \
    --cc=poky@pokylinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox