wanting to clarify combination of overrides and appends

Robert P. J. Day

moving on to the next nitpicky issue i want to clarify, and that's
*precisely* how overrides and appends are combined. i'm looking at
section 3.3 in the bitbake manual and i don't think the examples there
are as clear as they could be.

NOTE: in the YP docs, i would avoid examples that involve
arbitrarily constructed words like "foo", as the reader might have no
idea what that's supposed to represent, and whether they're supposed
to define it, etc. in what follows, i'm using as my basis a qemuarm64
build, with "qemuarm64" as the obvious override. and so, to work.

to see how overrides affect appends, i added the following to the
top of local.conf:

RDAY = 'initial'
RDAY_qemuarm64_append = ' qemua'
RDAY_append = ' appended'
RDAY_append_qemuarm64 = ' aqemu'
RDAY_qemuarm64 = 'initial_qemu'

then ran "bitbake -e" and extracted just the part related to the above
to get the following two sections, which i will now try to interpret:

# $RDAY [5 operations]
# set /home/rpjday/oe/builds/qemuarm64/conf/local.conf:1
# "initial"
# _append /home/rpjday/oe/builds/qemuarm64/conf/local.conf:3
# " appended"
# _append[qemuarm64]
# " aqemu"
# override[qemuarm64]:_append
# " qemua"
# override[qemuarm64]:set
# "initial_qemu"
# pre-expansion value:
# "initial_qemu qemua appended aqemu"
RDAY="initial_qemu qemua appended aqemu"

# $RDAY_qemuarm64 [2 operations]
# _append /home/rpjday/oe/builds/qemuarm64/conf/local.conf:2
# " qemua"
# set /home/rpjday/oe/builds/qemuarm64/conf/local.conf:5
# "initial_qemu"
# pre-expansion value:
# "initial_qemu qemua"
RDAY_qemuarm64="initial_qemu qemua"

since this is, in fact, a qemuarm64 build, "qemuarm64" is an active
override so let's concentrate on that. my way of looking at this (and
i could be totally offbase) is to say that, in this case, there are
two different variables that are being assigned -- there is the
generic RDAY variable, and there is the one related to the override,
RDAY_qemuarm64, and every assignment must be interpreted as applying
to one or the other.

i'm going to ignore the processing of the RDAY variable, and
concentrate on what happens with RDAY_qemuarm64, as this is where i
think some developers get confused, so let's take this one line at a

RDAY = 'initial'

that line clearly assigns to the generic variable RDAY, so it's of
little interest. moving on ...

RDAY_qemuarm64_append = ' qemua'

ah, now this line does an "append" to RDAY_qemuarm64, which should
then affect the value we will finally use, so let's remember this
append, which will be applied at expansion time. (in a funny way, i
look at this as just doing an append operation to a variable -- that
the variable being appended to has an active override is not, in fact,
taken into account here -- it's just a variable.)

next line:

RDAY_append = ' appended'

this is a regular append to the RDAY variable, so it is again of no
interest related to what we're doing. and here's the line that i think
throws people:

RDAY_append_qemuarm64 = ' aqemu'

at first glance, it looks like it will be part of the eventual
qemuarm64 override value, but that's not what happens. as i read this
(and i could be wrong), this assignment is examined, and the active
"qemuarm64" override means that it will be processed, but the
assignment that will be processed is simply:

RDAY_append = ' aqemu'

that is, the way i would interpret (and explain) the above is to say
that, because the override is active, that string is appended to the
NON-override version of the variable, RDAY. in short, the string
'aqemu' should NOT be part of the final variable value of RDAY in the
context of a qemuarm64 override.

finally, we have:

RDAY_qemuarm64 = 'initial_qemu'

which, because of the active 'qemuarm64' override, re-assigns that
string to RDAY_qemuarm64.

in short, due to the active override of qemuarm64, the only two
lines that have any effect on the value of RDAY that will be *used*
later in a qemuarm64 build are lines 2 and 5:

RDAY = 'initial'
RDAY_qemuarm64_append = ' qemua' <--- 2
RDAY_append = ' appended'
RDAY_append_qemuarm64 = ' aqemu'
RDAY_qemuarm64 = 'initial_qemu' <--- 5

and that is exactly what "bitbake -e" told us above:

# $RDAY_qemuarm64 [2 operations]
# _append /home/rpjday/oe/builds/qemuarm64/conf/local.conf:2
# " qemua"
# set /home/rpjday/oe/builds/qemuarm64/conf/local.conf:5
# "initial_qemu"
# pre-expansion value:
# "initial_qemu qemua"
RDAY_qemuarm64="initial_qemu qemua"

does this make sense? in my experience, beginners have real difficulty
trying to understand how to distinguish between these two operations:

1) RDAY_qemuarm64_append = ' qemua'
2) RDAY_append_qemuarm64 = ' aqemu'

so the way i want to explain it is to think of two variables -- RDAY
and RDAY_qemuarm64 -- that are being created, and in the end, in the
context of a qemuarm64 build, it is the variable RDAY_qemuarm64 that
will be used.

the first line above does a regular append to RDAY_qemuarm64 (so it
will be part of the final value), while the second line, when it is
being parsed, because of the active override, will append to the
regular variable RDAY, and will therefore *not* be part of the final
value. so as long as the way i'm looking at this is correct, i think
this explanation would help beginners understand the difference.



Join {yocto@lists.yoctoproject.org to automatically receive all group messages.