doc: document override style operators not working for task dependencies

Message ID 20211216152555.815291-1-dwagenknecht@emlix.com
State New
Headers show
Series doc: document override style operators not working for task dependencies | expand

Commit Message

Daniel Wagenknecht Dec. 16, 2021, 3:25 p.m. UTC
Override style operators do not work for specifying task dependencies.
This is not obvious and should be highlighted in the documentation.

Signed-off-by: Daniel Wagenknecht <dwagenknecht@emlix.com>
---

I have experienced this problem with external layers "in the wild" leading to
dependencies being undeclared and builds sometimes failing. Additional
documentation will not necessarily fix the problem, but might make it easier to
find the problem. I'm not sure if there's also some mechanism in bitbake that
could detect such mistakes and provide a warning?

CC: qschulz, we talked about this on IRC:
  https://www.yoctoproject.org/irc/%23yocto.2021-11-30.log.html#t2021-11-30T14:18:08

Sincerely
Daniel Wagenknecht

 .../bitbake-user-manual-metadata.rst          | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Quentin Schulz Dec. 16, 2021, 5:14 p.m. UTC | #1
Hi Daniel,

On December 16, 2021 4:25:56 PM GMT+01:00, Daniel Wagenknecht <dwagenknecht@emlix.com> wrote:
>Override style operators do not work for specifying task dependencies.
>This is not obvious and should be highlighted in the documentation.
>
>Signed-off-by: Daniel Wagenknecht <dwagenknecht@emlix.com>
>---
>
>I have experienced this problem with external layers "in the wild" leading to
>dependencies being undeclared and builds sometimes failing. Additional
>documentation will not necessarily fix the problem, but might make it easier to
>find the problem. I'm not sure if there's also some mechanism in bitbake that
>could detect such mistakes and provide a warning?
>
>CC: qschulz, we talked about this on IRC:
>  https://www.yoctoproject.org/irc/%23yocto.2021-11-30.log.html#t2021-11-30T14:18:08
>
>Sincerely
>Daniel Wagenknecht
>
> .../bitbake-user-manual-metadata.rst          | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
>diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
>index d802a8d3..181c0997 100644
>--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
>+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
>@@ -1689,6 +1689,14 @@ This section describes several ways to declare dependencies. Remember,
> even though dependencies are declared in different ways, they are all
> simply dependencies between tasks.
> 
>+.. note::
>+
>+   Override style operators do not work for declaring task dependencies.
>+   See
>+   :ref:`bitbake-user-manual/bitbake-user-manual-metadata:Inter-Task Dependencies`
>+   for details.
>+
>+
> .. _dependencies-internal-to-the-bb-file:
> 
> Dependencies Internal to the ``.bb`` File
>@@ -1813,6 +1821,17 @@ must have completed before the ``do_patch`` task can execute.
> The ``[rdepends]`` flag works in a similar way but takes targets in the
> runtime namespace instead of the build-time dependency namespace.
> 
>+Note that dependencies are specified via
>+:ref:`bitbake-user-manual/bitbake-user-manual-metadata:Variable Flag Syntax`
>+and thus override style operators do not work for declaring task
>+dependencies. You can add a task dependency for a specific override
>+(e.g. a specific machine) by declaring an intermediary variable and using
>+overrides for setting that variable::
>+
>+   # Does not work: do_compile:machine[depends] += "another_target:do_task"
>+   EXTRA_DO_COMPILE_DEPENDS:machine = "another_target:do_task"
>+   do_compile[depends] += "${EXTRA_DO_COMPILE_DEPENDS}"
>+
> Functions You Can Call From Within Python
>

Nice addition, thanks for the patch!

I think we could make it even more explicit by adding a section in https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html to explicit incompatibility between any OVERRIDES and varflags (or add a note in both sections that it's not compatible with the other) because I think this applies to :append and :prepend too.

Having a specific example for task dependencies is fine IMO but we'd benefit from an even more explicit rule.

Cheers
Quentin


 =========================================
>
Daniel Wagenknecht Dec. 20, 2021, 8:06 a.m. UTC | #2
Hello Quentin,

On Thu, 2021-12-16 at 18:14 +0100, Quentin Schulz wrote:
> I think we could make it even more explicit by adding a section in 
> https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html
> to explicit incompatibility between any OVERRIDES and varflags (or add a note
> in both sections that it's not compatible with the other) because I think
> this applies to :append and :prepend too.

The section 
https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html#variable-flag-syntax
 already contains this sentence:
   All the standard syntax operations previously mentioned work for variable
   flags except for override style syntax (i.e. “:prepend”, “:append”, and
   “:remove”).
but a explicit block
   .. note::
   Override style operators and variable flags are not compatible.
in all 3 sections
- 
https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html#appending-and-prepending-override-style-syntax
- 
https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html#removal-override-style-syntax
- 
https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html#variable-flag-syntax
would help preventing misconceptions.

Cheers
Daniel
Quentin Schulz Jan. 3, 2022, 10:54 a.m. UTC | #3
Hi Daniel,

On 12/20/21 09:06, Daniel Wagenknecht wrote:
> Hello Quentin,
> 
> On Thu, 2021-12-16 at 18:14 +0100, Quentin Schulz wrote:
>> I think we could make it even more explicit by adding a section in
>> https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html
>> to explicit incompatibility between any OVERRIDES and varflags (or add a note
>> in both sections that it's not compatible with the other) because I think
>> this applies to :append and :prepend too.
> 
> The section
> https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html#variable-flag-syntax
>   already contains this sentence:
>     All the standard syntax operations previously mentioned work for variable
>     flags except for override style syntax (i.e. “:prepend”, “:append”, and
>     “:remove”).
> but a explicit block
>     .. note::
>     Override style operators and variable flags are not compatible.
> in all 3 sections
> -
> https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html#appending-and-prepending-override-style-syntax
> -
> https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html#removal-override-style-syntax
> -
> https://docs.yoctoproject.org/bitbake/bitbake-user-manual/bitbake-user-manual-metadata.html#variable-flag-syntax
> would help preventing misconceptions.
> 

Agreed, you can send a new version of the patch with those changes 
whenever you have time :)

Cheers,
Quentin
Michael Opdenacker Jan. 3, 2022, 4:22 p.m. UTC | #4
Hi Daniel,

On 12/16/21 4:25 PM, Daniel Wagenknecht wrote:
> Override style operators do not work for specifying task dependencies.
> This is not obvious and should be highlighted in the documentation.
>
> Signed-off-by: Daniel Wagenknecht <dwagenknecht@emlix.com>
> ---
>
> I have experienced this problem with external layers "in the wild" leading to
> dependencies being undeclared and builds sometimes failing. Additional
> documentation will not necessarily fix the problem, but might make it easier to
> find the problem. I'm not sure if there's also some mechanism in bitbake that
> could detect such mistakes and provide a warning?
>
> CC: qschulz, we talked about this on IRC:
>   https://www.yoctoproject.org/irc/%23yocto.2021-11-30.log.html#t2021-11-30T14:18:08
>
> Sincerely
> Daniel Wagenknecht
>
>  .../bitbake-user-manual-metadata.rst          | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> index d802a8d3..181c0997 100644
> --- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> +++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
> @@ -1689,6 +1689,14 @@ This section describes several ways to declare dependencies. Remember,
>  even though dependencies are declared in different ways, they are all
>  simply dependencies between tasks.
>  
> +.. note::
> +
> +   Override style operators do not work for declaring task dependencies.
> +   See
> +   :ref:`bitbake-user-manual/bitbake-user-manual-metadata:Inter-Task Dependencies`
> +   for details.
> +
> +
>  .. _dependencies-internal-to-the-bb-file:
>  
>  Dependencies Internal to the ``.bb`` File
> @@ -1813,6 +1821,17 @@ must have completed before the ``do_patch`` task can execute.
>  The ``[rdepends]`` flag works in a similar way but takes targets in the
>  runtime namespace instead of the build-time dependency namespace.
>  
> +Note that dependencies are specified via
> +:ref:`bitbake-user-manual/bitbake-user-manual-metadata:Variable Flag Syntax`
> +and thus override style operators do not work for declaring task
> +dependencies. You can add a task dependency for a specific override
> +(e.g. a specific machine) by declaring an intermediary variable and using
> +overrides for setting that variable::
> +
> +   # Does not work: do_compile:machine[depends] += "another_target:do_task"
> +   EXTRA_DO_COMPILE_DEPENDS:machine = "another_target:do_task"
> +   do_compile[depends] += "${EXTRA_DO_COMPILE_DEPENDS}"
> +
>  Functions You Can Call From Within Python
>  =========================================


Thanks for the patch. I believe it could already be merged, and further
improvements remain possible.

Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Cheers
Michael.

Patch

diff --git a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
index d802a8d3..181c0997 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-metadata.rst
@@ -1689,6 +1689,14 @@  This section describes several ways to declare dependencies. Remember,
 even though dependencies are declared in different ways, they are all
 simply dependencies between tasks.
 
+.. note::
+
+   Override style operators do not work for declaring task dependencies.
+   See
+   :ref:`bitbake-user-manual/bitbake-user-manual-metadata:Inter-Task Dependencies`
+   for details.
+
+
 .. _dependencies-internal-to-the-bb-file:
 
 Dependencies Internal to the ``.bb`` File
@@ -1813,6 +1821,17 @@  must have completed before the ``do_patch`` task can execute.
 The ``[rdepends]`` flag works in a similar way but takes targets in the
 runtime namespace instead of the build-time dependency namespace.
 
+Note that dependencies are specified via
+:ref:`bitbake-user-manual/bitbake-user-manual-metadata:Variable Flag Syntax`
+and thus override style operators do not work for declaring task
+dependencies. You can add a task dependency for a specific override
+(e.g. a specific machine) by declaring an intermediary variable and using
+overrides for setting that variable::
+
+   # Does not work: do_compile:machine[depends] += "another_target:do_task"
+   EXTRA_DO_COMPILE_DEPENDS:machine = "another_target:do_task"
+   do_compile[depends] += "${EXTRA_DO_COMPILE_DEPENDS}"
+
 Functions You Can Call From Within Python
 =========================================