Patchwork [bitbake-devel,07/10] Hob: Fix toolchain build

login
register
mail settings
Submitter Dongxiao Xu
Date April 1, 2012, 12:14 p.m.
Message ID <c96ae687bf17755f49b91bba83776428237b9653.1333269705.git.dongxiao.xu@intel.com>
Download mbox | patch
Permalink /patch/25021/
State Accepted
Commit f99c66071bce63780301e1639d74316503ca934c
Headers show

Comments

Dongxiao Xu - April 1, 2012, 12:14 p.m.
Originally we added -dev and -dbg postfixes to our selected packages as
toolchain packages. However, some package names are modified in recipes,
so we could not rely on its base name. The new approach is to detect if
a package is selected, then include those packages under the same recipe
endswith "-dev" and "-dbg".

This fixes [YOCTO #2185]

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

Patch

diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index 44b208a..8427623 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -457,12 +457,15 @@  class Builder(gtk.Window):
     def generate_image(self):
         # Build image
         self.set_user_config()
-        all_packages = self.package_model.get_selected_packages()
+        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(all_packages,
+        self.handler.generate_image(packages,
                                     self.hob_image,
                                     self.hob_toolchain,
-                                    self.configuration.toolchain_build)
+                                    toolchain_packages)
 
     # Callback Functions
     def handler_config_updated_cb(self, handler, which, values):
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index 74081dc..8909e01 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -131,9 +131,8 @@  class HobHandler(gobject.GObject):
             targets = [self.hob_image]
             self.server.runCommand(["setVariable", "LINGUAS_INSTALL", ""])
             self.server.runCommand(["setVariable", "PACKAGE_INSTALL", " ".join(self.package_queue)])
-            if self.toolchain_build:
-                pkgs = self.package_queue + [i+'-dev' for i in self.package_queue] + [i+'-dbg' for i in self.package_queue]
-                self.server.runCommand(["setVariable", "TOOLCHAIN_TARGET_TASK", " ".join(pkgs)])
+            if self.toolchain_packages:
+                self.server.runCommand(["setVariable", "TOOLCHAIN_TARGET_TASK", " ".join(self.toolchain_packages)])
                 targets.append(self.hob_toolchain)
             self.server.runCommand(["buildTargets", targets, "build"])
 
@@ -350,11 +349,11 @@  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_build=False):
+    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
-        self.toolchain_build = toolchain_build
+        self.toolchain_packages = toolchain_packages
         self.commands_async.append(self.SUB_PARSE_CONFIG)
         self.commands_async.append(self.SUB_BUILD_IMAGE)
         self.run_next_command(self.GENERATE_IMAGE)
diff --git a/lib/bb/ui/crumbs/hoblistmodel.py b/lib/bb/ui/crumbs/hoblistmodel.py
index 6a829e2..a351597 100644
--- a/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/lib/bb/ui/crumbs/hoblistmodel.py
@@ -357,6 +357,22 @@  class PackageListModel(gtk.TreeStore):
 
         return packagelist
 
+    def get_selected_packages_toolchain(self):
+        packagelist = []
+
+        it = self.get_iter_first()
+        while it:
+            if self.get_value(it, self.COL_INC):
+                child_it = self.iter_children(it)
+                while child_it:
+                    name = self.get_value(child_it, self.COL_NAME)
+                    inc = self.get_value(child_it, self.COL_INC)
+                    if inc or name.endswith("-dev") or name.endswith("-dbg"):
+                        packagelist.append(name)
+                    child_it = self.iter_next(child_it)
+            it = self.iter_next(it)
+
+        return packagelist
     """
     Return the selected package size, unit is KB.
     """