diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2013-08-01 19:13:57 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-08-22 18:30:02 +0100 |
commit | 26e543cb2118ed6a668ad37e1fac149fa6db672e (patch) | |
tree | b7aa1e8791abc808a1559d38793efde0d206ae81 | |
parent | db60ee702f5ad7cfbd5338f7199ccd05d0576a61 (diff) | |
download | poky-26e543cb2118ed6a668ad37e1fac149fa6db672e.tar.gz |
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.
(From OE-Core rev: a7519be6a23869ebafbf712370dab86ab92f68a5)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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 @@ | |||
1 | # Allow checking of required and conflicting DISTRO_FEATURES | ||
2 | # | ||
3 | # REQUIRED_DISTRO_FEATURES: ensure every item on this list is included | ||
4 | # in DISTRO_FEATURES. | ||
5 | # CONFLICT_DISTRO_FEATURES: ensure no item in this list is included in | ||
6 | # DISTRO_FEATURES. | ||
7 | # | ||
8 | # Copyright 2013 (C) O.S. Systems Software LTDA. | ||
9 | |||
10 | python () { | ||
11 | required_distro_features = d.getVar('REQUIRED_DISTRO_FEATURES', True) | ||
12 | if required_distro_features: | ||
13 | required_distro_features = required_distro_features.split() | ||
14 | distro_features = (d.getVar('DISTRO_FEATURES', True) or "").split() | ||
15 | for f in required_distro_features: | ||
16 | if f in distro_features: | ||
17 | break | ||
18 | else: | ||
19 | raise bb.parse.SkipPackage("missing required distro feature %s (not in DISTRO_FEATURES)" % required_distro_features) | ||
20 | |||
21 | conflict_distro_features = d.getVar('CONFLICT_DISTRO_FEATURES', True) | ||
22 | if conflict_distro_features: | ||
23 | conflict_distro_features = conflict_distro_features.split() | ||
24 | distro_features = (d.getVar('DISTRO_FEATURES', True) or "").split() | ||
25 | for f in conflict_distro_features: | ||
26 | if f in distro_features: | ||
27 | raise bb.parse.SkipPackage("conflicting distro feature %s (in DISTRO_FEATURES)" % conflict_distro_features) | ||
28 | } | ||