Skip to contentSkip to conversation

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

PATCH Jacob Kroon 1 participant 1 message Jun 10, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 42 lines · Jacob Kroon via lists.openembedded.org

---

Changes in v2:
* Add comment to line with immediate variable expansion

  .../bitbake-user-manual-metadata.rst          | 31 +++++++++----------
  1 file changed, 15 insertions(+), 16 deletions(-)
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +8 -16
index af4b1358..cfe46562 100644
@@ -195,22 +195,21 @@ value. However, if ``A`` is not set, the variable is set to "aval".
  Setting a weak default value (??=)
  ----------------------------------
 
-It is possible to use a "weaker" assignment than in the previous section
-by using the "??=" operator. This assignment behaves identical to "?="
-except that the assignment is made at the end of the parsing process
-rather than immediately. Consequently, when multiple "??=" assignments
-exist, the last one is used. Also, any "=" or "?=" assignment will
-override the value set with "??=". Here is an example::
-
-   A ??= "somevalue"
-   A ??= "someothervalue"
-
-If ``A`` is set before the above statements are
-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
-not occur until the end of the parsing process.
+The weak default value of a variable is the value which that variable
+will expand to if no value has been assigned to it via one of the other
+assignment operators. Here is an example::
+
+   W ??= "x"
+   A := "${W}" # Immediate variable expansion
+   W ??= "y"
+   B = "${W}"

doc/bitbake-user-manual/bitbake-user-manual-metadata.rst value. However, if ``A`` is not set, the variable is set to "aval". · line 215

Quoted 10 lines
doc/bitbake-user-manual/bitbake-user-manual-metadata.rst +7 -0
+   W ?= "z"
+
+After parsing we will have::
+
+   A = "x"
+   B = "z"
+   W = "z"
 
  Immediate variable expansion (:=)
  ---------------------------------

Any thoughts on the changes above ?

Jacob