questions about documenting conditional syntax (overrides)
i've never been crazy about how overrides are explained here:
but it seems that there are advanced usages of overrides that are not mentioned.
first, there doesn't seem to be any mention of using multiple
overrides; here's a sample snippet from meta-oe's rsyslog recipe:
# Disable for powerpc64 with musl
VALGRIND:libc-musl:powerpc64 = ''
VALGRIND:libc-musl:powerpc64le = ''
that appears to incorporate two separate overrides. can there be an arbitrary number of overrides in an assignment? does order matter?
an even weirder example is from meta-freescale's gstreamer plugins
bbappend file:
# The i.MX8 uses KMS instead of the Vivante specific framebuffer API.
# The i.MX7 does not have a GPU, except for ULP.
# This leaves the i.MX6 - with the vendor BSP - as the remaining use case for viv-fb. #
# (Note that viv-fb is about the _windowing system_. Vivante direct texture support
# does not depend on the viv-fb feature. It used to, but that was actually a bug # which was fixed in GStreamer 1.22.5. Since then, the direct texture support is # detected by Meson by checking for direct texture symbols like "glTexDirectVIV".) PACKAGECONFIG_GL:imxgpu2d:append:mx6-nxp-bsp = " viv-fb" PACKAGECONFIG_GL:imxgpu2d:append:mx7-nxp-bsp = " viv-fb"
wow ... an append operation between two overrides? pretty sure that
combination is not covered in the docs. :-)
rday
Hi Robert,
Quoted 11 lines · Robert P. J. Day via lists.yoctoproject.org
i've never been crazy about how overrides are explained here:
but it seems that there are advanced usages of overrides that are not mentioned.
first, there doesn't seem to be any mention of using multiple
overrides; here's a sample snippet from meta-oe's rsyslog recipe:
Quoted 7 lines
# Disable for powerpc64 with musl
VALGRIND:libc-musl:powerpc64 = ''
VALGRIND:libc-musl:powerpc64le = ''that appears to incorporate two separate overrides. can there be an arbitrary number of overrides in an assignment? does order matter?
Pfew. Someone needs to check that, OVERRIDES is *very* complex. It is not easy to explain. We need to do something better with it in the docs I agree. The same can be said for variable context. Also not an easy topic.
If I remember correctly, if no other OVERRIDES is involved for the same variable
VALGRIND:libc-musl:powerpc64
and
VALGRIND:powerpc64:libc-musl
result in the same outcome. Note that :append, :prepend and :remove are NOT typical OVERRIDES and replacing e.g. powerpc64 with append in the above, results in different behavior in some cases (you usually want FOO:append:machine and not FOO:machine:append). We'll omit that for now.
The question is when OVERRIDES A is "weaker" than OVERRIDES B (that is, it appears on the left of B in the OVERRIDES variable), what happens for
FOO1:A:B = "bar"
FOO1:A = "foo"
FOO2:A = "foo"
FOO2:A:B = "bar"
FOO3:A:B = "bar"
FOO3:B = "foo"
FOO4:B = "foo"
FOO4:A:B = "bar"
FOO5:B:A = "bar"
FOO5:A = "foo"
FOO6:A = "foo"
FOO6:B:A = "bar"
FOO7:B:A = "bar"
FOO7:B = "foo"
FOO8:B = "foo"
FOO8:B:A = "bar"
A simple bitbake check should help answering that question.
Quoted 8 lines
an even weirder example is from meta-freescale's gstreamer plugins
bbappend file:# The i.MX8 uses KMS instead of the Vivante specific framebuffer API.
# The i.MX7 does not have a GPU, except for ULP.
# This leaves the i.MX6 - with the vendor BSP - as the remaining use case for viv-fb. #
# (Note that viv-fb is about the_windowingsystem_. Vivante direct texture support
Quoted 9 lines
# does not depend on the viv-fb feature. It used to, but that was actually a bug # which was fixed in GStreamer 1.22.5. Since then, the direct texture support is # detected by Meson by checking for direct texture symbols like "glTexDirectVIV".) PACKAGECONFIG_GL:imxgpu2d:append:mx6-nxp-bsp = " viv-fb" PACKAGECONFIG_GL:imxgpu2d:append:mx7-nxp-bsp = " viv-fb"wow ... an append operation between two overrides? pretty sure that
combination is not covered in the docs. :-)
Yeah... This is a corner case. You basically append to PACKAGECONFIG_GL:imxgpu2d only for mx6-nxp-bsp.
If it was up to me, I would set a variable instead to improve readability.
E.g.
PACKAGECONFIG_GL_NXP_BSP = ""
PACKAGECONFIG_GL_NXP_BSP:mx6-nxp-bsp = " viv-fb"
PACKAGECONFIG_GL_NXP_BSP:mx7-nxp-bsp = " viv-fb"
PACKAGECONFIG_GL:imxgpu2d = "kjbgjbrgb ${PACKAGECONFIG_GL_NXP_BSP}"
Cheers,
Quentin
Quoted 18 lines · Quentin Schulz
Hi Robert,
Quoted 15 lines · Robert P. J. Day via lists.yoctoproject.org
i've never been crazy about how overrides are explained here:
but it seems that there are advanced usages of overrides that are not mentioned.
first, there doesn't seem to be any mention of using multiple
overrides; here's a sample snippet from meta-oe's rsyslog recipe:# Disable for powerpc64 with musl
VALGRIND:libc-musl:powerpc64 = ''
VALGRIND:libc-musl:powerpc64le = ''
Quoted 7 lines
Quoted 3 lines
that appears to incorporate two separate overrides. can there be an arbitrary number of overrides in an assignment? does order matter?
Pfew. Someone needs to check that, OVERRIDES is *very* complex. It is not easy to explain. We need to do something better with it in the docs I agree. The same can be said for variable context. Also not an easy topic.
i remember first reading about overrides and being persistently
confused about what was happening, especially trying to understand the difference between
A:foo:append
A:append:foo
and just this morning as i was experimenting did i have an epiphany about how to look at this. i might be completely off-base, but here's what i came up with. (quentin will love this example).
consider my rockchip jaguar board, which has as two of the overrides
"rk3588" and "jaguar", "jaguar" being the more specific so it should take priority over "rk3588".
now i add the following to my local.conf file for that build:
RDAY = "rday"
RDAY:jaguar = "jaguar"
RDAY:rk3588 = "rk3588"
now since "jaguar" is the more specific of the overrides, that should be the one chosen and, sure enough:
$ bitbake-getvar RDAY RDAY="jaguar" $
now one might say that when that override assignment was
encountered, it assigned the appropriate value to RDAY.
wrong.
what was happening is that, as bitbake was parsing everything,
*three* different variables were being assigned values:
RDAY = "rday"
RDAY:jaguar = "jaguar"
RDAY:rk3588 = "rk3588"
all of those variables exist and i can even display their values:
$ bitbake-getvar RDAY:rk3588 RDAY:rk3588="rk3588" $ bitbake-getvar RDAY:jaguar RDAY:jaguar="jaguar" $
so all of those override assignments are not doing anything with the
base variable RDAY (yet); they're simply assigning to different variables and only at the very end of parsing(?) does bitbake decide which variable's value should be used to assign to RDAY. does that make sense?
Quoted 59 lines · Quentin Schulz
Hi Robert,
Quoted 11 lines · Robert P. J. Day via lists.yoctoproject.org
i've never been crazy about how overrides are explained here:
but it seems that there are advanced usages of overrides that are not mentioned.
first, there doesn't seem to be any mention of using multiple
overrides; here's a sample snippet from meta-oe's rsyslog recipe:Quoted 7 lines
# Disable for powerpc64 with musl
VALGRIND:libc-musl:powerpc64 = ''
VALGRIND:libc-musl:powerpc64le = ''that appears to incorporate two separate overrides. can there be an arbitrary number of overrides in an assignment? does order matter?
Pfew. Someone needs to check that, OVERRIDES is *very* complex. It is not easy to explain. We need to do something better with it in the docs I agree. The same can be said for variable context. Also not an easy topic.
If I remember correctly, if no other OVERRIDES is involved for the same variable
VALGRIND:libc-musl:powerpc64
and
VALGRIND:powerpc64:libc-muslresult in the same outcome. Note that :append, :prepend and :remove are NOT typical OVERRIDES and replacing e.g. powerpc64 with append in the above, results in different behavior in some cases (you usually want FOO:append:machine and not FOO:machine:append). We'll omit that for now.
The question is when OVERRIDES A is "weaker" than OVERRIDES B (that is, it appears on the left of B in the OVERRIDES variable), what happens for
FOO1:A:B = "bar"
FOO1:A = "foo"FOO2:A = "foo"
FOO2:A:B = "bar"FOO3:A:B = "bar"
FOO3:B = "foo"FOO4:B = "foo"
FOO4:A:B = "bar"FOO5:B:A = "bar"
FOO5:A = "foo"FOO6:A = "foo"
FOO6:B:A = "bar"
Quoted 7 lines
FOO7:B:A = "bar"
FOO7:B = "foo"FOO8:B = "foo"
FOO8:B:A = "bar"A simple bitbake check should help answering that question.
as a simple (and realistic) example that follows the way i described
things in my last email, consider the following (where, again, jaguar is more specific than rk3588 and should take precedence):
RDAY:jaguar:rk3588 = "jaguar:rk3588"
RDAY:rk3588:jaguar = "rk3588:jaguar"
don't ask what the final value of RDAY will be; instead understand that there will be *five* variables related to this, all of which i can display with "bitbake-getvar":
RDAY:rk3588:jaguar="rk3588:jaguar"
RDAY:jaguar:rk3588="jaguar:rk3588"
RDAY:rk3588="rk3588:jaguar"
RDAY:jaguar="jaguar:rk3588"
RDAY="rk3588:jaguar"
i'm not sure if that has any more explanatory value, but it makes it easier for me to understand that all those override assignments are just assigning values to variables, and it's all processed finally at the end of parsing to determine the eventual value.
rday