Skip to contentSkip to conversation

DEPENDS tranlation with BBCLASSEXTEND

DISCUSSION Khem Raj 4 participants 8 messages Mar 27, 2011 – Mar 28, 2011

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

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

Signature · 1 line
-Khem
#1 lore raw
Quoted 13 lines · Khem Raj

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

Quoted 6 lines

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.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#2 lore raw
Quoted 21 lines · Chris Larson
Quoted 13 lines · Khem Raj

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

Quoted 6 lines

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 ?

Quoted 6 lines

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

#3 lore raw
In reply to Chris Larson
Quoted 21 lines · Chris Larson
Quoted 13 lines · Khem Raj

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

Quoted 6 lines

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 ?

Quoted 6 lines

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.

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
author
#4 lore raw
Quoted 29 lines · Tom Rini
Quoted 21 lines · Chris Larson
Quoted 13 lines · Khem Raj

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

Quoted 6 lines

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 ?

Quoted 6 lines

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.

Quoted 6 lines

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

Quoted 9 lines

--
Tom Rini
Mentor Graphics Corporation

_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

#5 lore raw
Quoted 37 lines · Khem Raj
Quoted 29 lines · Tom Rini
Quoted 21 lines · Chris Larson
Quoted 13 lines · Khem Raj

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

Quoted 6 lines

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 ?

Quoted 6 lines

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.

Quoted 6 lines

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.

Quoted 9 lines

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.

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation
author
#6 lore raw
Quoted 48 lines · Tom Rini
Quoted 37 lines · Khem Raj
Quoted 29 lines · Tom Rini
Quoted 21 lines · Chris Larson
Quoted 13 lines · Khem Raj

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

Quoted 6 lines

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 ?

Quoted 6 lines

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.

Quoted 6 lines

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.

Quoted 9 lines

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

Quoted 3 lines

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

Quoted 7 lines

explains is that BBCLASSEXTEND makes things special and we need to deal with that better.

--
Tom Rini
Mentor Graphics Corporation

#7 lore raw
Quoted 53 lines · Khem Raj
Quoted 48 lines · Tom Rini
Quoted 37 lines · Khem Raj
Quoted 29 lines · Tom Rini
Quoted 21 lines · Chris Larson
Quoted 13 lines · Khem Raj

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

Quoted 6 lines

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 ?

Quoted 6 lines

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.

Quoted 6 lines

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.

Quoted 9 lines

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

Quoted 3 lines

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.

Quoted 7 lines

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.

Signature · 2 lines
Tom Rini
Mentor Graphics Corporation