Skip to contentSkip to conversation

Hob: Bug fixes

GIT PULL New Dongxiao Xu 1 participant 6 messages Apr 14, 2012

lore
Share & tools
lore
#0 lore raw

Hi Richard,

This pull request contains some Hob related bug fixes, please help to review and pull.

Thanks,
Dongxiao

The following changes since commit 434fdb3913cc78e2e9cdeede4c4fa7f1c8ef8892:

Hob: Added required packages for toolchain. (2012-04-13 12:00:12 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib dxu4/hob-bugfix
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dxu4/hob-bugfix

Dongxiao Xu (4):
Hob: A minor fix on tooltip
Hob: Save the original image name into template
Hob: Build selected image if not customized
Hob: Use BB_DEFAULT_TASK as build task instead of hardcoded "build"

 lib/bb/ui/crumbs/builder.py         |   34 +++++++++++++++++++++-------------
 lib/bb/ui/crumbs/hig.py             |    5 ++++-
 lib/bb/ui/crumbs/hobeventhandler.py |   22 +++++++++++++---------
 3 files changed, 38 insertions(+), 23 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/4 Hob: A minor fix on tooltip

---
 lib/bb/ui/crumbs/hig.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
lib/bb/ui/crumbs/hig.py +4 -1
index 5cc8a59..322efc6 100644
@@ -392,7 +392,10 @@ class AdvancedSettingDialog (CrumbsDialog):
         j = 1
         for image_type in self.image_types:
             self.image_types_checkbuttons[image_type] = gtk.CheckButton(image_type)
-            self.image_types_checkbuttons[image_type].set_tooltip_text("Build an %s image" % image_type)
+            article = ""
+            if image_type.startswith(("a", "e", "i", "o", "u")):
+                article = "n"
+            self.image_types_checkbuttons[image_type].set_tooltip_text("Build a%s %s image" % (article, image_type))
             table.attach(self.image_types_checkbuttons[image_type], j, j + 4, i, i + 1)
             if image_type in self.configuration.image_fstypes.split():
                 self.image_types_checkbuttons[image_type].set_active(True)
Signature · 1 line
1.7.4.1
#2 lore raw

PATCH 2/4 Hob: Save the original image name into template

In reply to Dongxiao Xu

Previously we use the template file name as the image name. This commit changes to use the original selected image into template file.

---
 lib/bb/ui/crumbs/builder.py |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
lib/bb/ui/crumbs/builder.py +2 -7
index f414bc7..5e90219 100755
@@ -153,7 +153,7 @@ class Configuration:
         self.cvs_proxy_host = template.getVar("CVS_PROXY_HOST")
         self.cvs_proxy_port = template.getVar("CVS_PROXY_PORT")
 
-    def save(self, template, filename):
+    def save(self, template):
         # bblayers.conf
         template.setVar("BBLAYERS", " ".join(self.layers))
         # local.conf
@@ -175,7 +175,6 @@ class Configuration:
         template.setVar("TOOLCHAIN_BUILD", self.toolchain_build)
         template.setVar("IMAGE_FSTYPES", self.image_fstypes)
         # image/recipes/packages
-        self.selected_image = filename
         template.setVar("__SELECTED_IMAGE__", self.selected_image)
         template.setVar("DEPENDS", self.selected_recipes)
         template.setVar("IMAGE_INSTALL", self.user_selected_packages)
@@ -447,7 +446,7 @@ class Builder(gtk.Window):
 
         self.template = TemplateMgr()
         self.template.open(filename, path)
-        self.configuration.save(self.template, filename)
+        self.configuration.save(self.template)
 
         self.template.save()
         self.template.destroy()
@@ -627,10 +626,6 @@ class Builder(gtk.Window):
         selected_recipes = self.configuration.selected_recipes[:]
         selected_packages = self.configuration.selected_packages[:]
 
-        self.recipe_model.image_list_append(selected_image,
-                                            " ".join(selected_recipes),
-                                            " ".join(selected_packages))
-
         self.image_configuration_page.update_image_combo(self.recipe_model, selected_image)
         self.image_configuration_page.update_image_desc(selected_image)
         self.update_recipe_model(selected_image, selected_recipes)
Signature · 1 line
1.7.4.1
#3 lore raw

PATCH 3/4 Hob: Build selected image if not customized

In reply to Dongxiao Xu

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]

---
 lib/bb/ui/crumbs/builder.py         |   19 ++++++++++++++-----
 lib/bb/ui/crumbs/hobeventhandler.py |   17 +++++++++--------
 2 files changed, 23 insertions(+), 13 deletions(-)
lib/bb/ui/crumbs/builder.py +14 -5
index 5e90219..3f26bac 100755
@@ -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):
lib/bb/ui/crumbs/hobeventhandler.py +9 -8
index 292d905..c297863 100644
@@ -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)
Signature · 1 line
1.7.4.1
#4 lore raw

PATCH 4/4 Hob: Use BB_DEFAULT_TASK as build task instead of hardcoded "build"

In reply to Dongxiao Xu

Originally we use hardcoded "build" as the default task. This commit fixes it by using BB_DEFAULT_TASK.

This fixes [YOCTO #2283]

---
 lib/bb/ui/crumbs/builder.py         |    6 +++++-
 lib/bb/ui/crumbs/hobeventhandler.py |    7 +++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
lib/bb/ui/crumbs/builder.py +5 -1
index 3f26bac..03a7caa 100755
@@ -71,6 +71,8 @@ class Configuration:
 
         self.user_selected_packages = []
 
+        self.default_task = params["default_task"]
+
         # proxy settings
         self.all_proxy = params["all_proxy"]
         self.http_proxy = params["http_proxy"]
@@ -105,6 +107,7 @@ class Configuration:
         self.tune_pkgarch = params["tune_pkgarch"]
         # bblayers.conf
         self.layers = params["layer"].split()
+        self.default_task = params["default_task"]
 
     def load(self, template):
         self.curr_mach = template.getVar("MACHINE")
@@ -410,7 +413,8 @@ class Builder(gtk.Window):
         self.handler.generate_image(image,
                                     self.hob_toolchain,
                                     packages,
-                                    toolchain_packages)
+                                    toolchain_packages,
+                                    self.configuration.default_task)
 
     def get_parameters_sync(self):
         return self.handler.get_parameters()
lib/bb/ui/crumbs/hobeventhandler.py +5 -2
index c297863..a46d838 100644
@@ -135,7 +135,7 @@ class HobHandler(gobject.GObject):
             if self.toolchain_packages:
                 self.server.runCommand(["setVariable", "TOOLCHAIN_TARGET_TASK", " ".join(self.toolchain_packages)])
                 targets.append(self.toolchain)
-            self.server.runCommand(["buildTargets", targets, "build"])
+            self.server.runCommand(["buildTargets", targets, self.default_task])
 
     def handle_event(self, event):
         if not event:
@@ -353,11 +353,12 @@ class HobHandler(gobject.GObject):
         self.commands_async.append(self.SUB_BUILD_RECIPES)
         self.run_next_command(self.GENERATE_PACKAGES)
 
-    def generate_image(self, image, toolchain, image_packages=[], toolchain_packages=[]):
+    def generate_image(self, image, toolchain, image_packages=[], toolchain_packages=[], default_task="build"):
         self.image = image
         self.toolchain = toolchain
         self.package_queue = image_packages
         self.toolchain_packages = toolchain_packages
+        self.default_task = default_task
         self.commands_async.append(self.SUB_PARSE_CONFIG)
         self.commands_async.append(self.SUB_BUILD_IMAGE)
         self.run_next_command(self.GENERATE_IMAGE)
@@ -495,6 +496,8 @@ class HobHandler(gobject.GObject):
         params["bb_version"] = self.server.runCommand(["getVariable", "BB_MIN_VERSION"]) or ""
         params["tune_arch"] = self.server.runCommand(["getVariable", "TUNE_ARCH"]) or ""
 
+        params["default_task"] = self.server.runCommand(["getVariable", "BB_DEFAULT_TASK"]) or "build"
+
         params["git_proxy_host"] = self.server.runCommand(["getVariable", "GIT_PROXY_HOST"]) or ""
         params["git_proxy_port"] = self.server.runCommand(["getVariable", "GIT_PROXY_PORT"]) or ""
 
Signature · 1 line
1.7.4.1
#5 lore raw
In reply to Dongxiao Xu
Quoted 3 lines · Dongxiao Xu

Hi Richard,

This pull request contains some Hob related bug fixes, please help to review and pull.

Please ignore this request because it missed some critical change, I will send an update one.

Thanks,
Dongxiao

Quoted 23 lines

Thanks,
Dongxiao

The following changes since commit 434fdb3913cc78e2e9cdeede4c4fa7f1c8ef8892:

Hob: Added required packages for toolchain. (2012-04-13 12:00:12 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib dxu4/hob-bugfix
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=dxu4/hob-bugfix

Dongxiao Xu (4):
Hob: A minor fix on tooltip
Hob: Save the original image name into template
Hob: Build selected image if not customized
Hob: Use BB_DEFAULT_TASK as build task instead of hardcoded "build"

 lib/bb/ui/crumbs/builder.py         |   34 +++++++++++++++++++++-------------
 lib/bb/ui/crumbs/hig.py             |    5 ++++-
 lib/bb/ui/crumbs/hobeventhandler.py |   22 +++++++++++++---------
 3 files changed, 38 insertions(+), 23 deletions(-)