1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 01:19:52 +00:00

bitbake: bitbake-user-manual: Correct description of the ??= operator

Stating that the assignment is done at the end of parsing is misleading.
The weak default value is the value which a variable will expand to if no value
has been assigned to it using any of the assignment operators.

(Bitbake rev: 8189f58d0449d16f162b6e8d98c4e5edc6bff875)

Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Jacob Kroon
2022-06-15 11:23:45 +02:00
committed by Richard Purdie
parent 5aca7a8f10
commit 1c02032564
@@ -195,22 +195,45 @@ value. However, if ``A`` is not set, the variable is set to "aval".
Setting a weak default value (??=) Setting a weak default value (??=)
---------------------------------- ----------------------------------
It is possible to use a "weaker" assignment than in the previous section The weak default value of a variable is the value which that variable
by using the "??=" operator. This assignment behaves identical to "?=" will expand to if no value has been assigned to it via any of the other
except that the assignment is made at the end of the parsing process assignment operators. The "??=" operator takes effect immediately, replacing
rather than immediately. Consequently, when multiple "??=" assignments any previously defined weak default value. Here is an example::
exist, the last one is used. Also, any "=" or "?=" assignment will
override the value set with "??=". Here is an example::
A ??= "somevalue" W ??= "x"
A ??= "someothervalue" A := "${W}" # Immediate variable expansion
W ??= "y"
B := "${W}" # Immediate variable expansion
W ??= "z"
C = "${W}"
W ?= "i"
If ``A`` is set before the above statements are After parsing we will have::
parsed, the variable retains its value. If ``A`` is not set, the
variable is set to "someothervalue".
Again, this assignment is a "lazy" or "weak" assignment because it does A = "x"
not occur until the end of the parsing process. B = "y"
C = "i"
W = "i"
Appending and prepending non-override style will not substitute the weak
default value, which means that after parsing::
W ??= "x"
W += "y"
we will have::
W = " y"
On the other hand, override-style appends/prepends/removes are applied after
any active weak default value has been substituted::
W ??= "x"
W:append = "y"
After parsing we will have::
W = "xy"
Immediate variable expansion (:=) Immediate variable expansion (:=)
--------------------------------- ---------------------------------