ref-manual: variables: provide no-match example for COMPATIBLE_MACHINE

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>
(From yocto-docs rev: 52196d39bc85de267daffb0074eb59786751f57d)

Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Quentin Schulz 2023-10-17 13:45:29 +02:00 committed by Richard Purdie
parent 7bd773fc00
commit efd54e4d1d

View File

@ -1358,13 +1358,32 @@ 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)$"
.. note::
When :term:`COMPATIBLE_MACHINE` is set in a recipe inherits from
native, the recipe is always skipped. All native recipes must be
entirely target independent and should not rely on :term:`MACHINE`.
:term:`COMPLEMENTARY_GLOB`
Defines wildcards to match when installing a list of complementary
packages for all the packages explicitly (or implicitly) installed in