diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2013-08-01 19:13:57 -0300 |
---|---|---|
committer | Saul Wold <sgw@linux.intel.com> | 2013-08-22 09:15:34 -0700 |
commit | a7519be6a23869ebafbf712370dab86ab92f68a5 (patch) | |
tree | 007fbab635672e6701385cf59114e9534c87e442 /meta/classes | |
parent | 6d7f5581bbfaf174edb77d92846e720e8057481c (diff) | |
download | openembedded-core-a7519be6a23869ebafbf712370dab86ab92f68a5.tar.gz openembedded-core-a7519be6a23869ebafbf712370dab86ab92f68a5.tar.bz2 openembedded-core-a7519be6a23869ebafbf712370dab86ab92f68a5.zip |
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@ossystems.com.br>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/distro_features_check.bbclass | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/meta/classes/distro_features_check.bbclass b/meta/classes/distro_features_check.bbclass new file mode 100644 index 0000000000..61b11b7d53 --- /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) + + 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) +} |