diff mbox series

[v2] ref-manual: variables: provide no-match example for COMPATIBLE_MACHINE

Message ID 20231017-dev-compatible_machine-v2-1-ea04bf0eff16@theobroma-systems.com
State New
Headers show
Series [v2] ref-manual: variables: provide no-match example for COMPATIBLE_MACHINE | expand

Commit Message

Quentin Schulz Oct. 17, 2023, 11:45 a.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

COMPATIBLE_MACHINE is used to forbid the use of a recipe or its packages
for a specific set of machines.

In some cases, it may make more sense to have the logic inverted and
have the recipe always forbidden except for hand-picked machines. Such
could be the case for pieces of software that only support some
architectures. In that scenario, it is sometimes a bit easier on the eye
and for maintenance to use the OVERRIDES mechanism but for that, a
default should be set.

COMPATIBLE_MACHINE:aarch64 = "$(aarch64)$"
COMPATIBLE_MACHINE:mips64 = "$(mips64)$"

wouldn't do much because if COMPATIBLE_MACHINE isn't set, the recipe is
assumed compatible and therefore, if no default is provided we enter
that case.

Hence, we need to add

COMPATIBLE_MACHINE = "^$"

as default so that it only matches the empty string, which isn't
possible for MACHINEOVERRIDES.

Cc: Quentin Schulz <foss+yocto@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
Changes in v2:
- use double backticks instead of backticks surrounding machine
  architecture to stay consistent with the rest of the file
- Link to v1: https://lore.kernel.org/r/20231016-dev-compatible_machine-v1-1-6528e1c98611@theobroma-systems.com
---
 documentation/ref-manual/variables.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)


---
base-commit: ceb1812e63b9fac062f886c2a1dde23137c0e1ed
change-id: 20231016-dev-compatible_machine-2b0d5c26e12a

Best regards,

Comments

Daniel Ammann Oct. 17, 2023, 12:23 p.m. UTC | #1
Hi Quentin

Comments inline.

Kind regards

Daniel


On 10/17/23 13:45, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> 
> COMPATIBLE_MACHINE is used to forbid the use of a recipe or its packages
> for a specific set of machines.
> 
> In some cases, it may make more sense to have the logic inverted and
> have the recipe always forbidden except for hand-picked machines. Such
> could be the case for pieces of software that only support some
> architectures. In that scenario, it is sometimes a bit easier on the eye
> and for maintenance to use the OVERRIDES mechanism but for that, a
> default should be set.
> 
> COMPATIBLE_MACHINE:aarch64 = "$(aarch64)$"
                                 ^ shouldn't this also be "^"?
> COMPATIBLE_MACHINE:mips64 = "$(mips64)$"
                                ^ shouldn't this also be "^"?
> 
> wouldn't do much because if COMPATIBLE_MACHINE isn't set, the recipe is
> assumed compatible and therefore, if no default is provided we enter
> that case.
> 
> Hence, we need to add
> 
> COMPATIBLE_MACHINE = "^$"
> 
> as default so that it only matches the empty string, which isn't
> possible for MACHINEOVERRIDES.
> 
> Cc: Quentin Schulz <foss+yocto@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> ---
> Changes in v2:
> - use double backticks instead of backticks surrounding machine
>    architecture to stay consistent with the rest of the file
> - Link to v1: https://lore.kernel.org/r/20231016-dev-compatible_machine-v1-1-6528e1c98611@theobroma-systems.com
> ---
>   documentation/ref-manual/variables.rst | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
> 
> diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
> index 11523bb9e..f7507038d 100644
> --- a/documentation/ref-manual/variables.rst
> +++ b/documentation/ref-manual/variables.rst
> @@ -1358,6 +1358,26 @@ system and gives an overview of their function and contents.
>         speed since the build system skips parsing recipes not compatible
>         with the current machine.
>   
> +      If one wants to have a recipe only available for some architectures
> +      (here ``aarch64`` and ``mips64``), the following can be used::
> +
> +         COMPATIBLE_MACHINE = "^$"
> +         COMPATIBLE_MACHINE:arch64 = "^(aarch64)$"
> +         COMPATIBLE_MACHINE:mips64 = "^(mips64)$"
> +
> +      The first line means "match all machines whose :term:`MACHINEOVERRIDES`
> +      contains the empty string", which will always be none.
> +
> +      The second is for matching all machines whose :term:`MACHINEOVERRIDES`
> +      contains one override which is exactly ``aarch64``.
> +
> +      The third is for matching all machines whose :term:`MACHINEOVERRIDES`
> +      contains one override which is exactly ``mips64``.
> +
> +      The same could be achieved with::
> +
> +         COMPATIBLE_MACHINE = "^(aarch64|mips64)$"
> +
>      :term:`COMPLEMENTARY_GLOB`
>         Defines wildcards to match when installing a list of complementary
>         packages for all the packages explicitly (or implicitly) installed in
> 
> ---
> base-commit: ceb1812e63b9fac062f886c2a1dde23137c0e1ed
> change-id: 20231016-dev-compatible_machine-2b0d5c26e12a
> 
> Best regards,
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#4394): https://lists.yoctoproject.org/g/docs/message/4394
> Mute This Topic: https://lists.yoctoproject.org/mt/102015677/3616718
> Group Owner: docs+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/docs/unsub [daniel.ammann@bytesatwork.ch]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Michael Opdenacker Oct. 17, 2023, 12:30 p.m. UTC | #2
Quentin, thanks for the update,
Daniel, thanks for the review!

On 17.10.23 at 14:23, Daniel Ammann wrote:
> Hi Quentin
>
> Comments inline.
>
> Kind regards
>
> Daniel
>
>
> On 10/17/23 13:45, Quentin Schulz wrote:
>> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
>>
>> COMPATIBLE_MACHINE is used to forbid the use of a recipe or its packages
>> for a specific set of machines.
>>
>> In some cases, it may make more sense to have the logic inverted and
>> have the recipe always forbidden except for hand-picked machines. Such
>> could be the case for pieces of software that only support some
>> architectures. In that scenario, it is sometimes a bit easier on the eye
>> and for maintenance to use the OVERRIDES mechanism but for that, a
>> default should be set.
>>
>> COMPATIBLE_MACHINE:aarch64 = "$(aarch64)$"
>                                 ^ shouldn't this also be "^"?
>> COMPATIBLE_MACHINE:mips64 = "$(mips64)$"
>                                ^ shouldn't this also be "^"?


Oops, just the commit message was wrong. Fixed.
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
... and merged into master-next.

Cheers
Michael.
diff mbox series

Patch

diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 11523bb9e..f7507038d 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -1358,6 +1358,26 @@  system and gives an overview of their function and contents.
       speed since the build system skips parsing recipes not compatible
       with the current machine.
 
+      If one wants to have a recipe only available for some architectures
+      (here ``aarch64`` and ``mips64``), the following can be used::
+
+         COMPATIBLE_MACHINE = "^$"
+         COMPATIBLE_MACHINE:arch64 = "^(aarch64)$"
+         COMPATIBLE_MACHINE:mips64 = "^(mips64)$"
+
+      The first line means "match all machines whose :term:`MACHINEOVERRIDES`
+      contains the empty string", which will always be none.
+
+      The second is for matching all machines whose :term:`MACHINEOVERRIDES`
+      contains one override which is exactly ``aarch64``.
+
+      The third is for matching all machines whose :term:`MACHINEOVERRIDES`
+      contains one override which is exactly ``mips64``.
+
+      The same could be achieved with::
+
+         COMPATIBLE_MACHINE = "^(aarch64|mips64)$"
+
    :term:`COMPLEMENTARY_GLOB`
       Defines wildcards to match when installing a list of complementary
       packages for all the packages explicitly (or implicitly) installed in