mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00

getVarFlag() now defaults to expanding by default, thus remove the True option from getVarFlag() calls with a regex search and replace. Search made with the following regex: getVarFlag ?\(( ?[^,()]*, ?[^,()]*), True\) (From OE-Core rev: 2dea9e490a98377010b3d4118d054814c317a735) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> 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)
|
|
if packages:
|
|
return bool(d.getVarFlag("FEATURE_PACKAGES_%s" % feature, "optional"))
|
|
else:
|
|
return bool(d.getVarFlag("PACKAGE_GROUP_%s" % feature, "optional"))
|
|
|
|
def packages(features, d):
|
|
for feature in features:
|
|
packages = d.getVar("FEATURE_PACKAGES_%s" % feature)
|
|
if not packages:
|
|
packages = d.getVar("PACKAGE_GROUP_%s" % feature)
|
|
for pkg in (packages or "").split():
|
|
yield pkg
|
|
|
|
def required_packages(features, d):
|
|
req = [feature for feature in features if not is_optional(feature, d)]
|
|
return packages(req, d)
|
|
|
|
def optional_packages(features, d):
|
|
opt = [feature for feature in features if is_optional(feature, d)]
|
|
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
|