summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/builder.py
diff options
context:
space:
mode:
authorBogdan Marinescu <bogdan.a.marinescu@intel.com>2012-10-11 14:45:07 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-10-24 21:13:06 +0100
commit6cc2f06d43fed2b3cdec84cb21bbc45742b2608a (patch)
treeb19c1cf266afeacaf570c279bb45d5ab467f38a3 /bitbake/lib/bb/ui/crumbs/builder.py
parentd93898b2c530681362e42d1b0477fa593a625046 (diff)
downloadpoky-6cc2f06d43fed2b3cdec84cb21bbc45742b2608a.tar.gz
bitbake: event/hob: Add a button for network tests in the proxy settings
This patch allows the user to check the network connectivity in the "Proxy" page ("Settings" dialog) by adding a button which provides this functionality. It also disables retrigerring sanity checks if the proxy values are changed, since now the proxy checks are explicit. Note that this patch depends on a patch in oe-core ("sanity.bbclass: trigger network tests explicitly"). It will not work properly if the patch in oe-core is not merged. [YOCTO #3026] (Bitbake rev: cb1354d29c0be27aee57b9783c724457ef6725fb) 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/ui/crumbs/builder.py')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py47
1 files changed, 29 insertions, 18 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 6ddc5b67fb..44e2aa51fb 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -51,10 +51,10 @@ class Configuration:
51 51
52 @classmethod 52 @classmethod
53 def parse_proxy_string(cls, proxy): 53 def parse_proxy_string(cls, proxy):
54 pattern = "^\s*((http|https|ftp|git|cvs)://)?((\S+):(\S+)@)?(\S+):(\d+)/?" 54 pattern = "^\s*((http|https|ftp|git|cvs)://)?((\S+):(\S+)@)?([^\s:]+)(:(\d+))?/?"
55 match = re.search(pattern, proxy) 55 match = re.search(pattern, proxy)
56 if match: 56 if match:
57 return match.group(2), match.group(4), match.group(5), match.group(6), match.group(7) 57 return match.group(2), match.group(4), match.group(5), match.group(6), match.group(8)
58 else: 58 else:
59 return None, None, None, "", "" 59 return None, None, None, "", ""
60 60
@@ -82,10 +82,10 @@ class Configuration:
82 82
83 @classmethod 83 @classmethod
84 def make_proxy_string(cls, prot, user, passwd, host, port, default_prot=""): 84 def make_proxy_string(cls, prot, user, passwd, host, port, default_prot=""):
85 if host == None or host == "" or port == None or port == "": 85 if host == None or host == "":# or port == None or port == "":
86 return "" 86 return ""
87 87
88 return Configuration.make_host_string(prot, user, passwd, host, default_prot) + ":" + Configuration.make_port_string(port) 88 return Configuration.make_host_string(prot, user, passwd, host, default_prot) + (":" + Configuration.make_port_string(port) if port else "")
89 89
90 def __init__(self): 90 def __init__(self):
91 self.curr_mach = "" 91 self.curr_mach = ""
@@ -746,6 +746,20 @@ class Builder(gtk.Window):
746 self.previous_step = self.current_step 746 self.previous_step = self.current_step
747 self.current_step = next_step 747 self.current_step = next_step
748 748
749 def set_user_config_proxies(self):
750 if self.configuration.enable_proxy == True:
751 self.handler.set_http_proxy(self.configuration.combine_proxy("http"))
752 self.handler.set_https_proxy(self.configuration.combine_proxy("https"))
753 self.handler.set_ftp_proxy(self.configuration.combine_proxy("ftp"))
754 self.handler.set_git_proxy(self.configuration.combine_host_only("git"), self.configuration.combine_port_only("git"))
755 self.handler.set_cvs_proxy(self.configuration.combine_host_only("cvs"), self.configuration.combine_port_only("cvs"))
756 elif self.configuration.enable_proxy == False:
757 self.handler.set_http_proxy("")
758 self.handler.set_https_proxy("")
759 self.handler.set_ftp_proxy("")
760 self.handler.set_git_proxy("", "")
761 self.handler.set_cvs_proxy("", "")
762
749 def set_user_config(self): 763 def set_user_config(self):
750 self.handler.init_cooker() 764 self.handler.init_cooker()
751 # set bb layers 765 # set bb layers
@@ -767,19 +781,7 @@ class Builder(gtk.Window):
767 self.handler.set_extra_config(self.configuration.extra_setting) 781 self.handler.set_extra_config(self.configuration.extra_setting)
768 self.handler.set_extra_inherit("packageinfo") 782 self.handler.set_extra_inherit("packageinfo")
769 self.handler.set_extra_inherit("image_types") 783 self.handler.set_extra_inherit("image_types")
770 # set proxies 784 self.set_user_config_proxies()
771 if self.configuration.enable_proxy == True:
772 self.handler.set_http_proxy(self.configuration.combine_proxy("http"))
773 self.handler.set_https_proxy(self.configuration.combine_proxy("https"))
774 self.handler.set_ftp_proxy(self.configuration.combine_proxy("ftp"))
775 self.handler.set_git_proxy(self.configuration.combine_host_only("git"), self.configuration.combine_port_only("git"))
776 self.handler.set_cvs_proxy(self.configuration.combine_host_only("cvs"), self.configuration.combine_port_only("cvs"))
777 elif self.configuration.enable_proxy == False:
778 self.handler.set_http_proxy("")
779 self.handler.set_https_proxy("")
780 self.handler.set_ftp_proxy("")
781 self.handler.set_git_proxy("", "")
782 self.handler.set_cvs_proxy("", "")
783 785
784 def update_recipe_model(self, selected_image, selected_recipes): 786 def update_recipe_model(self, selected_image, selected_recipes):
785 self.recipe_model.set_selected_image(selected_image) 787 self.recipe_model.set_selected_image(selected_image)
@@ -1310,7 +1312,8 @@ class Builder(gtk.Window):
1310 parent = self, 1312 parent = self,
1311 flags = gtk.DIALOG_MODAL 1313 flags = gtk.DIALOG_MODAL
1312 | gtk.DIALOG_DESTROY_WITH_PARENT 1314 | gtk.DIALOG_DESTROY_WITH_PARENT
1313 | gtk.DIALOG_NO_SEPARATOR) 1315 | gtk.DIALOG_NO_SEPARATOR,
1316 handler = self.handler)
1314 button = dialog.add_button("Cancel", gtk.RESPONSE_NO) 1317 button = dialog.add_button("Cancel", gtk.RESPONSE_NO)
1315 HobAltButton.style_button(button) 1318 HobAltButton.style_button(button)
1316 button = dialog.add_button("Save", gtk.RESPONSE_YES) 1319 button = dialog.add_button("Save", gtk.RESPONSE_YES)
@@ -1323,6 +1326,14 @@ class Builder(gtk.Window):
1323 self.configuration = dialog.configuration 1326 self.configuration = dialog.configuration
1324 self.save_defaults() # remember settings 1327 self.save_defaults() # remember settings
1325 settings_changed = dialog.settings_changed 1328 settings_changed = dialog.settings_changed
1329 if dialog.proxy_settings_changed:
1330 self.set_user_config_proxies()
1331 elif dialog.proxy_test_ran:
1332 # The user might have modified the proxies in the "Proxy"
1333 # tab, which in turn made the proxy settings modify in bb.
1334 # If "Cancel" was pressed, restore the previous proxy
1335 # settings inside bb.
1336 self.set_user_config_proxies()
1326 dialog.destroy() 1337 dialog.destroy()
1327 return response == gtk.RESPONSE_YES, settings_changed 1338 return response == gtk.RESPONSE_YES, settings_changed
1328 1339