From f26d3e8d5f735c7439bed234d0eb030215cded98 Mon Sep 17 00:00:00 2001 From: Cristiana Voicu Date: Tue, 20 Nov 2012 14:37:46 +0200 Subject: bitbake: hob: showing when build fails because out of disk space -to enable this in hob, first you have to enable this in bitbake using BB_DISKMON_DIRS and/or BB_DISKMON_WARNINTERVAL vars -created "restart the build" action on the build_fail_top_bar [YOCTO #3357] (Bitbake rev: 964ac25d153ff4da144963289a32066db0e28b89) Signed-off-by: Cristiana Voicu Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/crumbs/builddetailspage.py | 38 +++++++++++++++++++++++----- bitbake/lib/bb/ui/crumbs/builder.py | 4 +++ bitbake/lib/bb/ui/crumbs/hobwidget.py | 3 ++- bitbake/lib/bb/ui/crumbs/runningbuild.py | 5 ++++ 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/bitbake/lib/bb/ui/crumbs/builddetailspage.py b/bitbake/lib/bb/ui/crumbs/builddetailspage.py index 1afacf85bd..6d8c38bd67 100755 --- a/bitbake/lib/bb/ui/crumbs/builddetailspage.py +++ b/bitbake/lib/bb/ui/crumbs/builddetailspage.py @@ -206,8 +206,6 @@ class BuildDetailsPage (HobPage): def add_build_fail_top_bar(self, actions, log_file=None): primary_action = "Edit %s" % actions - self.notebook.set_page("Issues") - color = HobColors.ERROR build_fail_top = gtk.EventBox() #build_fail_top.set_size_request(-1, 200) @@ -228,7 +226,17 @@ class BuildDetailsPage (HobPage): label = gtk.Label() label.set_alignment(0.0, 0.5) - label.set_markup("Check the \"Issues\" information for more details") + # Ensure variable disk_full is defined + try: + self.builder.disk_full + except NameError: + self.builder.disk_full = False + if self.builder.disk_full: + markup = "There is no disk space left, so Hob cannot finish building your image. Free up some disk space\n" + markup += "and restart the build. Check the \"Issues\" tab for more details" + label.set_markup(markup) + else: + label.set_markup("Check the \"Issues\" information for more details") build_fail_tab.attach(label, 4, 40, 4, 9) # create button 'Edit packages' @@ -236,22 +244,36 @@ class BuildDetailsPage (HobPage): #action_button.set_size_request(-1, 40) action_button.set_tooltip_text("Edit the %s parameters" % actions) action_button.connect('clicked', self.failure_primary_action_button_clicked_cb, primary_action) - build_fail_tab.attach(action_button, 4, 13, 9, 12) if log_file: open_log_button = HobAltButton("Open log") open_log_button.set_relief(gtk.RELIEF_HALF) open_log_button.set_tooltip_text("Open the build's log file") open_log_button.connect('clicked', self.open_log_button_clicked_cb, log_file) - build_fail_tab.attach(open_log_button, 14, 23, 9, 12) attach_pos = (24 if log_file else 14) file_bug_button = HobAltButton('File a bug') file_bug_button.set_relief(gtk.RELIEF_HALF) file_bug_button.set_tooltip_text("Open the Yocto Project bug tracking website") file_bug_button.connect('clicked', self.failure_activate_file_bug_link_cb) - build_fail_tab.attach(file_bug_button, attach_pos, attach_pos + 9, 9, 12) + if not self.builder.disk_full: + build_fail_tab.attach(action_button, 4, 13, 9, 12) + if log_file: + build_fail_tab.attach(open_log_button, 14, 23, 9, 12) + build_fail_tab.attach(file_bug_button, attach_pos, attach_pos + 9, 9, 12) + + else: + restart_build = HobButton("Restart the build") + restart_build.set_tooltip_text("Restart the build") + restart_build.connect('clicked', self.restart_build_button_clicked_cb) + + build_fail_tab.attach(restart_build, 4, 13, 9, 12) + build_fail_tab.attach(action_button, 14, 23, 9, 12) + if log_file: + build_fail_tab.attach(open_log_button, attach_pos, attach_pos + 9, 9, 12) + + self.builder.disk_full = False return build_fail_top def show_fail_page(self, title): @@ -266,6 +288,7 @@ class BuildDetailsPage (HobPage): self.vbox.pack_start(self.notebook, expand=True, fill=True) self.show_all() + self.notebook.set_page("Issues") self.back_button.hide() def add_build_stop_top_bar(self, action, log_file=None): @@ -396,6 +419,9 @@ class BuildDetailsPage (HobPage): elif "Edit image" in action: self.builder.show_configuration() + def restart_build_button_clicked_cb(self, button): + self.builder.just_bake() + def stop_primary_action_button_clicked_cb(self, button, action): if "recipes" in action: self.builder.show_recipes() diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py index 25741fe3f4..ec3ff30488 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py @@ -456,6 +456,7 @@ class Builder(gtk.Window): self.handler.build.connect("build-failed", self.handler_build_failed_cb) self.handler.build.connect("build-aborted", self.handler_build_aborted_cb) self.handler.build.connect("task-started", self.handler_task_started_cb) + self.handler.build.connect("disk-full", self.handler_disk_full_cb) self.handler.build.connect("log-error", self.handler_build_failure_cb) self.handler.build.connect("log-warning", self.handler_build_failure_cb) self.handler.build.connect("log", self.handler_build_log_cb) @@ -1122,6 +1123,9 @@ class Builder(gtk.Window): self.build_details_page.update_progress_bar(title + ": ", fraction) self.build_details_page.update_build_status(message["current"], message["total"], message["task"]) + def handler_disk_full_cb(self, running_build): + self.disk_full = True + def handler_build_failure_cb(self, running_build): self.build_details_page.show_issues() diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py index 65de9df78f..3ca9066227 100644 --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py @@ -521,7 +521,8 @@ class HobNotebook(gtk.Notebook): for child in self.pages: if child.lbl.get_label() == title: child.grab_focus() - self.set_current_page(self.page_num(child)) + self.set_current_page(self.pages.index(child)) + return class HobWarpCellRendererText(gtk.CellRendererText): def __init__(self, col_number): diff --git a/bitbake/lib/bb/ui/crumbs/runningbuild.py b/bitbake/lib/bb/ui/crumbs/runningbuild.py index f6848fd8bf..78fa1417f5 100644 --- a/bitbake/lib/bb/ui/crumbs/runningbuild.py +++ b/bitbake/lib/bb/ui/crumbs/runningbuild.py @@ -88,6 +88,9 @@ class RunningBuild (gobject.GObject): 'log-warning' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()), + 'disk-full' : (gobject.SIGNAL_RUN_LAST, + gobject.TYPE_NONE, + ()), 'no-provider' : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (gobject.TYPE_PYOBJECT,)), @@ -290,6 +293,7 @@ class RunningBuild (gobject.GObject): # Emit the appropriate signal depending on the number of failures if self.buildaborted: self.emit ("build-aborted") + self.buildaborted = False elif (failures >= 1): self.emit ("build-failed") else: @@ -304,6 +308,7 @@ class RunningBuild (gobject.GObject): elif isinstance(event, bb.event.DiskFull): self.buildaborted = True + self.emit("disk-full") elif isinstance(event, bb.command.CommandFailed): self.emit("log", "error", "Command execution failed: %s" % (event.error)) -- cgit v1.2.3-54-g00ecf