Reputation: 4508
Reading a book on Yocto. Got to the following page, which says:
BitBake provides a very easy-to-use way to write conditional metadata. It is done by a mechanism called overrides.
The OVERRIDES variable contains values separated by colons (:), and each value is an item we want to satisfy conditions. So, if we have a variable that is conditional on arm, and arm is in OVERRIDES, then the version of the variable that is specific to arm is used rather than the non-conditional version, as shown:
OVERRIDES = "architecture:os:machine" TEST = "defaultvalue" TEST_os = "osspecificvalue" TEST_other = "othercondvalue"
In this example,
TEST
will beosspecificvalue
due to the condition of os being inOVERRIDES
.
I'm unclear from this explanation how did TEST
become equal to osspecificvalue
. Would someone be able to explain it?
Upvotes: 7
Views: 9730
Reputation: 5866
NOTE: I have kept the text of this answer unchanged for historical purposes. However, as of Yocto version 3.4, underscores (_) are no longer used to refer to an override, but rather a colon (:) is used. See the migration notes for details.
Bitbake implements it's own dictionary data structure based on Python's MutableMapping in lib/bb/data_smart.py. The goal is to create a dictionary with more flexibility in that each value in the "key,value" pair can be overridden based on specific identifiers.
If you look at how the variables in this dictionary are set, you will see that the datastore allows "overrides" of variables based on a list of override identifiers. These identifiers are expected to be appended with an underscore, like in your example of "TEST_os".
In the case you are referencing, "other" identifier is not in the list of OVERRIDES, so this "smart dictionary" does not override the value of TEST with "othercondvalue". However, because the "os" identifier is in the list of OVERRIDES, the value of TEST is indeed overridden with the value "osspecificvalue".
I would highly recommend reading through the DataSmart class as this is a very simplified explanation, but hopefully it helps.
Also, see the BitBake manual entry for OVERRIDES for more information.
Upvotes: 4