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>
This commit is contained in:
parent
dcb8f89723
commit
7405f473aa
|
@ -1,5 +1,7 @@
|
|||
# Allow checking of required and conflicting DISTRO_FEATURES
|
||||
#
|
||||
# ANY_OF_DISTRO_FEATURES: ensure at least one item on this list is included
|
||||
# in 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
|
||||
|
@ -8,10 +10,18 @@
|
|||
# Copyright 2013 (C) O.S. Systems Software LTDA.
|
||||
|
||||
python () {
|
||||
# Assume at least one var is set.
|
||||
distro_features = (d.getVar('DISTRO_FEATURES', True) or "").split()
|
||||
|
||||
any_of_distro_features = d.getVar('ANY_OF_DISTRO_FEATURES', True)
|
||||
if any_of_distro_features:
|
||||
any_of_distro_features = any_of_distro_features.split()
|
||||
if set.isdisjoint(set(any_of_distro_features),set(distro_features)):
|
||||
raise bb.parse.SkipPackage("one of '%s' needs to be in DISTRO_FEATURES" % any_of_distro_features)
|
||||
|
||||
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:
|
||||
continue
|
||||
|
@ -21,7 +31,6 @@ python () {
|
|||
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)" % f)
|
||||
|
|
Loading…
Reference in New Issue