in aid of torturing myself, i'm poring over the bitbake manual and i
recall the initial confusion i had when reading the section on
overrides and appends, especially section 3.3.3 which turns things
around by showing what happens when applying an append to an override,
as opposed to the other way around. here's what i mean, and why i
think there are a few issues in the code base.

  i'm building a core-image-minimal for a qemuarm64, so there are two
overrides in play i care about: "qemuall" and "qemuarm64". now watch
what happens when i do things normally. i add this to local.conf:

RDAY = "first"
RDAY_append = " second"
RDAY_append_qemuarm64 = " third"
RDAY_append_qemuall = " fourth"

unsurprisingly, when i run "bitbake -e", i see exactly what i expect:

RDAY="first second third fourth"

this was entirely predictable, and the way i like to think about this
is that there is exactly one variable in play -- RDAY -- and all those
operations are working on that one variable. so far, so good.

  now let's flip things around and apply the appends to the overrides:

RDAY = "first"
RDAY_append = " second"
RDAY_qemuarm64_append = " third"
RDAY_qemuall_append = " fourth"

bonus points if you can guess what RDAY is set to in the above.
perhaps unexpectedly, what you get is:

RDAY=" third second"

the way i interpret this (based on that section from the BB manual) is
that, in the above, there are *three* variables being worked on:

  * RDAY
  * RDAY_qemuall
  * RDAY_qemuarm64

the append operations are being applied to those respective variables,
after which it is determined which of the overrides has precedence (in
this case, "qemuarm64"), so the value in RDAY_qemuarm64 is assigned to
RDAY, whereupon the final "normal" append (RDAY_append) is processed,
giving a final value of " third second".

  and why do i care? because i don't think there's enough caution for
new developers about the significant difference between those two ways
of doing things; that is, a developer might not realize the result of
doing something like this, thinking it's the right way to do it:

  VAR = "first stuff"
  VAR_<override>_append = " more stuff"

where VAR will quietly end up with the value " more stuff".

  i bring this up because i've run across occasional examples of that
in the code base -- here's
meta-gnome/recipes-connectivity/libnma/libnma_1.8.28.bb:

  EXTRA_OEMESON_mipsarchn32_append = " -Dvapi=false"

is that deliberate, or is it just asking for trouble?

rday

p.s. there's more examples of that.

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#49332): https://lists.yoctoproject.org/g/yocto/message/49332
Mute This Topic: https://lists.yoctoproject.org/mt/73984196/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: 
https://lists.yoctoproject.org/g/yocto/leave/6691583/737036229/xyzzy  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to