From b0edd6725d289730c5fca49ea28a644b9186493c Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Fri, 8 Oct 2010 20:05:06 -0700 Subject: 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_ = "" If the packages in the group are optional: PACKAGE_GROUP_[optional] = "1" Signed-off-by: Chris Larson --- lib/oe/packagegroup.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 lib/oe/packagegroup.py (limited to 'lib') diff --git a/lib/oe/packagegroup.py b/lib/oe/packagegroup.py new file mode 100644 index 0000000000..6dc9cd7e28 --- /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)) -- cgit 1.2.3-korg