summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-10-08 20:05:06 -0700
committerChris Larson <chris_larson@mentor.com>2011-05-18 13:59:29 -0700
commit9b85119b8ec8ca42acd9385c0b350f8487701fff (patch)
treeece924d4b0e6997c56cd4cc8e1ca63b1f8cdd211
parent2370078806c22a1aa1e23a0e20e9fb5b17149deb (diff)
downloadopenembedded-core-contrib-9b85119b8ec8ca42acd9385c0b350f8487701fff.tar.gz
openembedded-core-contrib-9b85119b8ec8ca42acd9385c0b350f8487701fff.tar.bz2
openembedded-core-contrib-9b85119b8ec8ca42acd9385c0b350f8487701fff.zip
oe.packagegroup: add code for package groups (sync from OE)
This includes some utility functions for dealing with groups of packages defined in the metadata. Metadata syntax: PACKAGE_GROUP_<group> = "<list of packages>" If the packages in the group are optional: PACKAGE_GROUP_<group>[optional] = "1" Signed-off-by: Chris Larson <chris_larson@mentor.com>
-rw-r--r--meta/classes/base.bbclass2
-rw-r--r--meta/lib/oe/packagegroup.py29
2 files changed, 30 insertions, 1 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 7950bc3975..8f4ef1e64e 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -10,7 +10,7 @@ inherit metadata_scm
inherit buildstats
inherit logging
-OE_IMPORTS += "os sys time oe.path oe.utils oe.data"
+OE_IMPORTS += "os sys time oe.path oe.utils oe.data oe.packagegroup"
OE_IMPORTS[type] = "list"
def oe_import(d):
diff --git a/meta/lib/oe/packagegroup.py b/meta/lib/oe/packagegroup.py
new file mode 100644
index 0000000000..b04c45a1af
--- /dev/null
+++ b/meta/lib/oe/packagegroup.py
@@ -0,0 +1,29 @@
+import itertools
+
+def is_optional(group, d):
+ return bool(d.getVarFlag("PACKAGE_GROUP_%s" % group, "optional"))
+
+def packages(groups, d):
+ for group in groups:
+ for pkg in (d.getVar("PACKAGE_GROUP_%s" % group, True) or "").split():
+ yield pkg
+
+def required_packages(groups, d):
+ req = filter(lambda group: not is_optional(group, d), groups)
+ return packages(req, d)
+
+def optional_packages(groups, d):
+ opt = filter(lambda group: is_optional(group, d), groups)
+ 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