mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
This sets the scene for removing the default False for expansion from getVarFlag. This would later allow True to become the default. On the most part this is an automatic translation with: sed -e 's:\(\.getVarFlag([^,()]*, [^,()]*\)):\1, True):g' -i `grep -ril getVar *` In this case, the default was False, but True was used since in most cases here expansion would be expected. (From OE-Core rev: 42a10788e89b07b14a150ced07113566cf99fcdd) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import itertools
|
|
|
|
def is_optional(feature, d):
|
|
packages = d.getVar("FEATURE_PACKAGES_%s" % feature, True)
|
|
if packages:
|
|
return bool(d.getVarFlag("FEATURE_PACKAGES_%s" % feature, "optional", True))
|
|
else:
|
|
return bool(d.getVarFlag("PACKAGE_GROUP_%s" % feature, "optional", True))
|
|
|
|
def packages(features, d):
|
|
for feature in features:
|
|
packages = d.getVar("FEATURE_PACKAGES_%s" % feature, True)
|
|
if not packages:
|
|
packages = d.getVar("PACKAGE_GROUP_%s" % feature, True)
|
|
for pkg in (packages or "").split():
|
|
yield pkg
|
|
|
|
def required_packages(features, d):
|
|
req = filter(lambda feature: not is_optional(feature, d), features)
|
|
return packages(req, d)
|
|
|
|
def optional_packages(features, d):
|
|
opt = filter(lambda feature: is_optional(feature, d), features)
|
|
return packages(opt, d)
|
|
|
|
def active_packages(features, d):
|
|
return itertools.chain(required_packages(features, d),
|
|
optional_packages(features, d))
|
|
|
|
def active_recipes(features, d):
|
|
import oe.packagedata
|
|
|
|
for pkg in active_packages(features, d):
|
|
recipe = oe.packagedata.recipename(pkg, d)
|
|
if recipe:
|
|
yield recipe
|