All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [bitbake-devel] [PATCH v2] bitbake-user-manual: Correct description of the ??= operator
       [not found] <16F51C865CCCC8A5.4993@lists.openembedded.org>
@ 2022-06-10  5:54 ` Jacob Kroon
  0 siblings, 0 replies; 2+ messages in thread
From: Jacob Kroon @ 2022-06-10  5:54 UTC (permalink / raw)
  To: bitbake-devel; +Cc: docs

On 6/3/22 14:36, Jacob Kroon via lists.openembedded.org wrote:
> Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
> ---
> 
> Changes in v2:
> * Add comment to line with immediate variable expansion
> 
>   .../bitbake-user-manual-metadata.rst          | 31 +++++++++----------
>   1 file changed, 15 insertions(+), 16 deletions(-)
> 
> diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> index af4b1358..cfe46562 100644
> --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> @@ -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}"
> +   W ?= "z"
> +
> +After parsing we will have::
> +
> +   A = "x"
> +   B = "z"
> +   W = "z"
>   
>   Immediate variable expansion (:=)
>   ---------------------------------
> 

Any thoughts on the changes above ?

Jacob


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bitbake-devel] [PATCH v2] bitbake-user-manual: Correct description of the ??= operator
  2022-06-03 12:36 Jacob Kroon
@ 2022-06-10 18:03 ` Michael Opdenacker
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Opdenacker @ 2022-06-10 18:03 UTC (permalink / raw)
  To: Jacob Kroon, bitbake-devel; +Cc: docs

Hi Jacob

Many thanks for this update to the BitBake manual.

On 6/3/22 14:36, Jacob Kroon wrote:
> Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
> ---
>
> Changes in v2:
> * Add comment to line with immediate variable expansion


Would it also possible to mention what was wrong in the previous 
description?
The fact that the assignment is made at the end of the parsing process, 
which isn't correct given the example that you give? Otherwise, A := 
"${W}" wouldn't work, right?

>
>   .../bitbake-user-manual-metadata.rst          | 31 +++++++++----------
>   1 file changed, 15 insertions(+), 16 deletions(-)
>
> diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> index af4b1358..cfe46562 100644
> --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> @@ -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::

Shouldn't we say "via any of the other assignment operators" instead?
It would sound a little better to me.

Thanks again
Michael

-- 
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-10 18:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <16F51C865CCCC8A5.4993@lists.openembedded.org>
2022-06-10  5:54 ` [bitbake-devel] [PATCH v2] bitbake-user-manual: Correct description of the ??= operator Jacob Kroon
2022-06-03 12:36 Jacob Kroon
2022-06-10 18:03 ` [bitbake-devel] " Michael Opdenacker

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.