diff options
author | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
---|---|---|
committer | Tudor Florea <tudor.florea@enea.com> | 2014-10-16 03:05:19 +0200 |
commit | c527fd1f14c27855a37f2e8ac5346ce8d940ced2 (patch) | |
tree | bb002c1fdf011c41dbd2f0927bed23ecb5f83c97 /meta/lib/oe/packagegroup.py | |
download | poky-c527fd1f14c27855a37f2e8ac5346ce8d940ced2.tar.gz |
initial commit for Enea Linux 4.0-140929daisy-140929
Migrated from the internal git server on the daisy-enea-point-release branch
Signed-off-by: Tudor Florea <tudor.florea@enea.com>
Diffstat (limited to 'meta/lib/oe/packagegroup.py')
-rw-r--r-- | meta/lib/oe/packagegroup.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/meta/lib/oe/packagegroup.py b/meta/lib/oe/packagegroup.py new file mode 100644 index 0000000000..12eb4212ff --- /dev/null +++ b/meta/lib/oe/packagegroup.py | |||
@@ -0,0 +1,36 @@ | |||
1 | import itertools | ||
2 | |||
3 | def is_optional(feature, d): | ||
4 | packages = d.getVar("FEATURE_PACKAGES_%s" % feature, True) | ||
5 | if packages: | ||
6 | return bool(d.getVarFlag("FEATURE_PACKAGES_%s" % feature, "optional")) | ||
7 | else: | ||
8 | return bool(d.getVarFlag("PACKAGE_GROUP_%s" % feature, "optional")) | ||
9 | |||
10 | def 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 | |||
18 | def required_packages(features, d): | ||
19 | req = filter(lambda feature: not is_optional(feature, d), features) | ||
20 | return packages(req, d) | ||
21 | |||
22 | def optional_packages(features, d): | ||
23 | opt = filter(lambda feature: is_optional(feature, d), features) | ||
24 | return packages(opt, d) | ||
25 | |||
26 | def active_packages(features, d): | ||
27 | return itertools.chain(required_packages(features, d), | ||
28 | optional_packages(features, d)) | ||
29 | |||
30 | def 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 | ||