Message ID | 20231016-dev-compatible_machine-v1-1-6528e1c98611@theobroma-systems.com |
---|---|
State | New |
Headers | show |
Series | ref-manual: variables: provide no-match example for COMPATIBLE_MACHINE | expand |
Hi Quentin Many thanks for the patch! On 16.10.23 at 14:16, 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)$" > 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> > --- > 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..370b5bfbf 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 text looks good to me, but I see your use of single back-quotes such as in `mips64`. Was that a special choice? In most of the documentation, we use double back-quotes. You can check the variables.rst file. Would you see a case for using single back-quotes? At least on my machine, `word` produces italic text, while *word* produces boldface italic. Cheers Michael.
Hi Michael, On 10/17/23 10:43, Michael Opdenacker wrote: > Hi Quentin > > Many thanks for the patch! > > On 16.10.23 at 14:16, 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)$" >> 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> >> --- >> 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..370b5bfbf 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 text looks good to me, but I see your use of single back-quotes such > as in `mips64`. > > Was that a special choice? In most of the documentation, we use double > back-quotes. You can check the variables.rst file. > Ah well... that's what muscular memory does to you. Inline code "highlighting" in Markdown is done with backticks. GitLab uses it, Teams somehow works with it, Atlassian tools as well... and I forgot rST works differently and didn't check the output of my patch..... So no, that was not desired, rather the outcome of the lack of check that shouldn't have happened in the first place, sorry :) > Would you see a case for using single back-quotes? At least on my > machine, `word` produces italic text, while *word* produces boldface > italic. > Nope, consistency should be our main goal, so double backtick it is :) v2 on the way, thanks for the feedback. Cheers, Quentin > Cheers > Michael. >
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst index 11523bb9e..370b5bfbf 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