summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/distro_features_check.bbclass28
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
10python () {
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}