* argh ... "_append" versus "+=" and IMAGE_INSTALL confusion
@ 2012-03-29 19:23 Robert P. J. Day
2012-03-29 19:29 ` Eric Bénard
0 siblings, 1 reply; 9+ messages in thread
From: Robert P. J. Day @ 2012-03-29 19:23 UTC (permalink / raw)
To: OE Core mailing list
forgive me for free associating for just a few minutes, but here's
something that has the potential to be massively confusing for
beginners.
starting with core-image.bbclass, this is just a coding philosophy
but i'm not crazy about this:
CORE_IMAGE_BASE_INSTALL = '\
task-core-boot \
task-base-extended \
\
${CORE_IMAGE_EXTRA_INSTALL} \
'
CORE_IMAGE_EXTRA_INSTALL ?= ""
IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}"
at a glance, it looks weird that IMAGE_INSTALL is simply assigned
the value of CORE_IMAGE_BASE_INSTALL, and it's only when you look up
that you notice there's a CORE_IMAGE_EXTRA_INSTALL that you can use
which is buried inside the assignment to CORE_IMAGE_BASE_INSTALL.
doing it that way forces a reader to follow the chain of assignments
to see what's happening.
it would be much clearer to write (if it's equivalent):
CORE_IMAGE_BASE_INSTALL = '\
task-core-boot \
task-base-extended \
'
CORE_IMAGE_EXTRA_INSTALL ?= ""
IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL} ${CORE_IMAGE_EXTRA_INSTALL}"
there. now in the space of that single line, i can see that the
*final* value for IMAGE_INSTALL comes from two other values. and i
can even see which one appears to be the one *i* should mess with --
the one containing "EXTRA". that construct is almost self-explanatory
and, for me, much clearer than the first one. but wait, there's more.
in the current *released* reference manual, there is a suggestion
for how to create custom images:
"For example, if a developer wants to add strace into the
core-image-sato image, they can use the following recipe:
require core-image-sato.bb
IMAGE_INSTALL += "strace"
ok, but what's the point of having CORE_IMAGE_EXTRA_INSTALL if you
don't tell people to use it?
require core-image-sato.bb
CORE_IMAGE_EXTRA_INSTALL = "strace"
are those two definitions equivalent? is there any advantage to one
over the other?
and finally, in the *development* version of the reference manual,
you find the new content:
file:///home/rpjday/yocto/yocto-docs/documentation/poky-ref-manual/poky-ref-manual.html#var-IMAGE_INSTALL
"When you use this variable, it is best to use it as follows:
IMAGE_INSTALL_append = " package-name"
argh. so what's wrong with using CORE_IMAGE_EXTRA_INSTALL? numerous
oe-core .bb files don't take that advice -- see
core-image-minimal-mtdutils.bb:
require core-image-minimal.bb
... snip ...
IMAGE_INSTALL += "mtd-utils"
so what is best practise here?
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: argh ... "_append" versus "+=" and IMAGE_INSTALL confusion
2012-03-29 19:23 argh ... "_append" versus "+=" and IMAGE_INSTALL confusion Robert P. J. Day
@ 2012-03-29 19:29 ` Eric Bénard
2012-03-29 19:35 ` Robert P. J. Day
0 siblings, 1 reply; 9+ messages in thread
From: Eric Bénard @ 2012-03-29 19:29 UTC (permalink / raw)
To: openembedded-core
Le Thu, 29 Mar 2012 15:23:20 -0400 (EDT),
"Robert P. J. Day" <rpjday@crashcourse.ca> a écrit :
> so what is best practise here?
>
for this one you have an answer on OE's wiki :
http://www.openembedded.org/wiki/I_want_an_image_with_package_XYZ_installed
Eric
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: argh ... "_append" versus "+=" and IMAGE_INSTALL confusion
2012-03-29 19:29 ` Eric Bénard
@ 2012-03-29 19:35 ` Robert P. J. Day
2012-03-29 19:39 ` Eric Bénard
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Robert P. J. Day @ 2012-03-29 19:35 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1067 bytes --]
On Thu, 29 Mar 2012, Eric Bénard wrote:
> Le Thu, 29 Mar 2012 15:23:20 -0400 (EDT),
> "Robert P. J. Day" <rpjday@crashcourse.ca> a écrit :
> > so what is best practise here?
> >
> for this one you have an answer on OE's wiki :
> http://www.openembedded.org/wiki/I_want_an_image_with_package_XYZ_installed
despite the fact that the current reference manual *explicitly*
says this?
"Using IMAGE_INSTALL with the += operator from the /conf/local.conf
file or from within an image recipe is not recommended as it can cause
ordering issues."
i actually did my research before i asked that question, you know.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: argh ... "_append" versus "+=" and IMAGE_INSTALL confusion
2012-03-29 19:35 ` Robert P. J. Day
@ 2012-03-29 19:39 ` Eric Bénard
2012-03-29 19:42 ` Chris Larson
2012-03-29 20:42 ` Paul Eggleton
2 siblings, 0 replies; 9+ messages in thread
From: Eric Bénard @ 2012-03-29 19:39 UTC (permalink / raw)
To: openembedded-core
Le Thu, 29 Mar 2012 15:35:10 -0400 (EDT),
"Robert P. J. Day" <rpjday@crashcourse.ca> a écrit :
> On Thu, 29 Mar 2012, Eric Bénard wrote:
>
> > Le Thu, 29 Mar 2012 15:23:20 -0400 (EDT),
> > "Robert P. J. Day" <rpjday@crashcourse.ca> a écrit :
> > > so what is best practise here?
> > >
> > for this one you have an answer on OE's wiki :
> > http://www.openembedded.org/wiki/I_want_an_image_with_package_XYZ_installed
>
> despite the fact that the current reference manual *explicitly*
> says this?
>
> "Using IMAGE_INSTALL with the += operator from the /conf/local.conf
> file or from within an image recipe is not recommended as it can cause
> ordering issues."
>
> i actually did my research before i asked that question, you know.
>
fine, sorry for trying to give an answer to your question.
Eric
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: argh ... "_append" versus "+=" and IMAGE_INSTALL confusion
2012-03-29 19:35 ` Robert P. J. Day
2012-03-29 19:39 ` Eric Bénard
@ 2012-03-29 19:42 ` Chris Larson
2012-03-29 19:49 ` Robert P. J. Day
2012-03-29 20:42 ` Paul Eggleton
2 siblings, 1 reply; 9+ messages in thread
From: Chris Larson @ 2012-03-29 19:42 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
On Thu, Mar 29, 2012 at 12:35 PM, Robert P. J. Day
<rpjday@crashcourse.ca> wrote:
> On Thu, 29 Mar 2012, Eric Bénard wrote:
>
>> Le Thu, 29 Mar 2012 15:23:20 -0400 (EDT),
>> "Robert P. J. Day" <rpjday@crashcourse.ca> a écrit :
>> > so what is best practise here?
>> >
>> for this one you have an answer on OE's wiki :
>> http://www.openembedded.org/wiki/I_want_an_image_with_package_XYZ_installed
>
> despite the fact that the current reference manual *explicitly*
> says this?
>
> "Using IMAGE_INSTALL with the += operator from the /conf/local.conf
> file or from within an image recipe is not recommended as it can cause
> ordering issues."
>
> i actually did my research before i asked that question, you know.
The two aren't conflicting. The wiki page talks about creating an
image or using bbappend, where += works fine. You have to use _append
in local.conf because it's postponed, occurs at the end of the parse.
If you use += there, the recipe will then set IMAGE_INSTALL, blowing
away the global value you +='d to.
--
Christopher Larson
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: argh ... "_append" versus "+=" and IMAGE_INSTALL confusion
2012-03-29 19:42 ` Chris Larson
@ 2012-03-29 19:49 ` Robert P. J. Day
0 siblings, 0 replies; 9+ messages in thread
From: Robert P. J. Day @ 2012-03-29 19:49 UTC (permalink / raw)
To: Patches and discussions about the oe-core layer
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1823 bytes --]
On Thu, 29 Mar 2012, Chris Larson wrote:
> On Thu, Mar 29, 2012 at 12:35 PM, Robert P. J. Day
> <rpjday@crashcourse.ca> wrote:
> > On Thu, 29 Mar 2012, Eric Bénard wrote:
> >
> >> Le Thu, 29 Mar 2012 15:23:20 -0400 (EDT),
> >> "Robert P. J. Day" <rpjday@crashcourse.ca> a écrit :
> >> > so what is best practise here?
> >> >
> >> for this one you have an answer on OE's wiki :
> >> http://www.openembedded.org/wiki/I_want_an_image_with_package_XYZ_installed
> >
> > despite the fact that the current reference manual *explicitly*
> > says this?
> >
> > "Using IMAGE_INSTALL with the += operator from the /conf/local.conf
> > file or from within an image recipe is not recommended as it can cause
> > ordering issues."
> >
> > i actually did my research before i asked that question, you know.
>
> The two aren't conflicting. The wiki page talks about creating an
> image or using bbappend, where += works fine. You have to use _append
> in local.conf because it's postponed, occurs at the end of the parse.
> If you use += there, the recipe will then set IMAGE_INSTALL, blowing
> away the global value you +='d to.
i'm confused ... the current ref manual specifically (as you can
read above) discourages the use of += "from within an image recipe",
which is *precisely* what the wiki page is advocating. so, yes, it
*is* conflicting advice.
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: argh ... "_append" versus "+=" and IMAGE_INSTALL confusion
2012-03-29 19:35 ` Robert P. J. Day
2012-03-29 19:39 ` Eric Bénard
2012-03-29 19:42 ` Chris Larson
@ 2012-03-29 20:42 ` Paul Eggleton
2012-03-30 10:23 ` Robert P. J. Day
2 siblings, 1 reply; 9+ messages in thread
From: Paul Eggleton @ 2012-03-29 20:42 UTC (permalink / raw)
To: Robert P. J. Day; +Cc: openembedded-core
On Thursday 29 March 2012 15:35:10 Robert P. J. Day wrote:
> On Thu, 29 Mar 2012, Eric Bénard wrote:
> > Le Thu, 29 Mar 2012 15:23:20 -0400 (EDT),
> >
> > "Robert P. J. Day" <rpjday@crashcourse.ca> a écrit :
> > > so what is best practise here?
> >
> > for this one you have an answer on OE's wiki :
> > http://www.openembedded.org/wiki/I_want_an_image_with_package_XYZ_installe
> > d
>
> despite the fact that the current reference manual *explicitly*
> says this?
>
> "Using IMAGE_INSTALL with the += operator from the /conf/local.conf
> file or from within an image recipe is not recommended as it can cause
> ordering issues."
I think what the manual is attempting to mitigate is a situation where you do
the following in your image recipe:
-------- snip -------
IMAGE_INSTALL += "somepackage1 somepackage2"
inherit core-image
-------- snip -------
In this instance, because IMAGE_INSTALL is set via ?= within core-
image.bbclass, IMAGE_INSTALL will only be set to "somepackage1 somepackage2"
since the value is already set by the time it gets to the ?=. This is clearly
not what you would want by using +=.
Doing the following in an image recipe will work properly however:
-------- snip -------
inherit core-image
IMAGE_INSTALL += "somepackage1 somepackage2"
-------- snip -------
Personally I think the text you quoted from the manual should be adjusted;
there's nothing wrong with IMAGE_INSTALL += _in an image recipe_ provided that
you do it _after_ the inherit of core-image.
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: argh ... "_append" versus "+=" and IMAGE_INSTALL confusion
2012-03-29 20:42 ` Paul Eggleton
@ 2012-03-30 10:23 ` Robert P. J. Day
2012-03-30 10:52 ` Paul Eggleton
0 siblings, 1 reply; 9+ messages in thread
From: Robert P. J. Day @ 2012-03-30 10:23 UTC (permalink / raw)
To: Paul Eggleton; +Cc: openembedded-core
On Thu, 29 Mar 2012, Paul Eggleton wrote:
> I think what the manual is attempting to mitigate is a situation
> where you do the following in your image recipe:
>
> -------- snip -------
> IMAGE_INSTALL += "somepackage1 somepackage2"
>
> inherit core-image
> -------- snip -------
>
> In this instance, because IMAGE_INSTALL is set via ?= within core-
> image.bbclass, IMAGE_INSTALL will only be set to "somepackage1
> somepackage2" since the value is already set by the time it gets to
> the ?=. This is clearly not what you would want by using +=.
>
> Doing the following in an image recipe will work properly however:
>
> -------- snip -------
> inherit core-image
>
> IMAGE_INSTALL += "somepackage1 somepackage2"
> -------- snip -------
>
> Personally I think the text you quoted from the manual should be
> adjusted; there's nothing wrong with IMAGE_INSTALL += _in an image
> recipe_ provided that you do it _after_ the inherit of core-image.
that makes sense, but it seems that a lot of potential confusion
could be avoided if this construct was avoided entirely and replaced
by the appropriate use of CORE_IMAGE_EXTRA_INSTALL, no?
from my position of naivete, i can see that messing with
IMAGE_INSTALL is dangerous if you don't truly know how it's being
manipulated in the underlyling class files.
but the solution is right there in core-image.bbclass:
CORE_IMAGE_BASE_INSTALL = '\
task-core-boot \
task-base-extended \
\
${CORE_IMAGE_EXTRA_INSTALL} \
'
CORE_IMAGE_EXTRA_INSTALL ?= ""
IMAGE_INSTALL ?= "${CORE_IMAGE_BASE_INSTALL}"
that is, stop messing with IMAGE_INSTALL and do your customization
with CORE_IMAGE_EXTRA_INSTALL. isn't that what it was expressly
designed for?
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: argh ... "_append" versus "+=" and IMAGE_INSTALL confusion
2012-03-30 10:23 ` Robert P. J. Day
@ 2012-03-30 10:52 ` Paul Eggleton
0 siblings, 0 replies; 9+ messages in thread
From: Paul Eggleton @ 2012-03-30 10:52 UTC (permalink / raw)
To: Robert P. J. Day; +Cc: openembedded-core
On Friday 30 March 2012 06:23:39 Robert P. J. Day wrote:
> that is, stop messing with IMAGE_INSTALL and do your customization
> with CORE_IMAGE_EXTRA_INSTALL. isn't that what it was expressly
> designed for?
Possibly, but I had assumed though that CORE_IMAGE_EXTRA_INSTALL (and
EXTRA_IMAGE_FEATURES) were intended to be used only from local.conf so that
people modifying them in local.conf could never unintentionally remove things
from the image by assigning to it directly with = as opposed to using +=.
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-03-30 11:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-29 19:23 argh ... "_append" versus "+=" and IMAGE_INSTALL confusion Robert P. J. Day
2012-03-29 19:29 ` Eric Bénard
2012-03-29 19:35 ` Robert P. J. Day
2012-03-29 19:39 ` Eric Bénard
2012-03-29 19:42 ` Chris Larson
2012-03-29 19:49 ` Robert P. J. Day
2012-03-29 20:42 ` Paul Eggleton
2012-03-30 10:23 ` Robert P. J. Day
2012-03-30 10:52 ` Paul Eggleton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox