]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: move extra cache collection out of cooker
authorAlexandru DAMIAN <alexandru.damian@intel.com>
Tue, 28 May 2013 12:49:55 +0000 (12:49 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 30 May 2013 09:19:13 +0000 (10:19 +0100)
The collection of the extra caching data should not
be performed by the cooker, but supplied to it.
This patch will also streamline the code for launching servers
without a UI attached.

Based on a patch by Bogdan Marinescu <bogdan.a.marinescu@intel.com>

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bin/bitbake
lib/bb/cooker.py
lib/bb/cookerdata.py

index 86cf3a8ae8a8caaf22300ac96954e220753fb7a6..f44543de2c00c5e95ae8c83e9481de5c2f5e413b 100755 (executable)
@@ -75,6 +75,18 @@ def get_ui(config):
         sys.exit("FATAL: Invalid user interface '%s' specified.\n"
                  "Valid interfaces: depexp, goggle, ncurses, hob, knotty [default]." % interface)
 
+def gather_extra_cache_data():
+    extra = []
+    interfaces = ['depexp', 'goggle', 'ncurses', 'hob', 'knotty']
+    for i in interfaces:
+        try:
+            ui = __import__("bb.ui." + i, fromlist = [i])
+            if hasattr(ui, "extraCaches"):
+                extra = extra + ui.extraCaches
+            del ui
+        except:
+            pass
+    return extra
 
 # Display bitbake/OE warnings via the BitBake.Warnings logger, ignoring others"""
 warnlog = logging.getLogger("BitBake.Warnings")
@@ -237,6 +249,12 @@ def main():
 
     try:
         configuration.setServerRegIdleCallback(server.getServerIdleCB())
+
+        if configParams.server_only:
+            configuration.extra_caches = gather_extra_cache_data()
+        else:
+            configuration.extra_caches = getattr(ui_module, "extraCaches", [])
+
         cooker = bb.cooker.BBCooker(configuration)
 
         server.addcooker(cooker)
index 2ae3e9d2395e6529308bef54aacec129a026d05b..2edfa9faebc9e3a0e142d1214609d39d025378b0 100644 (file)
@@ -94,28 +94,8 @@ class BBCooker:
         self.configuration = configuration
 
         self.caches_array = []
-        # Currently, only Image Creator hob ui needs extra cache.
-        # So, we save Extra Cache class name and container file
-        # information into a extraCaches field in hob UI.  
-        # TODO: In future, bin/bitbake should pass information into cooker,
-        # instead of getting information from configuration.ui. Also, some
-        # UI start up issues need to be addressed at the same time.
-        caches_name_array = ['bb.cache:CoreRecipeInfo']
-        if configuration.ui:
-            try:
-                module = __import__('bb.ui', fromlist=[configuration.ui])
-                name_array = (getattr(module, configuration.ui)).extraCaches
-                for recipeInfoName in name_array:
-                    caches_name_array.append(recipeInfoName)
-            except ImportError as exc:
-                # bb.ui.XXX is not defined and imported. It's an error!
-                logger.critical("Unable to import '%s' interface from bb.ui: %s" % (configuration.ui, exc))
-                sys.exit("FATAL: Failed to import '%s' interface." % configuration.ui)
-            except AttributeError:
-                # This is not an error. If the field is not defined in the ui,
-                # this interface might need no extra cache fields, so
-                # just skip this error!
-                logger.debug(2, "UI '%s' does not require extra cache!" % (configuration.ui))
+
+        caches_name_array = ['bb.cache:CoreRecipeInfo'] + configuration.extra_caches
 
         # At least CoreRecipeInfo will be loaded, so caches_array will never be empty!
         # This is the entry point, no further check needed!
index 11063b4af2302411723825687152f3afe27cfd45..cbaa0bed471f2d730f894fcd85ce14c2c5ae8019 100644 (file)
@@ -119,7 +119,6 @@ class CookerConfiguration(object):
         self.cmd = None
         self.abort = True
         self.force = False
-        self.ui = None
         self.profile = False
         self.nosetscene = False
         self.invalidate_stamp = False