Patchwork [bitbake-devel,3/4] Hob: Build selected image if not customized

login
register
mail settings
Submitter Dongxiao Xu
Date April 14, 2012, 10:42 a.m.
Message ID <204a976e3209815b2c22fb306bc4618f6d90a962.1334400003.git.dongxiao.xu@intel.com>
Download mbox | patch
Permalink /patch/25807/
State Accepted
Commit a74a6a033e66a0ae7b47c84d842bdd54066c69a1
Headers show

Comments

Dongxiao Xu - April 14, 2012, 10:42 a.m.
If user selected a base image and didn't customize it, Hob will still
build the selected image instead of hob-image.

This fixes [YOCTO #2253]

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

Patch

diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index 5e90219..3f26bac 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -395,16 +395,21 @@  class Builder(gtk.Window):
 
     def generate_image_async(self):
         self.switch_page(self.IMAGE_GENERATING)
+        self.handler.reset_build()
         # Build image
         self.set_user_config()
-        packages = self.package_model.get_selected_packages()
         toolchain_packages = []
         if self.configuration.toolchain_build:
             toolchain_packages = self.package_model.get_selected_packages_toolchain()
-        self.handler.reset_build()
-        self.handler.generate_image(packages,
-                                    self.hob_image,
+        if self.configuration.selected_image == self.recipe_model.__dummy_image__:
+            packages = self.package_model.get_selected_packages()
+            image = self.hob_image
+        else:
+            packages = []
+            image = self.configuration.selected_image
+        self.handler.generate_image(image,
                                     self.hob_toolchain,
+                                    packages,
                                     toolchain_packages)
 
     def get_parameters_sync(self):
@@ -690,7 +695,11 @@  class Builder(gtk.Window):
         elif self.current_step == self.IMAGE_GENERATING:
             fraction = 1.0
             self.parameters.image_names = []
-            linkname = 'hob-image-' + self.configuration.curr_mach
+            selected_image = self.recipe_model.get_selected_image()
+            if selected_image == self.recipe_model.__dummy_image__:
+                linkname = 'hob-image-' + self.configuration.curr_mach
+            else:
+                linkname = selected_image + '-' + self.configuration.curr_mach
             for image_type in self.parameters.image_types:
                 linkpath = self.parameters.image_addr + '/' + linkname + '.' + image_type
                 if os.path.exists(linkpath):
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index 292d905..c297863 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -128,12 +128,13 @@  class HobHandler(gobject.GObject):
         elif next_command == self.SUB_BUILD_IMAGE:
             self.clear_busy()
             self.building = True
-            targets = [self.hob_image]
-            self.server.runCommand(["setVariable", "LINGUAS_INSTALL", ""])
-            self.server.runCommand(["setVariable", "PACKAGE_INSTALL", " ".join(self.package_queue)])
+            targets = [self.image]
+            if self.package_queue:
+                self.server.runCommand(["setVariable", "LINGUAS_INSTALL", ""])
+                self.server.runCommand(["setVariable", "PACKAGE_INSTALL", " ".join(self.package_queue)])
             if self.toolchain_packages:
                 self.server.runCommand(["setVariable", "TOOLCHAIN_TARGET_TASK", " ".join(self.toolchain_packages)])
-                targets.append(self.hob_toolchain)
+                targets.append(self.toolchain)
             self.server.runCommand(["buildTargets", targets, "build"])
 
     def handle_event(self, event):
@@ -352,10 +353,10 @@  class HobHandler(gobject.GObject):
         self.commands_async.append(self.SUB_BUILD_RECIPES)
         self.run_next_command(self.GENERATE_PACKAGES)
 
-    def generate_image(self, tgts, hob_image, hob_toolchain, toolchain_packages=[]):
-        self.package_queue = tgts
-        self.hob_image = hob_image
-        self.hob_toolchain = hob_toolchain
+    def generate_image(self, image, toolchain, image_packages=[], toolchain_packages=[]):
+        self.image = image
+        self.toolchain = toolchain
+        self.package_queue = image_packages
         self.toolchain_packages = toolchain_packages
         self.commands_async.append(self.SUB_PARSE_CONFIG)
         self.commands_async.append(self.SUB_BUILD_IMAGE)