Openembedded Core Discussions
 help / color / mirror / Atom feed
* DEPENDS tranlation with BBCLASSEXTEND
@ 2011-03-27 20:08 Khem Raj
  2011-03-27 23:03 ` Chris Larson
  0 siblings, 1 reply; 8+ messages in thread
From: Khem Raj @ 2011-03-27 20:08 UTC (permalink / raw)
  To: openembedded-core

Hi,

I observed that if I have 
DEPENDS = "a b" in recipe.bb which has BBCLASSEXTEND = "native"
then dependecies for recipe-native shows a-native b-native so far so
good

Now if I want to add a dependency which only is needed for native recipe
I do

DEPENDS_virtclass-native += "c-native"

what this does is it will ignore a-native and b-native dependencies and
only adds "c-native" to depends of native recipe

DEPENDS_virtclass-native_append = " c-native"

This does what I wanted i.e. have deps on a-native b-native c-native

I think behavior of += or _append should be similar. Is my understanding
correct ?


p.s. Another niggle I see is that suppose in above scenario I want
native recipe to not depend upon on b-native but other deps are good.

It would be good to have a directive to exclude deps that should not be
converted into dep-native 

Thx

-- 
-Khem



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DEPENDS tranlation with BBCLASSEXTEND
  2011-03-27 20:08 DEPENDS tranlation with BBCLASSEXTEND Khem Raj
@ 2011-03-27 23:03 ` Chris Larson
  2011-03-28 12:48   ` Richard Purdie
  2011-03-28 19:03   ` Tom Rini
  0 siblings, 2 replies; 8+ messages in thread
From: Chris Larson @ 2011-03-27 23:03 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Sun, Mar 27, 2011 at 1:08 PM, Khem Raj <raj.khem@gmail.com> wrote:
> I observed that if I have
> DEPENDS = "a b" in recipe.bb which has BBCLASSEXTEND = "native"
> then dependecies for recipe-native shows a-native b-native so far so
> good
>
> Now if I want to add a dependency which only is needed for native recipe
> I do
>
> DEPENDS_virtclass-native += "c-native"
>
> what this does is it will ignore a-native and b-native dependencies and
> only adds "c-native" to depends of native recipe
>
> DEPENDS_virtclass-native_append = " c-native"
>
> This does what I wanted i.e. have deps on a-native b-native c-native
>
> I think behavior of += or _append should be similar. Is my understanding
> correct ?

They've never been the same.  += is immediate, _append is delayed.  If
a class, say, native.bbclass, defines the variable with ?=, and you
used += before the inherit, then it will have a value, and the ?=
won't assign.  I assume native.bbclass does it this way today so you
can override the automatic behavior by defining the variable yourself,
but I'll let Richard speak to that decision.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DEPENDS tranlation with BBCLASSEXTEND
  2011-03-27 23:03 ` Chris Larson
@ 2011-03-28 12:48   ` Richard Purdie
  2011-03-28 19:03   ` Tom Rini
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Purdie @ 2011-03-28 12:48 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Sun, 2011-03-27 at 16:03 -0700, Chris Larson wrote:
> On Sun, Mar 27, 2011 at 1:08 PM, Khem Raj <raj.khem@gmail.com> wrote:
> > I observed that if I have
> > DEPENDS = "a b" in recipe.bb which has BBCLASSEXTEND = "native"
> > then dependecies for recipe-native shows a-native b-native so far so
> > good
> >
> > Now if I want to add a dependency which only is needed for native recipe
> > I do
> >
> > DEPENDS_virtclass-native += "c-native"
> >
> > what this does is it will ignore a-native and b-native dependencies and
> > only adds "c-native" to depends of native recipe
> >
> > DEPENDS_virtclass-native_append = " c-native"
> >
> > This does what I wanted i.e. have deps on a-native b-native c-native
> >
> > I think behavior of += or _append should be similar. Is my understanding
> > correct ?
> 
> They've never been the same.  += is immediate, _append is delayed.  If
> a class, say, native.bbclass, defines the variable with ?=, and you
> used += before the inherit, then it will have a value, and the ?=
> won't assign.  I assume native.bbclass does it this way today so you
> can override the automatic behavior by defining the variable yourself,
> but I'll let Richard speak to that decision.

Thats the quick summary, yes. The DEPENDS variable is manipulated in
several different ways by the core and by .bb files and to coexist with
that, native.bbclass needs to play more games of its own. I recently
commented on that in another thread on this list.

I don't like the current situation, I'd like to simplify it and am open
to proposals on how we could do that as its too complicated at the
moment.

I would add that it does work though and the current situation using
BBCLASSEXTEND is a lot better than having many native .bb files IMO and
moves use closer to where we'd like to be.

Cheers,

Richard




^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DEPENDS tranlation with BBCLASSEXTEND
  2011-03-27 23:03 ` Chris Larson
  2011-03-28 12:48   ` Richard Purdie
@ 2011-03-28 19:03   ` Tom Rini
  2011-03-28 19:48     ` Khem Raj
  1 sibling, 1 reply; 8+ messages in thread
From: Tom Rini @ 2011-03-28 19:03 UTC (permalink / raw)
  To: openembedded-core

On 03/27/2011 04:03 PM, Chris Larson wrote:
> On Sun, Mar 27, 2011 at 1:08 PM, Khem Raj <raj.khem@gmail.com> wrote:
>> I observed that if I have
>> DEPENDS = "a b" in recipe.bb which has BBCLASSEXTEND = "native"
>> then dependecies for recipe-native shows a-native b-native so far so
>> good
>>
>> Now if I want to add a dependency which only is needed for native recipe
>> I do
>>
>> DEPENDS_virtclass-native += "c-native"
>>
>> what this does is it will ignore a-native and b-native dependencies and
>> only adds "c-native" to depends of native recipe
>>
>> DEPENDS_virtclass-native_append = " c-native"
>>
>> This does what I wanted i.e. have deps on a-native b-native c-native
>>
>> I think behavior of += or _append should be similar. Is my understanding
>> correct ?
> 
> They've never been the same.  += is immediate, _append is delayed.  If
> a class, say, native.bbclass, defines the variable with ?=, and you
> used += before the inherit, then it will have a value, and the ?=
> won't assign.  I assume native.bbclass does it this way today so you
> can override the automatic behavior by defining the variable yourself,
> but I'll let Richard speak to that decision.

As Richard said, this is a good summary.  And a shorter still summary
(as Chris reminds me everytime I forget) is that since BBCLASSEXTENDS
makes use of an override already (virtclass-native/cross/etc) you must
keep that in mind when further modifying it as you get not what you
expected but what you asked for.

-- 
Tom Rini
Mentor Graphics Corporation



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DEPENDS tranlation with BBCLASSEXTEND
  2011-03-28 19:03   ` Tom Rini
@ 2011-03-28 19:48     ` Khem Raj
  2011-03-28 20:06       ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Khem Raj @ 2011-03-28 19:48 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Mon, Mar 28, 2011 at 12:03 PM, Tom Rini <tom_rini@mentor.com> wrote:
> On 03/27/2011 04:03 PM, Chris Larson wrote:
>> On Sun, Mar 27, 2011 at 1:08 PM, Khem Raj <raj.khem@gmail.com> wrote:
>>> I observed that if I have
>>> DEPENDS = "a b" in recipe.bb which has BBCLASSEXTEND = "native"
>>> then dependecies for recipe-native shows a-native b-native so far so
>>> good
>>>
>>> Now if I want to add a dependency which only is needed for native recipe
>>> I do
>>>
>>> DEPENDS_virtclass-native += "c-native"
>>>
>>> what this does is it will ignore a-native and b-native dependencies and
>>> only adds "c-native" to depends of native recipe
>>>
>>> DEPENDS_virtclass-native_append = " c-native"
>>>
>>> This does what I wanted i.e. have deps on a-native b-native c-native
>>>
>>> I think behavior of += or _append should be similar. Is my understanding
>>> correct ?
>>
>> They've never been the same.  += is immediate, _append is delayed.  If
>> a class, say, native.bbclass, defines the variable with ?=, and you
>> used += before the inherit, then it will have a value, and the ?=
>> won't assign.  I assume native.bbclass does it this way today so you
>> can override the automatic behavior by defining the variable yourself,
>> but I'll let Richard speak to that decision.
>
> As Richard said, this is a good summary.  And a shorter still summary
> (as Chris reminds me everytime I forget) is that since BBCLASSEXTENDS
> makes use of an override already (virtclass-native/cross/etc) you must
> keep that in mind when further modifying it as you get not what you
> expected but what you asked for.
>

Yes no doubt on how it works and can be coded to likings of what we
have but I think
that having += and friends as well as _append and _prepend could be
combined into one logic
immediate appending/prepending operation may be confusing IMO while
immediate assignments
I think still are ok. We have more than one directives doing very
similar yet semantically different operations
It becomes hard for recipe writers. May be I am over simplifying

> --
> Tom Rini
> Mentor Graphics Corporation
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DEPENDS tranlation with BBCLASSEXTEND
  2011-03-28 19:48     ` Khem Raj
@ 2011-03-28 20:06       ` Tom Rini
  2011-03-28 20:11         ` Khem Raj
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Rini @ 2011-03-28 20:06 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

On 03/28/2011 12:48 PM, Khem Raj wrote:
> On Mon, Mar 28, 2011 at 12:03 PM, Tom Rini <tom_rini@mentor.com> wrote:
>> On 03/27/2011 04:03 PM, Chris Larson wrote:
>>> On Sun, Mar 27, 2011 at 1:08 PM, Khem Raj <raj.khem@gmail.com> wrote:
>>>> I observed that if I have
>>>> DEPENDS = "a b" in recipe.bb which has BBCLASSEXTEND = "native"
>>>> then dependecies for recipe-native shows a-native b-native so far so
>>>> good
>>>>
>>>> Now if I want to add a dependency which only is needed for native recipe
>>>> I do
>>>>
>>>> DEPENDS_virtclass-native += "c-native"
>>>>
>>>> what this does is it will ignore a-native and b-native dependencies and
>>>> only adds "c-native" to depends of native recipe
>>>>
>>>> DEPENDS_virtclass-native_append = " c-native"
>>>>
>>>> This does what I wanted i.e. have deps on a-native b-native c-native
>>>>
>>>> I think behavior of += or _append should be similar. Is my understanding
>>>> correct ?
>>>
>>> They've never been the same.  += is immediate, _append is delayed.  If
>>> a class, say, native.bbclass, defines the variable with ?=, and you
>>> used += before the inherit, then it will have a value, and the ?=
>>> won't assign.  I assume native.bbclass does it this way today so you
>>> can override the automatic behavior by defining the variable yourself,
>>> but I'll let Richard speak to that decision.
>>
>> As Richard said, this is a good summary.  And a shorter still summary
>> (as Chris reminds me everytime I forget) is that since BBCLASSEXTENDS
>> makes use of an override already (virtclass-native/cross/etc) you must
>> keep that in mind when further modifying it as you get not what you
>> expected but what you asked for.
>>
> 
> Yes no doubt on how it works and can be coded to likings of what we
> have but I think
> that having += and friends as well as _append and _prepend could be
> combined into one logic
> immediate appending/prepending operation may be confusing IMO while
> immediate assignments
> I think still are ok. We have more than one directives doing very
> similar yet semantically different operations
> It becomes hard for recipe writers. May be I am over simplifying

The problem is that we have different operators for different things.
Usually +=/=+ are what you want in a recipe for variables and append /
prepend are for classes that do tricky things.  The problem, as Richard
explains is that BBCLASSEXTEND makes things special and we need to deal
with that better.

-- 
Tom Rini
Mentor Graphics Corporation



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DEPENDS tranlation with BBCLASSEXTEND
  2011-03-28 20:06       ` Tom Rini
@ 2011-03-28 20:11         ` Khem Raj
  2011-03-28 20:24           ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Khem Raj @ 2011-03-28 20:11 UTC (permalink / raw)
  To: Tom Rini; +Cc: Patches and discussions about the oe-core layer

On Mon, Mar 28, 2011 at 1:06 PM, Tom Rini <tom_rini@mentor.com> wrote:
> On 03/28/2011 12:48 PM, Khem Raj wrote:
>> On Mon, Mar 28, 2011 at 12:03 PM, Tom Rini <tom_rini@mentor.com> wrote:
>>> On 03/27/2011 04:03 PM, Chris Larson wrote:
>>>> On Sun, Mar 27, 2011 at 1:08 PM, Khem Raj <raj.khem@gmail.com> wrote:
>>>>> I observed that if I have
>>>>> DEPENDS = "a b" in recipe.bb which has BBCLASSEXTEND = "native"
>>>>> then dependecies for recipe-native shows a-native b-native so far so
>>>>> good
>>>>>
>>>>> Now if I want to add a dependency which only is needed for native recipe
>>>>> I do
>>>>>
>>>>> DEPENDS_virtclass-native += "c-native"
>>>>>
>>>>> what this does is it will ignore a-native and b-native dependencies and
>>>>> only adds "c-native" to depends of native recipe
>>>>>
>>>>> DEPENDS_virtclass-native_append = " c-native"
>>>>>
>>>>> This does what I wanted i.e. have deps on a-native b-native c-native
>>>>>
>>>>> I think behavior of += or _append should be similar. Is my understanding
>>>>> correct ?
>>>>
>>>> They've never been the same.  += is immediate, _append is delayed.  If
>>>> a class, say, native.bbclass, defines the variable with ?=, and you
>>>> used += before the inherit, then it will have a value, and the ?=
>>>> won't assign.  I assume native.bbclass does it this way today so you
>>>> can override the automatic behavior by defining the variable yourself,
>>>> but I'll let Richard speak to that decision.
>>>
>>> As Richard said, this is a good summary.  And a shorter still summary
>>> (as Chris reminds me everytime I forget) is that since BBCLASSEXTENDS
>>> makes use of an override already (virtclass-native/cross/etc) you must
>>> keep that in mind when further modifying it as you get not what you
>>> expected but what you asked for.
>>>
>>
>> Yes no doubt on how it works and can be coded to likings of what we
>> have but I think
>> that having += and friends as well as _append and _prepend could be
>> combined into one logic
>> immediate appending/prepending operation may be confusing IMO while
>> immediate assignments
>> I think still are ok. We have more than one directives doing very
>> similar yet semantically different operations
>> It becomes hard for recipe writers. May be I am over simplifying
>
> The problem is that we have different operators for different things.
> Usually +=/=+ are what you want in a recipe for variables and append /
> prepend are for classes that do tricky things.

well can you generalize like this for languages ? I am thinking of say
in C you cant
restrict usage to abstractions like this this only can be used in
header and this in C files

Even if we do then we should make
bitbake refuse do _append/_prepend operations in .bb files.

 The problem, as Richard
> explains is that BBCLASSEXTEND makes things special and we need to deal
> with that better.
>
> --
> Tom Rini
> Mentor Graphics Corporation
>



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: DEPENDS tranlation with BBCLASSEXTEND
  2011-03-28 20:11         ` Khem Raj
@ 2011-03-28 20:24           ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2011-03-28 20:24 UTC (permalink / raw)
  To: Khem Raj; +Cc: Patches and discussions about the oe-core layer

On 03/28/2011 01:11 PM, Khem Raj wrote:
> On Mon, Mar 28, 2011 at 1:06 PM, Tom Rini <tom_rini@mentor.com> wrote:
>> On 03/28/2011 12:48 PM, Khem Raj wrote:
>>> On Mon, Mar 28, 2011 at 12:03 PM, Tom Rini <tom_rini@mentor.com> wrote:
>>>> On 03/27/2011 04:03 PM, Chris Larson wrote:
>>>>> On Sun, Mar 27, 2011 at 1:08 PM, Khem Raj <raj.khem@gmail.com> wrote:
>>>>>> I observed that if I have
>>>>>> DEPENDS = "a b" in recipe.bb which has BBCLASSEXTEND = "native"
>>>>>> then dependecies for recipe-native shows a-native b-native so far so
>>>>>> good
>>>>>>
>>>>>> Now if I want to add a dependency which only is needed for native recipe
>>>>>> I do
>>>>>>
>>>>>> DEPENDS_virtclass-native += "c-native"
>>>>>>
>>>>>> what this does is it will ignore a-native and b-native dependencies and
>>>>>> only adds "c-native" to depends of native recipe
>>>>>>
>>>>>> DEPENDS_virtclass-native_append = " c-native"
>>>>>>
>>>>>> This does what I wanted i.e. have deps on a-native b-native c-native
>>>>>>
>>>>>> I think behavior of += or _append should be similar. Is my understanding
>>>>>> correct ?
>>>>>
>>>>> They've never been the same.  += is immediate, _append is delayed.  If
>>>>> a class, say, native.bbclass, defines the variable with ?=, and you
>>>>> used += before the inherit, then it will have a value, and the ?=
>>>>> won't assign.  I assume native.bbclass does it this way today so you
>>>>> can override the automatic behavior by defining the variable yourself,
>>>>> but I'll let Richard speak to that decision.
>>>>
>>>> As Richard said, this is a good summary.  And a shorter still summary
>>>> (as Chris reminds me everytime I forget) is that since BBCLASSEXTENDS
>>>> makes use of an override already (virtclass-native/cross/etc) you must
>>>> keep that in mind when further modifying it as you get not what you
>>>> expected but what you asked for.
>>>>
>>>
>>> Yes no doubt on how it works and can be coded to likings of what we
>>> have but I think
>>> that having += and friends as well as _append and _prepend could be
>>> combined into one logic
>>> immediate appending/prepending operation may be confusing IMO while
>>> immediate assignments
>>> I think still are ok. We have more than one directives doing very
>>> similar yet semantically different operations
>>> It becomes hard for recipe writers. May be I am over simplifying
>>
>> The problem is that we have different operators for different things.
>> Usually +=/=+ are what you want in a recipe for variables and append /
>> prepend are for classes that do tricky things.
> 
> well can you generalize like this for languages ? I am thinking of say
> in C you cant
> restrict usage to abstractions like this this only can be used in
> header and this in C files
> 
> Even if we do then we should make
> bitbake refuse do _append/_prepend operations in .bb files.

I think this is getting blown out of proportion.  The issue here is that
BBCLASSEXTEND "breaks" the model people have of how they can modify
variables since there's a tendency to tread "DEPENDS_virtclass-native"
like it's "DEPENDSVIRTCLASSNATIVE" and doesn't already have one set of
operators applied already, when it does.  And Richard as suggested
something that should help here so that what most people assume works
(since it works elsewhere) will keep working.


-- 
Tom Rini
Mentor Graphics Corporation



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-03-28 20:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-27 20:08 DEPENDS tranlation with BBCLASSEXTEND Khem Raj
2011-03-27 23:03 ` Chris Larson
2011-03-28 12:48   ` Richard Purdie
2011-03-28 19:03   ` Tom Rini
2011-03-28 19:48     ` Khem Raj
2011-03-28 20:06       ` Tom Rini
2011-03-28 20:11         ` Khem Raj
2011-03-28 20:24           ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox