All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: Davis Roman <davis.roman84@gmail.com>
Cc: yocto@yoctoproject.org
Subject: Re: Difference between bitbake inclusion and inheritance
Date: Wed, 19 Oct 2016 15:00:59 +1300	[thread overview]
Message-ID: <2230276.qBQjo1O2fV@peggleto-mobl.ger.corp.intel.com> (raw)
In-Reply-To: <CACfi_Z1gqXxGMgqwvs0YwT73VBWb4-GXsjKkkUxRZ5HehwL7-Q@mail.gmail.com>

Hi Davis,

On Tue, 18 Oct 2016 18:37:50 Davis Roman wrote:
> I'm a yocto newbie and so I'm becoming familiar with the documentation.
> 
> I came across a bitbake feature that is somewhat confusing to me regarding
> the difference between optional/required inclusion versus inheritance.
> 
> As far as optional/required inclusion is concerned, the documentation
> states quite clearly that the main difference is that the former will not
> issue an error message if the specified file is not found while the latter
> will so there is no issue here.
> 
> My issue has to do with the 'inherit' command. Sounds to me like 'include'
> and 'require' already do the trick so I'm curious to know what value does
> 'inherit' bring ?

The answer is that they are very similar - but tend to be used for slightly 
different purposes. inherit is for where you have some functionality that you 
expect to be applicable across a number of recipes, so it should show up in a 
standard location in a reasonably standard format. The technical differences 
really stem from that:

* Classes must appear in a classes subdirectory somewhere along BBPATH
* Classes must be named <something>.bbclass
* Classes can use EXPORT_FUNCTIONS so you can still call the original function 
from your overridden version
* It's easy to query from python code whether a recipe inherits a class (and 
it's something we do in quite a number of places); it's technically possible 
to do the same for include/require but more difficult

include/require are much more generic and applicable for any other kind of 
shared or encapsulated functionality or configuration that doesn't suit a 
.bbclass.

Note that not all classes are typically inherited from individual recipes with 
inherit - there are classes that are usually applied globally by adding their 
names to INHERIT (e.g. buildhistory).

Hope that helps.

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre


  parent reply	other threads:[~2016-10-19  2:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 22:37 Difference between bitbake inclusion and inheritance Davis Roman
2016-10-19  0:44 ` Khem Raj
2016-10-19  2:00 ` Paul Eggleton [this message]
2016-10-19  3:15   ` Davis Roman

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=2230276.qBQjo1O2fV@peggleto-mobl.ger.corp.intel.com \
    --to=paul.eggleton@linux.intel.com \
    --cc=davis.roman84@gmail.com \
    --cc=yocto@yoctoproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.