From e36d12a9c1cf69540079e48a1dfadbc343758e48 Mon Sep 17 00:00:00 2001 From: Lianhao Lu Date: Tue, 3 Jul 2012 12:43:32 +0800 Subject: image/core-image: Handle conflicting IMAGE_FEATURES. IMAGE_FEATURES such as 'ssh-server-dropbear' and 'ssh-server-openssh' can't be both enabled. User can use the following variables to define the relationship of image features: IMAGE_FEATURES_REPLACES_foo = "bar" means including image feature "foo" would replace the image feature "bar". IMAGE_FEATURES_CONFLICTS_foo = "bar" means including both image features "foo" and "bar" would cause an parsing error. Signed-off-by: Lianhao Lu Signed-off-by: Richard Purdie --- meta/classes/image.bbclass | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'meta/classes/image.bbclass') diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 24fd868087..f1b829fe18 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -94,6 +94,23 @@ python () { deps += " %s:do_populate_sysroot" % dep d.appendVarFlag('do_build', 'depends', deps) + #process IMAGE_FEATURES, we must do this before runtime_mapping_rename + #Check for replaces image features + features = set(oe.data.typed_value('IMAGE_FEATURES', d)) + remain_features = features.copy() + for feature in features: + replaces = set((d.getVar("IMAGE_FEATURES_REPLACES_%s" % feature, True) or "").split()) + remain_features -= replaces + + #Check for conflict image features + for feature in remain_features: + conflicts = set((d.getVar("IMAGE_FEATURES_CONFLICTS_%s" % feature, True) or "").split()) + temp = conflicts & remain_features + if temp: + bb.fatal("%s contains conflicting IMAGE_FEATURES %s %s" % (d.getVar('PN', True), feature, ' '.join(list(temp)))) + + d.setVar('IMAGE_FEATURES', ' '.join(list(remain_features))) + # If we don't do this we try and run the mapping hooks while parsing which is slow # bitbake should really provide something to let us know this... if d.getVar('BB_WORKERCONTEXT', True) is not None: -- cgit v1.2.3