From 1680e558e15755a8ef03207f8fd1096336009872 Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Tue, 17 Oct 2023 13:45:29 +0200 Subject: 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 (From yocto-docs rev: 051f868d1da1cbcd5726eb4c1e3f25946ce690e3) Signed-off-by: Quentin Schulz Reviewed-by: Michael Opdenacker Signed-off-by: Steve Sakoman --- documentation/ref-manual/variables.rst | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst index 0e11ab2f68..abd361bf63 100644 --- a/documentation/ref-manual/variables.rst +++ b/documentation/ref-manual/variables.rst @@ -1362,13 +1362,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 -- cgit v1.2.3-54-g00ecf