[OE-core] [PATCH v3] distro_features_check.bbclass: Allow checking of required/conflicting features
Kamble, Nitin A
nitin.a.kamble at intel.com
Wed Aug 21 17:14:27 UTC 2013
> -----Original Message-----
> From: openembedded-core-bounces at lists.openembedded.org
> [mailto:openembedded-core-bounces at lists.openembedded.org] On Behalf
> Of Otavio Salvador
> Sent: Thursday, August 01, 2013 3:14 PM
> To: OpenEmbedded Core Mailing List
> Cc: Evan Kotara; Lauren Post; Otavio Salvador; Daiane Angolini
> Subject: [OE-core] [PATCH v3] distro_features_check.bbclass: Allow checking
> of required/conflicting features
>
> This add support to list required/confliting distro features for a recipe; this
> avoids user mistake when building recipes/images which would not work
> depending on DISTRO_FEATURES option set.
>
> Adding:
>
> ,----[ Use example ]
> | inherit distro_features_check
> |
> | REQUIRED_DISTRO_FEATURES = "x11"
> | CONFLICT_DISTRO_FEATURES_mx6 = "wayland"
> `----
>
> In the image recipe allow us to make clear to user that this image needs X11
> and /cannot/ be build with Wayland support in i.MX6 platforms, for example.
>
> Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
> ---
> Changes in v3:
> - Move code from base.bbclass to distro_features_check.bbclass
> - Rework code
> - Rework commit log
>
> Changes in v2:
> - Rename to REQUIRED_DISTRO_FEATURES;
> - Remove spurious bb.note;
> - Rewrote error message;
>
> meta/classes/distro_features_check.bbclass | 28
> ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
> create mode 100644 meta/classes/distro_features_check.bbclass
>
> diff --git a/meta/classes/distro_features_check.bbclass
> b/meta/classes/distro_features_check.bbclass
> new file mode 100644
> index 0000000..61b11b7
> --- /dev/null
> +++ b/meta/classes/distro_features_check.bbclass
> @@ -0,0 +1,28 @@
> +# Allow checking of required and conflicting DISTRO_FEATURES # #
> +REQUIRED_DISTRO_FEATURES: ensure every item on this list is included
> +# in DISTRO_FEATURES.
> +# CONFLICT_DISTRO_FEATURES: ensure no item in this list is included in
> +# DISTRO_FEATURES.
> +#
> +# Copyright 2013 (C) O.S. Systems Software LTDA.
> +
> +python () {
> + required_distro_features = d.getVar('REQUIRED_DISTRO_FEATURES',
> True)
> + if required_distro_features:
> + required_distro_features = required_distro_features.split()
> + distro_features = (d.getVar('DISTRO_FEATURES', True) or "").split()
> + for f in required_distro_features:
> + if f in distro_features:
> + break
> + else:
> + raise bb.parse.SkipPackage("missing required distro feature
> +%s (not in DISTRO_FEATURES)" % required_distro_features)
Hi Otavio,
In my observations, these SkipPackage exceptions do not show up on the screen, leaving the user wondering what happened.
Also the above logic can be simplified as
# check all the required DISTRO_FEATURES are enabled
distro_features_split = (d.getVar('DISTRO_FEATURES', True) or "").split()
required_distro_features_split = (d.getVar('REQUIRED_DISTRO_FEATURES', True) or "").split()
for rdf in required_distro_features_split:
if rdf not in distro_features_split:
bb.error / raise exception...
Thanks,
Nitin
> +
> + conflict_distro_features = d.getVar('CONFLICT_DISTRO_FEATURES', True)
> + if conflict_distro_features:
> + conflict_distro_features = conflict_distro_features.split()
> + distro_features = (d.getVar('DISTRO_FEATURES', True) or "").split()
> + for f in conflict_distro_features:
> + if f in distro_features:
> + raise bb.parse.SkipPackage("conflicting distro feature
> +%s (in DISTRO_FEATURES)" % conflict_distro_features) }
> --
> 1.8.3.2
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
More information about the Openembedded-core
mailing list