[oe-commits] Chris Larson : oe.packagegroup: add code for package groups
git version control
git at git.openembedded.org
Sun Oct 10 04:17:12 UTC 2010
Module: openembedded.git
Branch: master
Commit: b0edd6725d289730c5fca49ea28a644b9186493c
URL: http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=b0edd6725d289730c5fca49ea28a644b9186493c
Author: Chris Larson <chris_larson at mentor.com>
Date: Fri Oct 8 20:05:06 2010 -0700
oe.packagegroup: add code for package groups
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 at mentor.com>
---
classes/base.bbclass | 2 +-
lib/oe/packagegroup.py | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 964fe1c..c5148d7 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -10,7 +10,7 @@ inherit utils
inherit utility-tasks
inherit metadata_scm
-OE_IMPORTS += "oe.path oe.utils sys os time"
+OE_IMPORTS += "oe.path oe.utils oe.packagegroup sys os time"
python oe_import () {
if isinstance(e, bb.event.ConfigParsed):
diff --git a/lib/oe/packagegroup.py b/lib/oe/packagegroup.py
new file mode 100644
index 0000000..6dc9cd7
--- /dev/null
+++ b/lib/oe/packagegroup.py
@@ -0,0 +1,15 @@
+def is_optional(group, d):
+ return bool(d.getVarFlag("PACKAGE_GROUP_%s" % group, "optional"))
+
+def packages(groups, d):
+ from itertools import chain
+ return chain.from_iterable(d.getVar("PACKAGE_GROUP_%s" % group, True).split()
+ for group in groups)
+
+def required_packages(groups, d):
+ req = filter(lambda group: not is_optional(group, d), groups)
+ return " ".join(packages(req, d))
+
+def optional_packages(groups, d):
+ opt = filter(lambda group: is_optional(group, d), groups)
+ return " ".join(packages(opt, d))
More information about the Openembedded-commits
mailing list