Patchwork [bitbake-devel] cooker/command: Add setFeatures command

login
register
mail settings
Submitter Richard Purdie
Date March 9, 2014, 5:02 p.m.
Message ID <1394384528.7883.9.camel@ted>
Download mbox | patch
Permalink /patch/68333/
State New
Headers show

Comments

Richard Purdie - March 9, 2014, 5:02 p.m.
Add a command to allow backends to set particular 'features' on the
cooker (server).

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---

Patch

diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index e30d21d..3788207 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -257,6 +257,13 @@  class CommandsSync:
         mask = params[3]
         return bb.event.set_UIHmask(handlerNum, llevel, debug_domains, mask)
 
+    def setFeatures(self, command, params):
+        """
+        Set the cooker features to include the passed list of features
+        """
+        features = params[0]
+        command.cooker.setFeatures(features)
+
 class CommandsAsync:
     """
     A class of asynchronous commands
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 96f05b5..8d63195 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -149,6 +149,14 @@  class BBCooker:
 
         self.parser = None
 
+    def setFeatures(self, features):
+        original_featureset = list(self.featureset)
+        for feature in features:
+            self.featureset.setFeature(feature)
+        bb.debug(1, "Features set %s (was %s)" % (original_featureset, list(self.featureset)))
+        if (original_featureset != list(self.featureset)):
+            self.reset()
+
     def initConfigurationData(self):
 
         self.state = state.initial