summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorBogdan Marinescu <bogdan.a.marinescu@intel.com>2012-09-26 16:59:57 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-27 16:45:26 +0100
commit7414ba713d2f701b7fcaae3bfc77479a1373d52f (patch)
treee5932b1d0d0d1b58502836a2291e3acfa67dbe48 /bitbake/lib/bb
parent6fdff49d9b37a18221f8d5571f757e69b945e533 (diff)
downloadpoky-7414ba713d2f701b7fcaae3bfc77479a1373d52f.tar.gz
bitbake: Add sanity check progress screen
This patch adds a sanity check progress screen to hob. The screen is displayed when Hob executes the sanity check procedure. The screen is displayed for at least 5 seconds. If a network error is detected, a special dialog is displayed which lets the user open the proxy configuration page directly. Note that currently bitbake triggers the network tests only when the value of its TMPDIR variable changes, which happens fairly rare on my system. This is the subject of another bug (#3026). Version 2 of the patch splits the changes in two parts (sanity.bbclass belongs to oe-core). [YOCTO #3025] (Bitbake rev: b48f1351271cc066ffe919db112b14834a6d8f8f) Signed-off-by: Bogdan Marinescu <bogdan.a.marinescu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/event.py3
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py124
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py5
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py5
4 files changed, 120 insertions, 17 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index deb1c21595..1889d09e1d 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -562,6 +562,7 @@ class SanityCheckFailed(Event):
562 """ 562 """
563 Event to indicate sanity check has failed 563 Event to indicate sanity check has failed
564 """ 564 """
565 def __init__(self, msg): 565 def __init__(self, msg, network_error=False):
566 Event.__init__(self) 566 Event.__init__(self)
567 self._msg = msg 567 self._msg = msg
568 self._network_error = network_error
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 555ba73508..357089d7cb 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -22,7 +22,7 @@
22# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 23
24import glib 24import glib
25import gtk 25import gtk, gobject
26import copy 26import copy
27import os 27import os
28import subprocess 28import subprocess
@@ -36,6 +36,7 @@ from bb.ui.crumbs.recipeselectionpage import RecipeSelectionPage
36from bb.ui.crumbs.packageselectionpage import PackageSelectionPage 36from bb.ui.crumbs.packageselectionpage import PackageSelectionPage
37from bb.ui.crumbs.builddetailspage import BuildDetailsPage 37from bb.ui.crumbs.builddetailspage import BuildDetailsPage
38from bb.ui.crumbs.imagedetailspage import ImageDetailsPage 38from bb.ui.crumbs.imagedetailspage import ImageDetailsPage
39from bb.ui.crumbs.sanitycheckpage import SanityCheckPage
39from bb.ui.crumbs.hobwidget import hwc, HobButton, HobAltButton 40from bb.ui.crumbs.hobwidget import hwc, HobButton, HobAltButton
40from bb.ui.crumbs.hig import CrumbsMessageDialog, ImageSelectionDialog, \ 41from bb.ui.crumbs.hig import CrumbsMessageDialog, ImageSelectionDialog, \
41 AdvancedSettingDialog, SimpleSettingsDialog, \ 42 AdvancedSettingDialog, SimpleSettingsDialog, \
@@ -266,6 +267,22 @@ class Configuration:
266 template.setVar("CVS_PROXY_HOST", self.combine_host_only("cvs")) 267 template.setVar("CVS_PROXY_HOST", self.combine_host_only("cvs"))
267 template.setVar("CVS_PROXY_PORT", self.combine_port_only("cvs")) 268 template.setVar("CVS_PROXY_PORT", self.combine_port_only("cvs"))
268 269
270 def __str__(self):
271 s = "VERSION: '%s', BBLAYERS: '%s', MACHINE: '%s', DISTRO: '%s', DL_DIR: '%s'," % \
272 (hobVer, " ".join(self.layers), self.curr_mach, self.curr_distro, self.dldir )
273 s += "SSTATE_DIR: '%s', SSTATE_MIRROR: '%s', PARALLEL_MAKE: '-j %s', BB_NUMBER_THREADS: '%s', PACKAGE_CLASSES: '%s', " % \
274 (self.sstatedir, self.sstatemirror, self.pmake, self.bbthread, " ".join(["package_" + i for i in self.curr_package_format.split()]))
275 s += "IMAGE_ROOTFS_SIZE: '%s', IMAGE_EXTRA_SPACE: '%s', INCOMPATIBLE_LICENSE: '%s', SDKMACHINE: '%s', CONF_VERSION: '%s', " % \
276 (self.image_rootfs_size, self.image_extra_size, self.incompat_license, self.curr_sdk_machine, self.conf_version)
277 s += "LCONF_VERSION: '%s', EXTRA_SETTING: '%s', TOOLCHAIN_BUILD: '%s', IMAGE_FSTYPES: '%s', __SELECTED_IMAGE__: '%s', " % \
278 (self.lconf_version, self.extra_setting, self.toolchain_build, self.image_fstypes, self.selected_image)
279 s += "DEPENDS: '%s', IMAGE_INSTALL: '%s', enable_proxy: '%s', use_same_proxy: '%s', http_proxy: '%s', " % \
280 (self.selected_recipes, self.user_selected_packages, self.enable_proxy, self.same_proxy, self.combine_proxy("http"))
281 s += "https_proxy: '%s', ftp_proxy: '%s', GIT_PROXY_HOST: '%s', GIT_PROXY_PORT: '%s', CVS_PROXY_HOST: '%s', CVS_PROXY_PORT: '%s'" % \
282 (self.combine_proxy("https"), self.combine_proxy("ftp"),self.combine_host_only("git"), self.combine_port_only("git"),
283 self.combine_host_only("cvs"), self.combine_port_only("cvs"))
284 return s
285
269class Parameters: 286class Parameters:
270 '''Represents other variables like available machines, etc.''' 287 '''Represents other variables like available machines, etc.'''
271 288
@@ -341,7 +358,8 @@ def hob_conf_filter(fn, data):
341 358
342class Builder(gtk.Window): 359class Builder(gtk.Window):
343 360
344 (MACHINE_SELECTION, 361 (INITIAL_CHECKS,
362 MACHINE_SELECTION,
345 RCPPKGINFO_POPULATING, 363 RCPPKGINFO_POPULATING,
346 RCPPKGINFO_POPULATED, 364 RCPPKGINFO_POPULATED,
347 BASEIMG_SELECTED, 365 BASEIMG_SELECTED,
@@ -354,16 +372,18 @@ class Builder(gtk.Window):
354 IMAGE_GENERATED, 372 IMAGE_GENERATED,
355 MY_IMAGE_OPENED, 373 MY_IMAGE_OPENED,
356 BACK, 374 BACK,
357 END_NOOP) = range(14) 375 END_NOOP) = range(15)
358 376
359 (IMAGE_CONFIGURATION, 377 (SANITY_CHECK,
378 IMAGE_CONFIGURATION,
360 RECIPE_DETAILS, 379 RECIPE_DETAILS,
361 BUILD_DETAILS, 380 BUILD_DETAILS,
362 PACKAGE_DETAILS, 381 PACKAGE_DETAILS,
363 IMAGE_DETAILS, 382 IMAGE_DETAILS,
364 END_TAB) = range(6) 383 END_TAB) = range(7)
365 384
366 __step2page__ = { 385 __step2page__ = {
386 INITIAL_CHECKS : SANITY_CHECK,
367 MACHINE_SELECTION : IMAGE_CONFIGURATION, 387 MACHINE_SELECTION : IMAGE_CONFIGURATION,
368 RCPPKGINFO_POPULATING : IMAGE_CONFIGURATION, 388 RCPPKGINFO_POPULATING : IMAGE_CONFIGURATION,
369 RCPPKGINFO_POPULATED : IMAGE_CONFIGURATION, 389 RCPPKGINFO_POPULATED : IMAGE_CONFIGURATION,
@@ -379,6 +399,8 @@ class Builder(gtk.Window):
379 END_NOOP : None, 399 END_NOOP : None,
380 } 400 }
381 401
402 SANITY_CHECK_MIN_DISPLAY_TIME = 5
403
382 def __init__(self, hobHandler, recipe_model, package_model): 404 def __init__(self, hobHandler, recipe_model, package_model):
383 super(Builder, self).__init__() 405 super(Builder, self).__init__()
384 406
@@ -474,9 +496,14 @@ class Builder(gtk.Window):
474 self.build_details_page = BuildDetailsPage(self) 496 self.build_details_page = BuildDetailsPage(self)
475 self.package_details_page = PackageSelectionPage(self) 497 self.package_details_page = PackageSelectionPage(self)
476 self.image_details_page = ImageDetailsPage(self) 498 self.image_details_page = ImageDetailsPage(self)
499 self.sanity_check_page = SanityCheckPage(self)
500 self.display_sanity_check = False
501 self.sanity_check_post_func = False
502 self.had_network_error = False
477 503
478 self.nb = gtk.Notebook() 504 self.nb = gtk.Notebook()
479 self.nb.set_show_tabs(False) 505 self.nb.set_show_tabs(False)
506 self.nb.insert_page(self.sanity_check_page, None, self.SANITY_CHECK)
480 self.nb.insert_page(self.image_configuration_page, None, self.IMAGE_CONFIGURATION) 507 self.nb.insert_page(self.image_configuration_page, None, self.IMAGE_CONFIGURATION)
481 self.nb.insert_page(self.recipe_details_page, None, self.RECIPE_DETAILS) 508 self.nb.insert_page(self.recipe_details_page, None, self.RECIPE_DETAILS)
482 self.nb.insert_page(self.build_details_page, None, self.BUILD_DETAILS) 509 self.nb.insert_page(self.build_details_page, None, self.BUILD_DETAILS)
@@ -487,17 +514,46 @@ class Builder(gtk.Window):
487 self.show_all() 514 self.show_all()
488 self.nb.set_current_page(0) 515 self.nb.set_current_page(0)
489 516
517 def sanity_check_timeout(self):
518 # The minimum time for showing the 'sanity check' page has passe
519 # If someone set the 'sanity_check_post_step' meanwhile, execute it now
520 self.display_sanity_check = False
521 if self.sanity_check_post_func:
522 temp = self.sanity_check_post_func
523 self.sanity_check_post_func = None
524 temp()
525 return False
526
527 def show_sanity_check_page(self):
528 # This window must stay on screen for at least 5 seconds, according to the design document
529 self.nb.set_current_page(self.SANITY_CHECK)
530 self.sanity_check_post_step = None
531 self.display_sanity_check = True
532 self.sanity_check_page.start()
533 gobject.timeout_add(self.SANITY_CHECK_MIN_DISPLAY_TIME * 1000, self.sanity_check_timeout)
534
535 def execute_after_sanity_check(self, func):
536 if not self.display_sanity_check:
537 func()
538 else:
539 sanity_check_post_func = func
540
541 def generate_configuration(self):
542 self.show_sanity_check_page()
543 self.handler.generate_configuration()
544
490 def initiate_new_build_async(self): 545 def initiate_new_build_async(self):
491 self.switch_page(self.MACHINE_SELECTION) 546 self.switch_page(self.MACHINE_SELECTION)
492 if self.load_template(TemplateMgr.convert_to_template_pathfilename("default", ".hob/")) == False: 547 if self.load_template(TemplateMgr.convert_to_template_pathfilename("default", ".hob/")) == False:
548 self.show_sanity_check_page()
493 self.handler.init_cooker() 549 self.handler.init_cooker()
494 self.handler.set_extra_inherit("image_types") 550 self.handler.set_extra_inherit("image_types")
495 self.handler.generate_configuration() 551 self.generate_configuration()
496 552
497 def update_config_async(self): 553 def update_config_async(self):
498 self.switch_page(self.MACHINE_SELECTION) 554 self.switch_page(self.MACHINE_SELECTION)
499 self.set_user_config() 555 self.set_user_config()
500 self.handler.generate_configuration() 556 self.generate_configuration()
501 557
502 def sanity_check(self): 558 def sanity_check(self):
503 self.handler.trigger_sanity_check() 559 self.handler.trigger_sanity_check()
@@ -754,6 +810,15 @@ class Builder(gtk.Window):
754 def handler_package_formats_updated_cb(self, handler, formats): 810 def handler_package_formats_updated_cb(self, handler, formats):
755 self.parameters.all_package_formats = formats 811 self.parameters.all_package_formats = formats
756 812
813 def switch_to_image_configuration_helper(self):
814 self.sanity_check_page.stop()
815 self.switch_page(self.IMAGE_CONFIGURATION)
816 self.image_configuration_page.switch_machine_combo()
817
818 def show_network_error_dialog_helper(self):
819 self.sanity_check_page.stop()
820 self.show_network_error_dialog()
821
757 def handler_command_succeeded_cb(self, handler, initcmd): 822 def handler_command_succeeded_cb(self, handler, initcmd):
758 if initcmd == self.handler.GENERATE_CONFIGURATION: 823 if initcmd == self.handler.GENERATE_CONFIGURATION:
759 if not self.configuration.curr_mach: 824 if not self.configuration.curr_mach:
@@ -761,7 +826,13 @@ class Builder(gtk.Window):
761 self.update_configuration_parameters(self.get_parameters_sync()) 826 self.update_configuration_parameters(self.get_parameters_sync())
762 self.sanity_check() 827 self.sanity_check()
763 elif initcmd == self.handler.SANITY_CHECK: 828 elif initcmd == self.handler.SANITY_CHECK:
764 self.image_configuration_page.switch_machine_combo() 829 if self.had_network_error:
830 self.had_network_error = False
831 self.execute_after_sanity_check(self.show_network_error_dialog_helper)
832 else:
833 # Switch to the 'image configuration' page now, but we might need
834 # to wait for the minimum display time of the sanity check page
835 self.execute_after_sanity_check(self.switch_to_image_configuration_helper)
765 elif initcmd in [self.handler.GENERATE_RECIPES, 836 elif initcmd in [self.handler.GENERATE_RECIPES,
766 self.handler.GENERATE_PACKAGES, 837 self.handler.GENERATE_PACKAGES,
767 self.handler.GENERATE_IMAGE]: 838 self.handler.GENERATE_IMAGE]:
@@ -786,15 +857,40 @@ class Builder(gtk.Window):
786 response = dialog.run() 857 response = dialog.run()
787 dialog.destroy() 858 dialog.destroy()
788 859
860 def show_network_error_dialog(self):
861 lbl = "<b>Hob cannot connect to the network</b>\n"
862 msg = "Please check your network connection. If you are using a proxy server, please make sure it is configured correctly."
863 lbl = lbl + "%s\n\n" % glib.markup_escape_text(msg)
864 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
865 button = dialog.add_button("Close", gtk.RESPONSE_OK)
866 HobButton.style_button(button)
867 button = dialog.add_button("Proxy settings", gtk.RESPONSE_CANCEL)
868 HobButton.style_button(button)
869 res = dialog.run()
870 dialog.destroy()
871 if res == gtk.RESPONSE_CANCEL:
872 res, settings_changed = self.show_simple_settings_dialog(SimpleSettingsDialog.PROXIES_PAGE_ID)
873 if not res:
874 return
875 if settings_changed:
876 self.reparse_post_adv_settings()
877
789 def handler_command_failed_cb(self, handler, msg): 878 def handler_command_failed_cb(self, handler, msg):
790 if msg: 879 if msg:
791 self.show_error_dialog(msg) 880 self.show_error_dialog(msg)
792 self.reset() 881 self.reset()
793 882
794 def handler_sanity_failed_cb(self, handler, msg): 883 def handler_sanity_failed_cb(self, handler, msg, network_error):
795 msg = msg.replace("your local.conf", "Settings")
796 self.show_error_dialog(msg)
797 self.reset() 884 self.reset()
885 if network_error:
886 # Mark this in an internal field. The "network error" dialog will be
887 # shown later, when a SanityCheckPassed event will be handled
888 # (as sent by sanity.bbclass)
889 self.had_network_error = True
890 else:
891 msg = msg.replace("your local.conf", "Settings")
892 self.show_error_dialog(msg)
893 self.reset()
798 894
799 def window_sensitive(self, sensitive): 895 def window_sensitive(self, sensitive):
800 self.image_configuration_page.machine_combo.set_sensitive(sensitive) 896 self.image_configuration_page.machine_combo.set_sensitive(sensitive)
@@ -1171,7 +1267,7 @@ class Builder(gtk.Window):
1171 1267
1172 dialog.destroy() 1268 dialog.destroy()
1173 1269
1174 def show_adv_settings_dialog(self): 1270 def show_adv_settings_dialog(self, tab=None):
1175 dialog = AdvancedSettingDialog(title = "Advanced configuration", 1271 dialog = AdvancedSettingDialog(title = "Advanced configuration",
1176 configuration = copy.deepcopy(self.configuration), 1272 configuration = copy.deepcopy(self.configuration),
1177 all_image_types = self.parameters.image_types, 1273 all_image_types = self.parameters.image_types,
@@ -1196,7 +1292,7 @@ class Builder(gtk.Window):
1196 dialog.destroy() 1292 dialog.destroy()
1197 return response == gtk.RESPONSE_YES, settings_changed 1293 return response == gtk.RESPONSE_YES, settings_changed
1198 1294
1199 def show_simple_settings_dialog(self): 1295 def show_simple_settings_dialog(self, tab=None):
1200 dialog = SimpleSettingsDialog(title = "Settings", 1296 dialog = SimpleSettingsDialog(title = "Settings",
1201 configuration = copy.deepcopy(self.configuration), 1297 configuration = copy.deepcopy(self.configuration),
1202 all_image_types = self.parameters.image_types, 1298 all_image_types = self.parameters.image_types,
@@ -1212,6 +1308,8 @@ class Builder(gtk.Window):
1212 HobAltButton.style_button(button) 1308 HobAltButton.style_button(button)
1213 button = dialog.add_button("Save", gtk.RESPONSE_YES) 1309 button = dialog.add_button("Save", gtk.RESPONSE_YES)
1214 HobButton.style_button(button) 1310 HobButton.style_button(button)
1311 if tab:
1312 dialog.switch_to_page(tab)
1215 response = dialog.run() 1313 response = dialog.run()
1216 settings_changed = False 1314 settings_changed = False
1217 if response == gtk.RESPONSE_YES: 1315 if response == gtk.RESPONSE_YES:
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 778d84331c..f52510c552 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -270,6 +270,9 @@ class CrumbsMessageDialog(CrumbsDialog):
270# 270#
271class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): 271class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
272 272
273 (BUILD_ENV_PAGE_ID,
274 PROXIES_PAGE_ID) = range(2)
275
273 def __init__(self, title, configuration, all_image_types, 276 def __init__(self, title, configuration, all_image_types,
274 all_package_formats, all_distros, all_sdk_machines, 277 all_package_formats, all_distros, all_sdk_machines,
275 max_threads, parent, flags, buttons=None): 278 max_threads, parent, flags, buttons=None):
@@ -624,6 +627,8 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
624 627
625 self.show_all() 628 self.show_all()
626 629
630 def switch_to_page(self, page_id):
631 self.nb.set_current_page(page_id)
627 632
628# 633#
629# AdvancedSettings Dialog 634# AdvancedSettings Dialog
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index ed55acc4fd..e8d7dc2ce2 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -43,7 +43,7 @@ class HobHandler(gobject.GObject):
43 (gobject.TYPE_STRING,)), 43 (gobject.TYPE_STRING,)),
44 "sanity-failed" : (gobject.SIGNAL_RUN_LAST, 44 "sanity-failed" : (gobject.SIGNAL_RUN_LAST,
45 gobject.TYPE_NONE, 45 gobject.TYPE_NONE,
46 (gobject.TYPE_STRING,)), 46 (gobject.TYPE_STRING, gobject.TYPE_INT)),
47 "generating-data" : (gobject.SIGNAL_RUN_LAST, 47 "generating-data" : (gobject.SIGNAL_RUN_LAST,
48 gobject.TYPE_NONE, 48 gobject.TYPE_NONE,
49 ()), 49 ()),
@@ -166,7 +166,6 @@ class HobHandler(gobject.GObject):
166 def handle_event(self, event): 166 def handle_event(self, event):
167 if not event: 167 if not event:
168 return 168 return
169
170 if self.building: 169 if self.building:
171 self.current_phase = "building" 170 self.current_phase = "building"
172 self.build.handle_event(event) 171 self.build.handle_event(event)
@@ -180,7 +179,7 @@ class HobHandler(gobject.GObject):
180 self.run_next_command() 179 self.run_next_command()
181 180
182 elif isinstance(event, bb.event.SanityCheckFailed): 181 elif isinstance(event, bb.event.SanityCheckFailed):
183 self.emit("sanity-failed", event._msg) 182 self.emit("sanity-failed", event._msg, event._network_error)
184 183
185 elif isinstance(event, logging.LogRecord): 184 elif isinstance(event, logging.LogRecord):
186 if not self.building: 185 if not self.building: