blob: 7e91dbcf4a4c204d02b8bbc501bb9f402330d1ad [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001# Allow checking of required and conflicting DISTRO_FEATURES
2#
3# ANY_OF_DISTRO_FEATURES: ensure at least one item on this list is included
4# in DISTRO_FEATURES.
5# REQUIRED_DISTRO_FEATURES: ensure every item on this list is included
6# in DISTRO_FEATURES.
7# CONFLICT_DISTRO_FEATURES: ensure no item in this list is included in
8# DISTRO_FEATURES.
9#
10# Copyright 2013 (C) O.S. Systems Software LTDA.
11
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
22 required_distro_features = d.getVar('REQUIRED_DISTRO_FEATURES', True)
23 if required_distro_features:
24 required_distro_features = required_distro_features.split()
25 for f in required_distro_features:
26 if f in distro_features:
27 continue
28 else:
29 raise bb.parse.SkipPackage("missing required distro feature '%s' (not in DISTRO_FEATURES)" % f)
30
31 conflict_distro_features = d.getVar('CONFLICT_DISTRO_FEATURES', True)
32 if conflict_distro_features:
33 conflict_distro_features = conflict_distro_features.split()
34 for f in conflict_distro_features:
35 if f in distro_features:
36 raise bb.parse.SkipPackage("conflicting distro feature '%s' (in DISTRO_FEATURES)" % f)
37}