Skip to contentSkip to conversation

Hob: Bug fixes

GIT PULL New Dongxiao Xu 2 participants 6 messages Apr 14, 2012 Arm STM32

lore
Share & tools
lore
#0 lore raw

Hi Richard,

This is the revised pull request contains several Hob related bug fixes, please help to review and pull.

Add some missed changes from v1:
1) Change the commit author for "Hob: A minor fix on tooltip".
2) Use BB_DEFAULT_TASK as parameter of generate_package().
3) Remove un-used function image_list_append().

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 (3):
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"

Richard Purdie (1):
Hob: A minor fix on tooltip

 lib/bb/ui/crumbs/builder.py         |   38 +++++++++++++++++++++-------------
 lib/bb/ui/crumbs/hig.py             |    5 +++-
 lib/bb/ui/crumbs/hobeventhandler.py |   27 ++++++++++++++----------
 lib/bb/ui/crumbs/hoblistmodel.py    |   16 --------------
 4 files changed, 43 insertions(+), 43 deletions(-)
Signature · 1 line
1.7.4.1
#2 lore raw

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

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 ++-------
 lib/bb/ui/crumbs/hoblistmodel.py |   16 ----------------
 2 files changed, 2 insertions(+), 23 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)
lib/bb/ui/crumbs/hoblistmodel.py +0 -16
index dd93e2a..e7836c5 100644
@@ -618,22 +618,6 @@ class RecipeListModel(gtk.ListStore):
         return self[item_path][self.COL_INC]
 
     """
-    Append a certain image into the combobox
-    """
-    def image_list_append(self, name, deps, install):
-        # check whether a certain image is there
-        if not name or self.find_path_for_item(name):
-            return
-        it = self.append()
-        self.set(it, self.COL_NAME, name, self.COL_DESC, "",
-                 self.COL_LIC, "", self.COL_GROUP, "",
-                 self.COL_DEPS, deps, self.COL_BINB, "",
-                 self.COL_TYPE, "image", self.COL_INC, False,
-                 self.COL_IMG, False, self.COL_INSTALL, install,
-                 self.COL_PN, name)
-        self.pn_path[name] = self.get_path(it)
-
-    """
     Add this item, and any of its dependencies, to the image contents
     """
     def include_item(self, item_path, binb="", image_contents=False):
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/4 Hob: A minor fix on tooltip

In reply to Dongxiao Xu

From: Richard Purdie <[email protected]>

---
 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
#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         |   10 +++++++---
 lib/bb/ui/crumbs/hobeventhandler.py |   12 ++++++++----
 2 files changed, 15 insertions(+), 7 deletions(-)
lib/bb/ui/crumbs/builder.py +7 -3
index 3f26bac..de9685d 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")
@@ -383,7 +386,7 @@ class Builder(gtk.Window):
         _, all_recipes = self.recipe_model.get_selected_recipes()
         self.set_user_config()
         self.handler.reset_build()
-        self.handler.generate_packages(all_recipes)
+        self.handler.generate_packages(all_recipes, self.configuration.default_task)
 
     def fast_generate_image_async(self):
         self.switch_page(self.FAST_IMAGE_GENERATING)
@@ -391,7 +394,7 @@ class Builder(gtk.Window):
         _, all_recipes = self.recipe_model.get_selected_recipes()
         self.set_user_config()
         self.handler.reset_build()
-        self.handler.generate_packages(all_recipes)
+        self.handler.generate_packages(all_recipes, self.configuration.default_task)
 
     def generate_image_async(self):
         self.switch_page(self.IMAGE_GENERATING)
@@ -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 +8 -4
index c297863..17d3fe4 100644
@@ -123,7 +123,7 @@ class HobHandler(gobject.GObject):
         elif next_command == self.SUB_BUILD_RECIPES:
             self.clear_busy()
             self.building = True
-            self.server.runCommand(["buildTargets", self.recipe_queue, "build"])
+            self.server.runCommand(["buildTargets", self.recipe_queue, self.default_task])
             self.recipe_queue = []
         elif next_command == self.SUB_BUILD_IMAGE:
             self.clear_busy()
@@ -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:
@@ -345,19 +345,21 @@ class HobHandler(gobject.GObject):
         self.commands_async.append(self.SUB_GNERATE_TGTS)
         self.run_next_command(self.GENERATE_RECIPES)
                  
-    def generate_packages(self, tgts):
+    def generate_packages(self, tgts, default_task="build"):
         targets = []
         targets.extend(tgts)
         self.recipe_queue = targets
+        self.default_task = default_task
         self.commands_async.append(self.SUB_PARSE_CONFIG)
         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 +497,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 20 lines · Dongxiao Xu

Hi Richard,

This is the revised pull request contains several Hob related bug fixes, please help to review and pull.

Add some missed changes from v1:
1) Change the commit author for "Hob: A minor fix on tooltip".
2) Use BB_DEFAULT_TASK as parameter of generate_package().
3) Remove un-used function image_list_append().

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

Quoted 7 lines

Dongxiao Xu (3):
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"

Richard Purdie (1):
Hob: A minor fix on tooltip

Merged to master, thanks.

Richard