summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorCristiana Voicu <cristiana.voicu@intel.com>2013-01-21 16:40:07 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-01-21 19:05:31 +0000
commit37e025f6f9c410005e0f1dee0767e38eaec01cbd (patch)
tree1fd4d838cc1cab373a62bc47bf3226c9924dd512 /bitbake
parent4c1ebc7ca73f4ee069dc471a395073ba9a8ce00e (diff)
downloadpoky-37e025f6f9c410005e0f1dee0767e38eaec01cbd.tar.gz
bitbake: hob: Hob should display warnings generated during parsing
-now Hob catches the warnings generated during parsing, and after the parsing is completed, if there are any warnings, it shows a bar that contains a message with how many warnings has encountered, and a button "View warnings" -when "View warnings" button is clicked, Hob shows a dialog with the warnings; if there more than 1 warning, you can use "Previous" and "Next" button to see them [YOCTO #3215] (Bitbake rev: d7b5311d35b3974398fecabfb5ecf1effa85c27e) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py17
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobcolor.py1
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py13
-rw-r--r--bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py54
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/packageselectionpage.py1
5 files changed, 80 insertions, 6 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index b783dad57f..d57cf4c322 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -46,6 +46,7 @@ from bb.ui.crumbs.hig.advancedsettingsdialog import AdvancedSettingsDialog
46from bb.ui.crumbs.hig.deployimagedialog import DeployImageDialog 46from bb.ui.crumbs.hig.deployimagedialog import DeployImageDialog
47from bb.ui.crumbs.hig.layerselectiondialog import LayerSelectionDialog 47from bb.ui.crumbs.hig.layerselectiondialog import LayerSelectionDialog
48from bb.ui.crumbs.hig.imageselectiondialog import ImageSelectionDialog 48from bb.ui.crumbs.hig.imageselectiondialog import ImageSelectionDialog
49from bb.ui.crumbs.hig.parsingwarningsdialog import ParsingWarningsDialog
49 50
50hobVer = 20120808 51hobVer = 20120808
51 52
@@ -446,6 +447,9 @@ class Builder(gtk.Window):
446 # Indicate whether the sanity check ran 447 # Indicate whether the sanity check ran
447 self.sanity_checked = False 448 self.sanity_checked = False
448 449
450 # save parsing warnings
451 self.parsing_warnings = []
452
449 # create visual elements 453 # create visual elements
450 self.create_visual_elements() 454 self.create_visual_elements()
451 455
@@ -472,6 +476,7 @@ class Builder(gtk.Window):
472 self.handler.connect("data-generated", self.handler_data_generated_cb) 476 self.handler.connect("data-generated", self.handler_data_generated_cb)
473 self.handler.connect("command-succeeded", self.handler_command_succeeded_cb) 477 self.handler.connect("command-succeeded", self.handler_command_succeeded_cb)
474 self.handler.connect("command-failed", self.handler_command_failed_cb) 478 self.handler.connect("command-failed", self.handler_command_failed_cb)
479 self.handler.connect("parsing-warning", self.handler_parsing_warning_cb)
475 self.handler.connect("sanity-failed", self.handler_sanity_failed_cb) 480 self.handler.connect("sanity-failed", self.handler_sanity_failed_cb)
476 self.handler.connect("recipe-populated", self.handler_recipe_populated_cb) 481 self.handler.connect("recipe-populated", self.handler_recipe_populated_cb)
477 self.handler.connect("package-populated", self.handler_package_populated_cb) 482 self.handler.connect("package-populated", self.handler_package_populated_cb)
@@ -880,6 +885,15 @@ class Builder(gtk.Window):
880 response = dialog.run() 885 response = dialog.run()
881 dialog.destroy() 886 dialog.destroy()
882 887
888 def show_warning_dialog(self):
889 dialog = ParsingWarningsDialog(title = "View warnings",
890 warnings = self.parsing_warnings,
891 parent = None,
892 flags = gtk.DIALOG_DESTROY_WITH_PARENT
893 | gtk.DIALOG_NO_SEPARATOR)
894 response = dialog.run()
895 dialog.destroy()
896
883 def show_network_error_dialog(self): 897 def show_network_error_dialog(self):
884 lbl = "<b>Hob cannot connect to the network</b>\n" 898 lbl = "<b>Hob cannot connect to the network</b>\n"
885 msg = "Please check your network connection. If you are using a proxy server, please make sure it is configured correctly." 899 msg = "Please check your network connection. If you are using a proxy server, please make sure it is configured correctly."
@@ -903,6 +917,9 @@ class Builder(gtk.Window):
903 self.show_error_dialog(msg) 917 self.show_error_dialog(msg)
904 self.reset() 918 self.reset()
905 919
920 def handler_parsing_warning_cb(self, handler, warn_msg):
921 self.parsing_warnings.append(warn_msg)
922
906 def handler_sanity_failed_cb(self, handler, msg, network_error): 923 def handler_sanity_failed_cb(self, handler, msg, network_error):
907 self.reset() 924 self.reset()
908 if network_error: 925 if network_error:
diff --git a/bitbake/lib/bb/ui/crumbs/hobcolor.py b/bitbake/lib/bb/ui/crumbs/hobcolor.py
index e10f546e52..3316542a20 100644
--- a/bitbake/lib/bb/ui/crumbs/hobcolor.py
+++ b/bitbake/lib/bb/ui/crumbs/hobcolor.py
@@ -30,6 +30,7 @@ class HobColors:
30 BLACK = "#000000" 30 BLACK = "#000000"
31 PALE_BLUE = "#53b8ff" 31 PALE_BLUE = "#53b8ff"
32 DEEP_RED = "#aa3e3e" 32 DEEP_RED = "#aa3e3e"
33 KHAKI = "#fff68f"
33 34
34 OK = WHITE 35 OK = WHITE
35 RUNNING = PALE_GREEN 36 RUNNING = PALE_GREEN
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index e690d4c99c..41022ef8eb 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -41,6 +41,9 @@ class HobHandler(gobject.GObject):
41 "command-failed" : (gobject.SIGNAL_RUN_LAST, 41 "command-failed" : (gobject.SIGNAL_RUN_LAST,
42 gobject.TYPE_NONE, 42 gobject.TYPE_NONE,
43 (gobject.TYPE_STRING,)), 43 (gobject.TYPE_STRING,)),
44 "parsing-warning" : (gobject.SIGNAL_RUN_LAST,
45 gobject.TYPE_NONE,
46 (gobject.TYPE_STRING,)),
44 "sanity-failed" : (gobject.SIGNAL_RUN_LAST, 47 "sanity-failed" : (gobject.SIGNAL_RUN_LAST,
45 gobject.TYPE_NONE, 48 gobject.TYPE_NONE,
46 (gobject.TYPE_STRING, gobject.TYPE_INT)), 49 (gobject.TYPE_STRING, gobject.TYPE_INT)),
@@ -95,6 +98,7 @@ class HobHandler(gobject.GObject):
95 self.server = server 98 self.server = server
96 self.error_msg = "" 99 self.error_msg = ""
97 self.initcmd = None 100 self.initcmd = None
101 self.parsing = False
98 102
99 def set_busy(self): 103 def set_busy(self):
100 if not self.generating: 104 if not self.generating:
@@ -207,6 +211,11 @@ class HobHandler(gobject.GObject):
207 formatter = bb.msg.BBLogFormatter() 211 formatter = bb.msg.BBLogFormatter()
208 msg = formatter.format(event) 212 msg = formatter.format(event)
209 self.error_msg += msg + '\n' 213 self.error_msg += msg + '\n'
214 elif event.levelno >= logging.WARNING and self.parsing == True:
215 formatter = bb.msg.BBLogFormatter()
216 msg = formatter.format(event)
217 warn_msg = msg + '\n'
218 self.emit("parsing-warning", warn_msg)
210 219
211 elif isinstance(event, bb.event.TargetsTreeGenerated): 220 elif isinstance(event, bb.event.TargetsTreeGenerated):
212 self.current_phase = "data generation" 221 self.current_phase = "data generation"
@@ -249,6 +258,8 @@ class HobHandler(gobject.GObject):
249 message["total"] = None 258 message["total"] = None
250 message["title"] = "Parsing recipes" 259 message["title"] = "Parsing recipes"
251 self.emit("parsing-started", message) 260 self.emit("parsing-started", message)
261 if isinstance(event, bb.event.ParseStarted):
262 self.parsing = True
252 elif isinstance(event, (bb.event.ParseProgress, 263 elif isinstance(event, (bb.event.ParseProgress,
253 bb.event.CacheLoadProgress, 264 bb.event.CacheLoadProgress,
254 bb.event.TreeDataPreparationProgress)): 265 bb.event.TreeDataPreparationProgress)):
@@ -267,6 +278,8 @@ class HobHandler(gobject.GObject):
267 message["total"] = event.total 278 message["total"] = event.total
268 message["title"] = "Parsing recipes" 279 message["title"] = "Parsing recipes"
269 self.emit("parsing-completed", message) 280 self.emit("parsing-completed", message)
281 if isinstance(event, bb.event.ParseCompleted):
282 self.parsing = False
270 elif isinstance(event, bb.event.NetworkTestFailed): 283 elif isinstance(event, bb.event.NetworkTestFailed):
271 self.emit("network-failed") 284 self.emit("network-failed")
272 self.run_next_command() 285 self.run_next_command()
diff --git a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
index b94f35c66d..ff773501b0 100644
--- a/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
+++ b/bitbake/lib/bb/ui/crumbs/imageconfigurationpage.py
@@ -46,6 +46,7 @@ class ImageConfigurationPage (HobPage):
46 # cleared. 46 # cleared.
47 self.machine_combo_changed_by_manual = True 47 self.machine_combo_changed_by_manual = True
48 self.stopping = False 48 self.stopping = False
49 self.warning_shift = 0
49 self.create_visual_elements() 50 self.create_visual_elements()
50 51
51 def create_visual_elements(self): 52 def create_visual_elements(self):
@@ -141,6 +142,37 @@ class ImageConfigurationPage (HobPage):
141 if self.builder.recipe_model.get_selected_image() == self.builder.recipe_model.__custom_image__: 142 if self.builder.recipe_model.get_selected_image() == self.builder.recipe_model.__custom_image__:
142 self.just_bake_button.hide() 143 self.just_bake_button.hide()
143 144
145 def add_warnings_bar(self):
146 #create the warnings bar shown when recipes parsing generates warnings
147 color = HobColors.KHAKI
148 warnings_bar = gtk.EventBox()
149 warnings_bar.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
150 warnings_bar.set_flags(gtk.CAN_DEFAULT)
151 warnings_bar.grab_default()
152
153 build_stop_tab = gtk.Table(10, 20, True)
154 warnings_bar.add(build_stop_tab)
155
156 icon = gtk.Image()
157 icon_pix_buffer = gtk.gdk.pixbuf_new_from_file(hic.ICON_INDI_ALERT_FILE)
158 icon.set_from_pixbuf(icon_pix_buffer)
159 build_stop_tab.attach(icon, 0, 2, 0, 10)
160
161 label = gtk.Label()
162 label.set_alignment(0.0, 0.5)
163 warnings_nb = len(self.builder.parsing_warnings)
164 if warnings_nb == 1:
165 label.set_markup("<span size='x-large'><b>1 recipe parsing warning</b></span>")
166 else:
167 label.set_markup("<span size='x-large'><b>%s recipe parsing warnings</b></span>" % warnings_nb)
168 build_stop_tab.attach(label, 2, 12, 0, 10)
169
170 view_warnings_button = HobButton("View warnings")
171 view_warnings_button.connect('clicked', self.view_warnings_button_clicked_cb)
172 build_stop_tab.attach(view_warnings_button, 15, 19, 1, 9)
173
174 return warnings_bar
175
144 def create_config_machine(self): 176 def create_config_machine(self):
145 self.machine_title = gtk.Label() 177 self.machine_title = gtk.Label()
146 self.machine_title.set_alignment(0.0, 0.5) 178 self.machine_title.set_alignment(0.0, 0.5)
@@ -187,6 +219,12 @@ class ImageConfigurationPage (HobPage):
187 #self.gtable.attach(self.progress_box, 0, 40, 15, 18) 219 #self.gtable.attach(self.progress_box, 0, 40, 15, 18)
188 self.gtable.attach(self.progress_bar, 0, 37, 15, 18) 220 self.gtable.attach(self.progress_bar, 0, 37, 15, 18)
189 self.gtable.attach(self.stop_button, 37, 40, 15, 18, 0, 0) 221 self.gtable.attach(self.stop_button, 37, 40, 15, 18, 0, 0)
222 if self.builder.parsing_warnings:
223 self.warnings_bar = self.add_warnings_bar()
224 self.gtable.attach(self.warnings_bar, 0, 40, 14, 18)
225 self.warning_shift = 4
226 else:
227 self.warning_shift = 0
190 self.gtable.attach(self.machine_separator, 0, 40, 13, 14) 228 self.gtable.attach(self.machine_separator, 0, 40, 13, 14)
191 229
192 def create_config_baseimg(self): 230 def create_config_baseimg(self):
@@ -222,12 +260,12 @@ class ImageConfigurationPage (HobPage):
222 self.image_separator = gtk.HSeparator() 260 self.image_separator = gtk.HSeparator()
223 261
224 def set_config_baseimg_layout(self): 262 def set_config_baseimg_layout(self):
225 self.gtable.attach(self.image_title, 0, 40, 15, 17) 263 self.gtable.attach(self.image_title, 0, 40, 15+self.warning_shift, 17+self.warning_shift)
226 self.gtable.attach(self.image_title_desc, 0, 40, 18, 22) 264 self.gtable.attach(self.image_title_desc, 0, 40, 18+self.warning_shift, 22+self.warning_shift)
227 self.gtable.attach(self.image_combo, 0, 12, 23, 26) 265 self.gtable.attach(self.image_combo, 0, 12, 23+self.warning_shift, 26+self.warning_shift)
228 self.gtable.attach(self.image_desc, 0, 12, 27, 33) 266 self.gtable.attach(self.image_desc, 0, 12, 27+self.warning_shift, 33+self.warning_shift)
229 self.gtable.attach(self.view_adv_configuration_button, 14, 36, 23, 28) 267 self.gtable.attach(self.view_adv_configuration_button, 14, 36, 23+self.warning_shift, 28+self.warning_shift)
230 self.gtable.attach(self.image_separator, 0, 40, 35, 36) 268 self.gtable.attach(self.image_separator, 0, 40, 35+self.warning_shift, 36+self.warning_shift)
231 269
232 def create_config_build_button(self): 270 def create_config_build_button(self):
233 # Create the "Build packages" and "Build image" buttons at the bottom 271 # Create the "Build packages" and "Build image" buttons at the bottom
@@ -255,6 +293,9 @@ class ImageConfigurationPage (HobPage):
255 self.progress_bar.set_rcstyle("stop") 293 self.progress_bar.set_rcstyle("stop")
256 self.builder.cancel_parse_sync() 294 self.builder.cancel_parse_sync()
257 295
296 def view_warnings_button_clicked_cb(self, button):
297 self.builder.show_warning_dialog()
298
258 def machine_combo_changed_cb(self, machine_combo): 299 def machine_combo_changed_cb(self, machine_combo):
259 self.stopping = False 300 self.stopping = False
260 combo_item = machine_combo.get_active_text() 301 combo_item = machine_combo.get_active_text()
@@ -435,6 +476,7 @@ class ImageConfigurationPage (HobPage):
435 self.builder.reparse_post_adv_settings() 476 self.builder.reparse_post_adv_settings()
436 477
437 def just_bake_button_clicked_cb(self, button): 478 def just_bake_button_clicked_cb(self, button):
479 self.builder.parsing_warnings = []
438 self.builder.just_bake() 480 self.builder.just_bake()
439 481
440 def edit_image_button_clicked_cb(self, button): 482 def edit_image_button_clicked_cb(self, button):
diff --git a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
index 1868ebeddd..b879cc55db 100755
--- a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
@@ -185,6 +185,7 @@ class PackageSelectionPage (HobPage):
185 self.show_all() 185 self.show_all()
186 186
187 def build_image_clicked_cb(self, button): 187 def build_image_clicked_cb(self, button):
188 self.builder.parsing_warnings = []
188 self.builder.build_image() 189 self.builder.build_image()
189 190
190 def back_button_clicked_cb(self, button): 191 def back_button_clicked_cb(self, button):