Patchwork [1/3] image: implement IMAGE_FEATURES

login
register
mail settings
Submitter Christopher Larson
Date Aug. 9, 2011, 2:40 p.m.
Message ID <9f512860d6f129f01eb815be5594ef10e9bcce57.1312900463.git.chris_larson@mentor.com>
Download mbox | patch
Permalink /patch/9549/
State New, archived
Headers show

Comments

Christopher Larson - Aug. 9, 2011, 2:40 p.m.
From: Chris Larson <chris_larson@mentor.com>

IMAGE_FEATURES is analagous to DISTRO_FEATURES and MACHINE_FEATURES, for
root filesystem construction. Currently, the only supported features are
any defined package groups, as used by the oe.packagegroup python
module.

Example usage:

    PACKAGE_GROUP_myfeature = "vim iptables"
    IMAGE_FEATURES += "myfeature"

Signed-off-by: Chris Larson <chris_larson@mentor.com>
---
 meta/classes/image.bbclass |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)

Patch

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 243baa9..e057329 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -6,15 +6,26 @@  inherit imagetest-${IMAGETEST}
 LICENSE = "MIT"
 PACKAGES = ""
 MULTILIB_IMAGE_INSTALL ?= ""
-RDEPENDS += "${IMAGE_INSTALL} ${LINGUAS_INSTALL} ${MULTILIB_IMAGE_INSTALL}"
+RDEPENDS += "${IMAGE_INSTALL} ${LINGUAS_INSTALL} ${MULTILIB_IMAGE_INSTALL} ${FEATURE_INSTALL}"
+RRECOMMENDS += "${FEATURE_INSTALL_OPTIONAL}"
 
 INHIBIT_DEFAULT_DEPS = "1"
 
+# IMAGE_FEATURES may contain any available package group
+IMAGE_FEATURES ?= ""
+IMAGE_FEATURES[type] = "list"
+
+# packages to install from features
+FEATURE_INSTALL = "${@' '.join(oe.packagegroup.required_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
+FEATURE_INSTALL_OPTIONAL = "${@' '.join(oe.packagegroup.optional_packages(oe.data.typed_value('IMAGE_FEATURES', d), d))}"
+
 # "export IMAGE_BASENAME" not supported at this time
+IMAGE_INSTALL ?= ""
+IMAGE_INSTALL[type] = "list"
 IMAGE_BASENAME[export] = "1"
-export PACKAGE_INSTALL ?= "${IMAGE_INSTALL}"
+export PACKAGE_INSTALL ?= "${IMAGE_INSTALL} ${FEATURE_INSTALL}"
 export MULTILIB_PACKAGE_INSTALL ?= "${MULTILIB_IMAGE_INSTALL}"
-PACKAGE_INSTALL_ATTEMPTONLY ?= ""
+PACKAGE_INSTALL_ATTEMPTONLY ?= "${FEATURE_INSTALL_OPTIONAL}"
 
 # Images are generally built explicitly, do not need to be part of world.
 EXCLUDE_FROM_WORLD = "1"