Patchwork [bitbake-devel,4/8] Hob: Change the Hob initialization process

login
register
mail settings
Submitter Dongxiao Xu
Date March 24, 2012, 5:47 a.m.
Message ID <2dfaac379d27244d301ff9c4444fdfc6a3a3bd91.1332567775.git.dongxiao.xu@intel.com>
Download mbox | patch
Permalink /patch/24433/
State New
Headers show

Comments

Dongxiao Xu - March 24, 2012, 5:47 a.m.
This change allows adding extra inherits before getting all the
parameters.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 lib/bb/ui/crumbs/builder.py         |   17 +++++++++++------
 lib/bb/ui/crumbs/hobeventhandler.py |    6 +++++-
 lib/bb/ui/hob.py                    |    2 --
 3 files changed, 16 insertions(+), 9 deletions(-)

Patch

diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index 0faef9b..d348497 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -186,11 +186,6 @@  class Builder(gtk.Window):
 
         self.template = None
 
-        # settings
-        params = self.handler.get_parameters()
-        self.configuration = Configuration(params)
-        self.parameters = Parameters(params)
-
         # build step
         self.current_step = None
         self.previous_step = None
@@ -224,6 +219,10 @@  class Builder(gtk.Window):
         self.handler.connect("command-succeeded",        self.handler_command_succeeded_cb)
         self.handler.connect("command-failed",           self.handler_command_failed_cb)
 
+        self.handler.init_cooker()
+        self.handler.set_extra_inherit("image_types")
+        self.handler.parse_config()
+
         self.switch_page(self.MACHINE_SELECTION)
 
     def create_visual_elements(self):
@@ -409,7 +408,13 @@  class Builder(gtk.Window):
         self.parameters.all_layers = layers
 
     def handler_command_succeeded_cb(self, handler, initcmd):
-        if initcmd == self.handler.GENERATE_CONFIGURATION:
+        if initcmd == self.handler.PARSE_CONFIG:
+            # settings
+            params = self.handler.get_parameters()
+            self.configuration = Configuration(params)
+            self.parameters = Parameters(params)
+            self.handler.generate_configuration()
+        elif initcmd == self.handler.GENERATE_CONFIGURATION:
             self.image_configuration_page.switch_machine_combo()
         elif initcmd in [self.handler.GENERATE_RECIPES,
                          self.handler.GENERATE_PACKAGES,
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index 8094d2d..308ef4d 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -62,7 +62,7 @@  class HobHandler(gobject.GObject):
                                      (gobject.TYPE_PYOBJECT,)),
     }
 
-    (GENERATE_CONFIGURATION, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO) = range(5)
+    (PARSE_CONFIG, GENERATE_CONFIGURATION, GENERATE_RECIPES, GENERATE_PACKAGES, GENERATE_IMAGE, POPULATE_PACKAGEINFO) = range(6)
     (SUB_PATH_LAYERS, SUB_FILES_DISTRO, SUB_FILES_MACH, SUB_FILES_SDKMACH, SUB_MATCH_CLASS, SUB_PARSE_CONFIG, SUB_GNERATE_TGTS, SUB_GENERATE_PKGINFO, SUB_BUILD_RECIPES, SUB_BUILD_IMAGE) = range(10)
 
     def __init__(self, server, recipe_model, package_model):
@@ -246,6 +246,10 @@  class HobHandler(gobject.GObject):
     def init_cooker(self):
         self.server.runCommand(["initCooker"])
 
+    def parse_config(self):
+        self.commands_async.append(self.SUB_PARSE_CONFIG)
+        self.run_next_command(self.PARSE_CONFIG)
+
     def refresh_layers(self, bblayers):
         self.init_cooker()
         self.set_bblayers(bblayers)
diff --git a/lib/bb/ui/hob.py b/lib/bb/ui/hob.py
index 7c147c4..e72ab23 100755
--- a/lib/bb/ui/hob.py
+++ b/lib/bb/ui/hob.py
@@ -58,8 +58,6 @@  def main (server = None, eventHandler = None):
     hobHandler = HobHandler(server, recipe_model, package_model)
     builder = Builder(hobHandler, recipe_model, package_model)
 
-    hobHandler.generate_configuration()
-
     # This timeout function regularly probes the event queue to find out if we
     # have any messages waiting for us.
     gobject.timeout_add(10, event_handle_idle_func, eventHandler, hobHandler)