Patchwork [bitbake-devel,1/1] Hob: Handle NoProvider event in runningbuild module

login
register
mail settings
Submitter Dongxiao Xu
Date April 15, 2012, 2:12 a.m.
Message ID <822bf8645855b205a142741f52fff954cba1c0d4.1334455811.git.dongxiao.xu@intel.com>
Download mbox | patch
Permalink /patch/25853/
State Accepted
Commit 067bc46a0fbc542fef1fcaa406ad3737a4c5a55a
Headers show

Comments

Dongxiao Xu - April 15, 2012, 2:12 a.m.
If NoProvider event is received, we will handle it in runningbuild
module and send notification to Hob instance, avoiding stepping into the
final page with no image built out.

This fixes [YOCTO #2249]

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 lib/bb/ui/crumbs/builder.py         |   18 ++++++++++++++----
 lib/bb/ui/crumbs/hobeventhandler.py |   21 ---------------------
 lib/bb/ui/crumbs/runningbuild.py    |   17 +++++++++++++++++
 3 files changed, 31 insertions(+), 25 deletions(-)

Patch

diff --git a/lib/bb/ui/crumbs/builder.py b/lib/bb/ui/crumbs/builder.py
index 48053b3..dd59d59 100755
--- a/lib/bb/ui/crumbs/builder.py
+++ b/lib/bb/ui/crumbs/builder.py
@@ -349,6 +349,7 @@  class Builder(gtk.Window):
         self.handler.build.connect("build-failed",       self.handler_build_failed_cb)
         self.handler.build.connect("task-started",       self.handler_task_started_cb)
         self.handler.build.connect("log-error",          self.handler_build_failure_cb)
+        self.handler.build.connect("no-provider",        self.handler_no_provider_cb)
         self.handler.connect("generating-data",          self.handler_generating_data_cb)
         self.handler.connect("data-generated",           self.handler_data_generated_cb)
         self.handler.connect("command-succeeded",        self.handler_command_succeeded_cb)
@@ -624,10 +625,6 @@  class Builder(gtk.Window):
             self.rcppkglist_populated()
             if self.current_step == self.FAST_IMAGE_GENERATING:
                 self.generate_image_async()
-            elif self.current_step == self.PACKAGE_GENERATING:
-                self.switch_page(self.PACKAGE_GENERATED)
-            elif self.current_step == self.IMAGE_GENERATING:
-                self.switch_page(self.IMAGE_GENERATED)
 
     def handler_command_failed_cb(self, handler, msg):
         if msg:
@@ -755,6 +752,11 @@  class Builder(gtk.Window):
         self.handler.build_succeeded_async()
         self.stopping = False
 
+        if self.current_step == self.PACKAGE_GENERATING:
+            self.switch_page(self.PACKAGE_GENERATED)
+        elif self.current_step == self.IMAGE_GENERATING:
+            self.switch_page(self.IMAGE_GENERATED)
+
     def build_failed(self):
         if self.stopping:
             status = "stop"
@@ -785,6 +787,14 @@  class Builder(gtk.Window):
     def handler_build_failed_cb(self, running_build):
         self.build_failed()
 
+    def handler_no_provider_cb(self, running_build, msg):
+        dialog = CrumbsMessageDialog(self, msg, gtk.STOCK_DIALOG_INFO)
+        button = dialog.add_button("Close", gtk.RESPONSE_OK)
+        HobButton.style_button(button)
+        dialog.run()
+        dialog.destroy()
+        self.build_failed()
+
     def handler_task_started_cb(self, running_build, message): 
         fraction = message["current"] * 1.0/message["total"]
         title = "Build packages"
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py
index 7a3cc6b..a61cca0 100644
--- a/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/lib/bb/ui/crumbs/hobeventhandler.py
@@ -180,27 +180,6 @@  class HobHandler(gobject.GObject):
         elif isinstance(event, bb.command.CommandCompleted):
             self.current_phase = None
             self.run_next_command()
-        # TODO: Currently there are NoProvider issues when generate
-        # universe tree dependency for non-x86 architecture.
-        # Comment the follow code to enable the build of non-x86
-        # architectures in Hob.
-        #elif isinstance(event, bb.event.NoProvider):
-        #    if event._runtime:
-        #        r = "R"
-        #    else:
-        #        r = ""
-        #    if event._dependees:
-        #        self.error_msg += " Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)" % (r, event._item, ", ".join(event._dependees), r)
-        #    else:
-        #        self.error_msg += " Nothing %sPROVIDES '%s'" % (r, event._item)
-        #    if event._reasons:
-        #        for reason in event._reasons:
-        #            self.error_msg += " %s" % reason
-
-        #    self.commands_async = []
-        #    self.emit("command-failed", self.error_msg)
-        #    self.error_msg = ""
-
         elif isinstance(event, bb.command.CommandFailed):
             self.commands_async = []
             self.clear_busy()
diff --git a/lib/bb/ui/crumbs/runningbuild.py b/lib/bb/ui/crumbs/runningbuild.py
index 042902e..8cf36ee 100644
--- a/lib/bb/ui/crumbs/runningbuild.py
+++ b/lib/bb/ui/crumbs/runningbuild.py
@@ -82,6 +82,9 @@  class RunningBuild (gobject.GObject):
           'log-error'       :  (gobject.SIGNAL_RUN_LAST,
                                 gobject.TYPE_NONE,
                                ()),
+          'no-provider'     :  (gobject.SIGNAL_RUN_LAST,
+                                gobject.TYPE_NONE,
+                               (gobject.TYPE_PYOBJECT,)),
           }
     pids_to_task = {}
     tasks_to_iter = {}
@@ -320,6 +323,20 @@  class RunningBuild (gobject.GObject):
             message["title"] = ""
             message["task"] = event.taskstring
             self.emit("task-started", message)
+        elif isinstance(event, bb.event.NoProvider):
+            msg = ""
+            if event._runtime:
+                r = "R"
+            else:
+                r = ""
+            if event._dependees:
+                msg = "Nothing %sPROVIDES '%s' (but %s %sDEPENDS on or otherwise requires it)\n" % (r, event._item, ", ".join(event._dependees), r)
+            else:
+                msg = "Nothing %sPROVIDES '%s'\n" % (r, event._item)
+            if event._reasons:
+                for reason in event._reasons:
+                    msg += ("%s\n" % reason)
+            self.emit("no-provider", msg)
 
         return