blob: a6fee5f95079e3b9ecc10df56e3ff3353428e227 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001import itertools
2
3def is_optional(feature, d):
4 packages = d.getVar("FEATURE_PACKAGES_%s" % feature, True)
5 if packages:
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05006 return bool(d.getVarFlag("FEATURE_PACKAGES_%s" % feature, "optional", True))
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007 else:
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05008 return bool(d.getVarFlag("PACKAGE_GROUP_%s" % feature, "optional", True))
Patrick Williamsc124f4f2015-09-15 14:41:29 -05009
10def packages(features, d):
11 for feature in features:
12 packages = d.getVar("FEATURE_PACKAGES_%s" % feature, True)
13 if not packages:
14 packages = d.getVar("PACKAGE_GROUP_%s" % feature, True)
15 for pkg in (packages or "").split():
16 yield pkg
17
18def required_packages(features, d):
19 req = filter(lambda feature: not is_optional(feature, d), features)
20 return packages(req, d)
21
22def optional_packages(features, d):
23 opt = filter(lambda feature: is_optional(feature, d), features)
24 return packages(opt, d)
25
26def active_packages(features, d):
27 return itertools.chain(required_packages(features, d),
28 optional_packages(features, d))
29
30def active_recipes(features, d):
31 import oe.packagedata
32
33 for pkg in active_packages(features, d):
34 recipe = oe.packagedata.recipename(pkg, d)
35 if recipe:
36 yield recipe