summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorJoe Slater <jslater@windriver.com>2015-05-07 12:55:26 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-09 22:26:45 +0100
commit7405f473aad561655e680aee2bf563c315e1263a (patch)
tree1ff65957b413cf522a13608a344cb11100521e2f /meta/classes
parentdcb8f89723f809ceee9dbb0941a2cc5a43400e99 (diff)
downloadpoky-7405f473aad561655e680aee2bf563c315e1263a.tar.gz
distro_features_check: add any of test
Add a test for distro features including one or more items in a list. This is useful when, for example, we need either x11 or directfb as a feature. (From OE-Core rev: 60157da8a6df0c7ec5bb572bea5124af273bab08) Signed-off-by: Joe Slater <jslater@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/distro_features_check.bbclass13
1 files changed, 11 insertions, 2 deletions
diff --git a/meta/classes/distro_features_check.bbclass b/meta/classes/distro_features_check.bbclass
index 1f1d6fba37..7e91dbcf4a 100644
--- a/meta/classes/distro_features_check.bbclass
+++ b/meta/classes/distro_features_check.bbclass
@@ -1,5 +1,7 @@
1# Allow checking of required and conflicting DISTRO_FEATURES 1# Allow checking of required and conflicting DISTRO_FEATURES
2# 2#
3# ANY_OF_DISTRO_FEATURES: ensure at least one item on this list is included
4# in DISTRO_FEATURES.
3# REQUIRED_DISTRO_FEATURES: ensure every item on this list is included 5# REQUIRED_DISTRO_FEATURES: ensure every item on this list is included
4# in DISTRO_FEATURES. 6# in DISTRO_FEATURES.
5# CONFLICT_DISTRO_FEATURES: ensure no item in this list is included in 7# CONFLICT_DISTRO_FEATURES: ensure no item in this list is included in
@@ -8,10 +10,18 @@
8# Copyright 2013 (C) O.S. Systems Software LTDA. 10# Copyright 2013 (C) O.S. Systems Software LTDA.
9 11
10python () { 12python () {
13 # Assume at least one var is set.
14 distro_features = (d.getVar('DISTRO_FEATURES', True) or "").split()
15
16 any_of_distro_features = d.getVar('ANY_OF_DISTRO_FEATURES', True)
17 if any_of_distro_features:
18 any_of_distro_features = any_of_distro_features.split()
19 if set.isdisjoint(set(any_of_distro_features),set(distro_features)):
20 raise bb.parse.SkipPackage("one of '%s' needs to be in DISTRO_FEATURES" % any_of_distro_features)
21
11 required_distro_features = d.getVar('REQUIRED_DISTRO_FEATURES', True) 22 required_distro_features = d.getVar('REQUIRED_DISTRO_FEATURES', True)
12 if required_distro_features: 23 if required_distro_features:
13 required_distro_features = required_distro_features.split() 24 required_distro_features = required_distro_features.split()
14 distro_features = (d.getVar('DISTRO_FEATURES', True) or "").split()
15 for f in required_distro_features: 25 for f in required_distro_features:
16 if f in distro_features: 26 if f in distro_features:
17 continue 27 continue
@@ -21,7 +31,6 @@ python () {
21 conflict_distro_features = d.getVar('CONFLICT_DISTRO_FEATURES', True) 31 conflict_distro_features = d.getVar('CONFLICT_DISTRO_FEATURES', True)
22 if conflict_distro_features: 32 if conflict_distro_features:
23 conflict_distro_features = conflict_distro_features.split() 33 conflict_distro_features = conflict_distro_features.split()
24 distro_features = (d.getVar('DISTRO_FEATURES', True) or "").split()
25 for f in conflict_distro_features: 34 for f in conflict_distro_features:
26 if f in distro_features: 35 if f in distro_features:
27 raise bb.parse.SkipPackage("conflicting distro feature '%s' (in DISTRO_FEATURES)" % f) 36 raise bb.parse.SkipPackage("conflicting distro feature '%s' (in DISTRO_FEATURES)" % f)