Skip to contentSkip to conversation

proper "style" for VAR_append_override?

DISCUSSION Robert P. J. Day 2 participants 4 messages Mar 7, 2015 – Mar 12, 2015

lore
Share & tools
lore
#0 lore raw

more nitpickery, but i've noticed a couple different ways in the OE
code base and documentation for conditionally appending based on an override, and it might just be that i'm confused about the underlying mechanics of the append operators.

first, there's this from qemu.inc:

KERNEL_FEATURES_append_pn-linux-yocto = " features/nfsd/nfsd-enable.scc"

i've always read that as, "if override of linux-yocto package is in effect, then add this feature to KERNEL_FEATURES using the "append" operator, which will leave the appending to the end and, in addition, *requires* that we explicitly have that leading space given that we're using _append.

it's also my understanding that i can have multiple assignments like
that (possibly based on different overrides), and they will all be processed properly and finally appended to (in this case) KERNEL_FEATURES. so far, so good?

but if i check the YP ref manual, i see documentation like this:

ref-variables.xml:     KERNEL_FEATURES_append_cedartrail += "bsp/cedartrail/cedartrail-pvr-merge.scc"
ref-variables.xml:     KERNEL_FEATURES_append_cedartrail += "cfg/efi-ext.scc"
ref-variables.xml:     KERNEL_FEATURES_append_cedartrail-nopvr += " cfg/smp.scc"

which looks a bit weird -- combining "_append" with "+=" (and even inconsistently adding that leading space).

is there some difference between the above approaches i've never
understood? is there a preferred style?

rday

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#1 lore raw
Quoted 27 lines · On Saturday 07 March 2015 09:43:34 Robert P. J. Day wrote:

more nitpickery, but i've noticed a couple different ways in the OE
code base and documentation for conditionally appending based on an override, and it might just be that i'm confused about the underlying mechanics of the append operators.

first, there's this from qemu.inc:

KERNEL_FEATURES_append_pn-linux-yocto = " features/nfsd/nfsd-enable.scc"

i've always read that as, "if override of linux-yocto package is in effect, then add this feature to KERNEL_FEATURES using the "append" operator, which will leave the appending to the end and, in addition, *requires* that we explicitly have that leading space given that we're using _append.

it's also my understanding that i can have multiple assignments like
that (possibly based on different overrides), and they will all be processed properly and finally appended to (in this case) KERNEL_FEATURES. so far, so good?

but if i check the YP ref manual, i see documentation like this:

ref-variables.xml: KERNEL_FEATURES_append_cedartrail +=
"bsp/cedartrail/cedartrail-pvr-merge.scc" ref-variables.xml:
KERNEL_FEATURES_append_cedartrail += "cfg/efi-ext.scc" ref-variables.xml:
KERNEL_FEATURES_append_cedartrail-nopvr += " cfg/smp.scc"

Quoted 5 lines

which looks a bit weird -- combining "_append" with "+=" (and even inconsistently adding that leading space).

is there some difference between the above approaches i've never
understood? is there a preferred style?

IMO, '..._append +=' shouldn't be used. It might be assumed that the += accomplishes more than just adding a leading space, which it doesn't. It's much simpler to just include the leading space in the value.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre
#2 lore raw

Re: combining "_append" with "+=" (was: proper "style" for VAR_append_override?)

Quoted 31 lines · Paul Eggleton
Quoted 30 lines · On Saturday 07 March 2015 09:43:34 Robert P. J. Day wrote:

more nitpickery, but i've noticed a couple different ways in the OE
code base and documentation for conditionally appending based on an override, and it might just be that i'm confused about the underlying mechanics of the append operators.

first, there's this from qemu.inc:

KERNEL_FEATURES_append_pn-linux-yocto = " features/nfsd/nfsd-enable.scc"

i've always read that as, "if override of linux-yocto package is in effect, then add this feature to KERNEL_FEATURES using the "append" operator, which will leave the appending to the end and, in addition, *requires* that we explicitly have that leading space given that we're using _append.

it's also my understanding that i can have multiple assignments like
that (possibly based on different overrides), and they will all be processed properly and finally appended to (in this case) KERNEL_FEATURES. so far, so good?

but if i check the YP ref manual, i see documentation like this:

ref-variables.xml: KERNEL_FEATURES_append_cedartrail +=
"bsp/cedartrail/cedartrail-pvr-merge.scc" ref-variables.xml:
KERNEL_FEATURES_append_cedartrail += "cfg/efi-ext.scc" ref-variables.xml:
KERNEL_FEATURES_append_cedartrail-nopvr += " cfg/smp.scc"

which looks a bit weird -- combining "_append" with "+=" (and even inconsistently adding that leading space).

Quoted 7 lines
Quoted 2 lines

is there some difference between the above approaches i've never
understood? is there a preferred style?

IMO, '..._append +=' shouldn't be used. It might be assumed that the += accomplishes more than just adding a leading space, which it doesn't. It's much simpler to just include the leading space in the value.

i agree, and there's a ton of that stuff under the meta-yocto layer
in scripts/lib/bsp/substrate/target/arch (obviously directly related to the very example i pulled out of the reference manual):

$ grep -r "_append.*+=" *
i386/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend:KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc"
i386/recipes-kernel/linux/linux-yocto_3.17.bbappend:KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc"
i386/recipes-kernel/linux/linux-yocto-dev.bbappend:KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc"
i386/recipes-kernel/linux/linux-yocto_3.14.bbappend:KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc"
mips/recipes-kernel/linux/linux-yocto-rt_3.10.bbappend:KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc"
mips/recipes-kernel/linux/linux-yocto-tiny_3.10.bbappend:KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc"
mips/recipes-kernel/linux/linux-yocto-tiny_3.17.bbappend:KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc"
mips/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend:KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc"
mips/recipes-kernel/linux/linux-yocto_3.10.bbappend:KERNEL_FEATURES_append_{{=machine}} += " cfg/smp.scc"
... snip lots more of exactly the same stuff ...
$

it's obviously not hard to grep for the string "_append.*+=" to see
where stuff like this is happening -- i'll let someone else decide what to do about it; most of it is in the meta-yocto layer under scripts/.

final note: i realize that a lot of my nitpickery is just that --
nitpickery -- but i'm trying to prevent possibilities for confusion for newer readers and users. in cases like this, if the (bitbake) manual explains that there's one way to do appending (+=) and a second way to do appending (_append), and readers think they understand the difference, then it's definitely setting them up for confusion to see both constructs being used at the same time on the same line. hence, the relentless pedantry.

rday

p.s. a small number of examples of the same thing under OE layer:

$ grep -r "_append_.*+=" *
recipes-core/libxml/libxml2.inc:RDEPENDS_${PN}-ptest_append_libc-glibc += "glibc-gconv-ebcdic-us glibc-gconv-ibm1141"
recipes-devtools/unfs3/unfs3_0.9.22.r490.bb:DEPENDS_append_class-nativesdk += "flex-nativesdk"
recipes-support/gnutls/gnutls.inc:LDFLAGS_append_libc-uclibc += " -pthread"
$

in cases like that, what is the "preferred" style?

Signature · 7 lines
========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
#3 lore raw

Re: combining "_append" with "+=" (was: proper "style" for VAR_append_override?)

Quoted 68 lines · On Sunday 08 March 2015 04:45:14 Robert P. J. Day wrote:
Quoted 32 lines · Paul Eggleton
Quoted 31 lines · On Saturday 07 March 2015 09:43:34 Robert P. J. Day wrote:

more nitpickery, but i've noticed a couple different ways in the OE

code base and documentation for conditionally appending based on an override, and it might just be that i'm confused about the underlying mechanics of the append operators.

first, there's this from qemu.inc:
KERNEL_FEATURES_append_pn-linux-yocto = " features/nfsd/nfsd-enable.scc"

i've always read that as, "if override of linux-yocto package is in effect, then add this feature to KERNEL_FEATURES using the "append" operator, which will leave the appending to the end and, in addition, *requires* that we explicitly have that leading space given that we're using _append.

it's also my understanding that i can have multiple assignments like

that (possibly based on different overrides), and they will all be processed properly and finally appended to (in this case) KERNEL_FEATURES. so far, so good?

but if i check the YP ref manual, i see documentation like this:
ref-variables.xml: KERNEL_FEATURES_append_cedartrail +=
"bsp/cedartrail/cedartrail-pvr-merge.scc" ref-variables.xml:

KERNEL_FEATURES_append_cedartrail += "cfg/efi-ext.scc" ref-variables.xml:
KERNEL_FEATURES_append_cedartrail-nopvr += " cfg/smp.scc"

which looks a bit weird -- combining "_append" with "+=" (and even inconsistently adding that leading space).

Quoted 8 lines
Quoted 3 lines

is there some difference between the above approaches i've never

understood? is there a preferred style?

IMO, '..._append +=' shouldn't be used. It might be assumed that the += accomplishes more than just adding a leading space, which it doesn't. It's much simpler to just include the leading space in the value.

i agree, and there's a ton of that stuff under the meta-yocto layer
in scripts/lib/bsp/substrate/target/arch (obviously directly related to the very example i pulled out of the reference manual):

$ grep -r "_append.*+=" *
i386/recipes-kernel/linux/linux-yocto-tiny_3.14.bbappend:KERNEL_FEATURES_app
end_{{=machine}} += " cfg/smp.scc"
i386/recipes-kernel/linux/linux-yocto_3.17.bbappend:KERNEL_FEATURES_append_
{{=machine}} += " cfg/smp.scc"
i386/recipes-kernel/linux/linux-yocto-dev.bbappend:KERNEL_FEATURES_append_{
{=machine}} += " cfg/smp.scc"
i386/recipes-kernel/linux/linux-yocto_3.14.bbappend:KERNEL_FEATURES_append_
{{=machine}} += " cfg/smp.scc"
mips/recipes-kernel/linux/linux-yocto-rt_3.10.bbappend:KERNEL_FEATURES_appe
nd_{{=machine}} += " cfg/smp.scc"
mips/recipes-kernel/linux/linux-yocto-tiny_3.10.bbappend:KERNEL_FEATURES_ap
pend_{{=machine}} += " cfg/smp.scc"
mips/recipes-kernel/linux/linux-yocto-tiny_3.17.bbappend:KERNEL_FEATURES_ap
pend_{{=machine}} += " cfg/smp.scc"
mips/recipes-kernel/linux/linux-yocto-rt_3.14.bbappend:KERNEL_FEATURES_appe
nd_{{=machine}} += " cfg/smp.scc"
mips/recipes-kernel/linux/linux-yocto_3.10.bbappend:KERNEL_FEATURES_append_
{{=machine}} += " cfg/smp.scc" ... snip lots more of exactly the same stuff
...
$
Quoted 4 lines

it's obviously not hard to grep for the string "_append.*+=" to see
where stuff like this is happening -- i'll let someone else decide what to do about it; most of it is in the meta-yocto layer under scripts/.

I think pretty much all of those should get fixed. They've probably fallen under the radar since they aren't strictly part of the metadata, but they are important as these are the templates from which new BSPs are created from yocto-bsp.

Quoted 8 lines

final note: i realize that a lot of my nitpickery is just that --
nitpickery -- but i'm trying to prevent possibilities for confusion for newer readers and users. in cases like this, if the (bitbake) manual explains that there's one way to do appending (+=) and a second way to do appending (_append), and readers think they understand the difference, then it's definitely setting them up for confusion to see both constructs being used at the same time on the same line. hence, the relentless pedantry.

Right, and we certainly do appreciate all of your input, I hope we don't seem too grumpy or dismissive in response ;) Our recipes should be the ultimate example in how to do things properly and we should try to make sure that they are if at all possible.

Quoted 11 lines

p.s. a small number of examples of the same thing under OE layer:

$ grep -r "_append_.*+=" *
recipes-core/libxml/libxml2.inc:RDEPENDS_${PN}-ptest_append_libc-glibc +=
"glibc-gconv-ebcdic-us glibc-gconv-ibm1141"
recipes-devtools/unfs3/unfs3_0.9.22.r490.bb:DEPENDS_append_class-nativesdk
+= "flex-nativesdk"
recipes-support/gnutls/gnutls.inc:LDFLAGS_append_libc-uclibc += " -pthread"
$

in cases like that, what is the "preferred" style?

I don't think the presence or absence of an override changes things - the same concern applies.

Cheers,
Paul

Signature · 2 lines
Paul Eggleton
Intel Open Source Technology Centre