Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 1/2] classes/image: show an error on invalid IMAGE_FEATURES
Date: Thu,  9 May 2013 17:24:25 +0100	[thread overview]
Message-ID: <edbe33f45ad5f07beb7ffdc38bb95f424bb2ab3a.1368116511.git.paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <cover.1368116511.git.paul.eggleton@linux.intel.com>
In-Reply-To: <cover.1368116511.git.paul.eggleton@linux.intel.com>

If the user specifies an invalid feature in IMAGE_FEATURES, show an
error during parsing. Valid IMAGE_FEATURES are drawn from
PACKAGE_GROUP_ definitions, COMPLEMENTARY_GLOBS and a new 'validitems'
varflag on IMAGE_FEATURES (so that additional non-package group features
can be added elsewhere.)

Implements [YOCTO #3308].

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/classes/image.bbclass | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 251bc9a..2b42e12 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -19,6 +19,7 @@ INHIBIT_DEFAULT_DEPS = "1"
 # IMAGE_FEATURES may contain any available package group
 IMAGE_FEATURES ?= ""
 IMAGE_FEATURES[type] = "list"
+IMAGE_FEATURES[validitems] += "debug-tweaks read-only-rootfs"
 
 # rootfs bootstrap install
 ROOTFS_BOOTSTRAP_INSTALL = "${@base_contains("IMAGE_FEATURES", "package-management", "", "${ROOTFS_PKGMANAGE_BOOTSTRAP}",d)}"
@@ -62,6 +63,19 @@ IMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("IMAGE_FEATURES", d)}'
 SDKIMAGE_FEATURES ??= "dev-pkgs dbg-pkgs"
 SDKIMAGE_INSTALL_COMPLEMENTARY = '${@complementary_globs("SDKIMAGE_FEATURES", d)}'
 
+def check_image_features(d):
+    valid_features = (d.getVarFlag('IMAGE_FEATURES', 'validitems', True) or "").split()
+    valid_features += d.getVarFlags('COMPLEMENTARY_GLOB').keys()
+    for var in d:
+       if var.startswith("PACKAGE_GROUP_"):
+           valid_features.append(var[14:])
+    valid_features.sort()
+
+    features = set(oe.data.typed_value('IMAGE_FEATURES', d))
+    for feature in features:
+        if feature not in valid_features:
+            bb.fatal("'%s' in IMAGE_FEATURES is not a valid image feature. Valid features: %s" % (feature, ' '.join(valid_features)))
+
 IMAGE_INSTALL ?= ""
 IMAGE_INSTALL[type] = "list"
 export PACKAGE_INSTALL ?= "${IMAGE_INSTALL} ${ROOTFS_BOOTSTRAP_INSTALL} ${FEATURE_INSTALL}"
@@ -129,6 +143,8 @@ python () {
             vendor = localdata.getVar("TARGET_VENDOR_virtclass-multilib-" + eext[1], False)
             ml_vendor_list += " " + vendor
     d.setVar('MULTILIB_VENDORS', ml_vendor_list)
+
+    check_image_features(d)
 }
 
 #
-- 
1.8.1.2




  reply	other threads:[~2013-05-09 16:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-09 16:24 [PATCH 0/2] Validate IMAGE_FEATURES Paul Eggleton
2013-05-09 16:24 ` Paul Eggleton [this message]
2013-05-09 22:49   ` [PATCH 1/2] classes/image: show an error on invalid IMAGE_FEATURES Chris Larson
2013-05-10 14:19     ` Paul Eggleton
2013-05-09 16:24 ` [PATCH 2/2] classes/core-image: drop apps-console-core IMAGE_FEATURES support Paul Eggleton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=edbe33f45ad5f07beb7ffdc38bb95f424bb2ab3a.1368116511.git.paul.eggleton@linux.intel.com \
    --to=paul.eggleton@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox