summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBogdan Marinescu <bogdan.a.marinescu@intel.com>2012-09-10 10:42:57 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-10-01 17:13:15 (GMT)
commite7d4eba0a9bc02d61a77129da4be2f0c9239884b (patch)
tree510d20450ed0eafe79f67d1ae0a97e613120c3da
parentaad5c9f6998e036246365595e7e48a804b243e86 (diff)
downloadpoky-e7d4eba0a9bc02d61a77129da4be2f0c9239884b.tar.gz
Save proxy settings
Proxy settings were not properly saved between Hob runs. This fix is mostly a backport of code in master. [YOCTO #3024] Signed-off-by: Bogdan Marinescu <bogdan.a.marinescu@intel.com>
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py18
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py58
2 files changed, 43 insertions, 33 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 870831a..721dd8d 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -71,6 +71,7 @@ class Configuration:
71 self.all_proxy = self.http_proxy = self.ftp_proxy = self.https_proxy = "" 71 self.all_proxy = self.http_proxy = self.ftp_proxy = self.https_proxy = ""
72 self.git_proxy_host = self.git_proxy_port = "" 72 self.git_proxy_host = self.git_proxy_port = ""
73 self.cvs_proxy_host = self.cvs_proxy_port = "" 73 self.cvs_proxy_host = self.cvs_proxy_port = ""
74 self.enable_proxy = None
74 75
75 def clear_selection(self): 76 def clear_selection(self):
76 self.selected_image = None 77 self.selected_image = None
@@ -100,6 +101,9 @@ class Configuration:
100 self.default_task = params["default_task"] 101 self.default_task = params["default_task"]
101 102
102 # proxy settings 103 # proxy settings
104 self.enable_proxy = params["http_proxy"] != "" or params["https_proxy"] != "" or params["ftp_proxy"] != "" \
105 or params["git_proxy_host"] != "" or params["git_proxy_port"] != "" \
106 or params["cvs_proxy_host"] != "" or params["cvs_proxy_port"] != "" or params["all_proxy"] != ""
103 self.all_proxy = params["all_proxy"] 107 self.all_proxy = params["all_proxy"]
104 self.http_proxy = params["http_proxy"] 108 self.http_proxy = params["http_proxy"]
105 self.ftp_proxy = params["ftp_proxy"] 109 self.ftp_proxy = params["ftp_proxy"]
@@ -147,6 +151,7 @@ class Configuration:
147 self.selected_recipes = template.getVar("DEPENDS").split() 151 self.selected_recipes = template.getVar("DEPENDS").split()
148 self.selected_packages = template.getVar("IMAGE_INSTALL").split() 152 self.selected_packages = template.getVar("IMAGE_INSTALL").split()
149 # proxy 153 # proxy
154 self.enable_proxy = eval(template.getVar("enable_proxy"))
150 self.all_proxy = template.getVar("all_proxy") 155 self.all_proxy = template.getVar("all_proxy")
151 self.http_proxy = template.getVar("http_proxy") 156 self.http_proxy = template.getVar("http_proxy")
152 self.ftp_proxy = template.getVar("ftp_proxy") 157 self.ftp_proxy = template.getVar("ftp_proxy")
@@ -184,6 +189,7 @@ class Configuration:
184 template.setVar("DEPENDS", self.selected_recipes) 189 template.setVar("DEPENDS", self.selected_recipes)
185 template.setVar("IMAGE_INSTALL", self.user_selected_packages) 190 template.setVar("IMAGE_INSTALL", self.user_selected_packages)
186 # proxy 191 # proxy
192 template.setVar("enable_proxy", self.enable_proxy)
187 template.setVar("all_proxy", self.all_proxy) 193 template.setVar("all_proxy", self.all_proxy)
188 template.setVar("http_proxy", self.http_proxy) 194 template.setVar("http_proxy", self.http_proxy)
189 template.setVar("ftp_proxy", self.ftp_proxy) 195 template.setVar("ftp_proxy", self.ftp_proxy)
@@ -213,7 +219,6 @@ class Parameters:
213 self.all_sdk_machines = [] 219 self.all_sdk_machines = []
214 self.all_layers = [] 220 self.all_layers = []
215 self.image_names = [] 221 self.image_names = []
216 self.enable_proxy = False
217 222
218 # for build log to show 223 # for build log to show
219 self.bb_version = "" 224 self.bb_version = ""
@@ -582,13 +587,20 @@ class Builder(gtk.Window):
582 self.handler.set_extra_inherit("packageinfo") 587 self.handler.set_extra_inherit("packageinfo")
583 self.handler.set_extra_inherit("image_types") 588 self.handler.set_extra_inherit("image_types")
584 # set proxies 589 # set proxies
585 if self.parameters.enable_proxy: 590 if self.configuration.enable_proxy == True:
586 self.handler.set_http_proxy(self.configuration.http_proxy) 591 self.handler.set_http_proxy(self.configuration.http_proxy)
587 self.handler.set_https_proxy(self.configuration.https_proxy) 592 self.handler.set_https_proxy(self.configuration.https_proxy)
588 self.handler.set_ftp_proxy(self.configuration.ftp_proxy) 593 self.handler.set_ftp_proxy(self.configuration.ftp_proxy)
589 self.handler.set_all_proxy(self.configuration.all_proxy) 594 self.handler.set_all_proxy(self.configuration.all_proxy)
590 self.handler.set_git_proxy(self.configuration.git_proxy_host, self.configuration.git_proxy_port) 595 self.handler.set_git_proxy(self.configuration.git_proxy_host, self.configuration.git_proxy_port)
591 self.handler.set_cvs_proxy(self.configuration.cvs_proxy_host, self.configuration.cvs_proxy_port) 596 self.handler.set_cvs_proxy(self.configuration.cvs_proxy_host, self.configuration.cvs_proxy_port)
597 elif self.configuration.enable_proxy == False:
598 self.handler.set_http_proxy('')
599 self.handler.set_https_proxy('')
600 self.handler.set_ftp_proxy('')
601 self.handler.set_all_proxy('')
602 self.handler.set_git_proxy('', '')
603 self.handler.set_cvs_proxy('', '')
592 604
593 def update_recipe_model(self, selected_image, selected_recipes): 605 def update_recipe_model(self, selected_image, selected_recipes):
594 self.recipe_model.set_selected_image(selected_image) 606 self.recipe_model.set_selected_image(selected_image)
@@ -1010,7 +1022,6 @@ class Builder(gtk.Window):
1010 all_distros = self.parameters.all_distros, 1022 all_distros = self.parameters.all_distros,
1011 all_sdk_machines = self.parameters.all_sdk_machines, 1023 all_sdk_machines = self.parameters.all_sdk_machines,
1012 max_threads = self.parameters.max_threads, 1024 max_threads = self.parameters.max_threads,
1013 enable_proxy = self.parameters.enable_proxy,
1014 parent = self, 1025 parent = self,
1015 flags = gtk.DIALOG_MODAL 1026 flags = gtk.DIALOG_MODAL
1016 | gtk.DIALOG_DESTROY_WITH_PARENT 1027 | gtk.DIALOG_DESTROY_WITH_PARENT
@@ -1022,7 +1033,6 @@ class Builder(gtk.Window):
1022 response = dialog.run() 1033 response = dialog.run()
1023 settings_changed = False 1034 settings_changed = False
1024 if response == gtk.RESPONSE_YES: 1035 if response == gtk.RESPONSE_YES:
1025 self.parameters.enable_proxy = dialog.enable_proxy
1026 self.configuration = dialog.configuration 1036 self.configuration = dialog.configuration
1027 self.save_defaults() # remember settings 1037 self.save_defaults() # remember settings
1028 settings_changed = dialog.settings_changed 1038 settings_changed = dialog.settings_changed
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 4baf960..b6c970b 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -309,7 +309,7 @@ class AdvancedSettingDialog (CrumbsDialog):
309 309
310 def __init__(self, title, configuration, all_image_types, 310 def __init__(self, title, configuration, all_image_types,
311 all_package_formats, all_distros, all_sdk_machines, 311 all_package_formats, all_distros, all_sdk_machines,
312 max_threads, enable_proxy, parent, flags, buttons=None): 312 max_threads, parent, flags, buttons=None):
313 super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons) 313 super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons)
314 314
315 # class members from other objects 315 # class members from other objects
@@ -320,7 +320,6 @@ class AdvancedSettingDialog (CrumbsDialog):
320 self.all_distros = all_distros 320 self.all_distros = all_distros
321 self.all_sdk_machines = all_sdk_machines 321 self.all_sdk_machines = all_sdk_machines
322 self.max_threads = max_threads 322 self.max_threads = max_threads
323 self.enable_proxy = enable_proxy
324 323
325 # class members for internal use 324 # class members for internal use
326 self.distro_combo = None 325 self.distro_combo = None
@@ -356,7 +355,8 @@ class AdvancedSettingDialog (CrumbsDialog):
356 data += ("SDK_MACHINE: " + self._get_sorted_value(self.configuration.curr_sdk_machine)) 355 data += ("SDK_MACHINE: " + self._get_sorted_value(self.configuration.curr_sdk_machine))
357 data += ("TOOLCHAIN_BUILD: " + self._get_sorted_value(self.configuration.toolchain_build)) 356 data += ("TOOLCHAIN_BUILD: " + self._get_sorted_value(self.configuration.toolchain_build))
358 data += ("IMAGE_FSTYPES: " + self._get_sorted_value(self.configuration.image_fstypes)) 357 data += ("IMAGE_FSTYPES: " + self._get_sorted_value(self.configuration.image_fstypes))
359 if self.enable_proxy: 358 data += ("ENABLE_PROXY: " + self._get_sorted_value(self.configuration.enable_proxy))
359 if self.configuration.enable_proxy:
360 data += ("ALL_PROXY: " + self._get_sorted_value(self.configuration.all_proxy)) 360 data += ("ALL_PROXY: " + self._get_sorted_value(self.configuration.all_proxy))
361 data += ("HTTP_PROXY: " + self._get_sorted_value(self.configuration.http_proxy)) 361 data += ("HTTP_PROXY: " + self._get_sorted_value(self.configuration.http_proxy))
362 data += ("HTTPS_PROXY: " + self._get_sorted_value(self.configuration.https_proxy)) 362 data += ("HTTPS_PROXY: " + self._get_sorted_value(self.configuration.https_proxy))
@@ -531,55 +531,55 @@ class AdvancedSettingDialog (CrumbsDialog):
531 advanced_vbox.pack_start(sub_vbox, expand=False, fill=False) 531 advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
532 self.proxy_checkbox = gtk.CheckButton("Enable proxy") 532 self.proxy_checkbox = gtk.CheckButton("Enable proxy")
533 self.proxy_checkbox.set_tooltip_text("Check this box to setup the proxy you specified") 533 self.proxy_checkbox.set_tooltip_text("Check this box to setup the proxy you specified")
534 self.proxy_checkbox.set_active(self.enable_proxy) 534 self.proxy_checkbox.set_active(self.configuration.enable_proxy)
535 self.proxy_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb) 535 self.proxy_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb)
536 sub_vbox.pack_start(self.proxy_checkbox, expand=False, fill=False) 536 sub_vbox.pack_start(self.proxy_checkbox, expand=False, fill=False)
537 537
538 label = self.gen_label_widget("<span weight=\"bold\">Set all proxy:</span>") 538 label = self.gen_label_widget("<span weight=\"bold\">Set all proxy:</span>")
539 tooltip = "Set the all proxy that will be used if the proxy for a URL isn't specified." 539 tooltip = "Set the all proxy that will be used if the proxy for a URL isn't specified."
540 proxy_widget, self.all_proxy_text = self.gen_entry_widget(self.configuration.all_proxy, self, tooltip, False) 540 proxy_widget, self.all_proxy_text = self.gen_entry_widget(self.configuration.all_proxy, self, tooltip, False)
541 self.all_proxy_text.set_editable(self.enable_proxy) 541 self.all_proxy_text.set_editable(self.configuration.enable_proxy)
542 self.all_proxy_text.set_sensitive(self.enable_proxy) 542 self.all_proxy_text.set_sensitive(self.configuration.enable_proxy)
543 sub_vbox.pack_start(label, expand=False, fill=False) 543 sub_vbox.pack_start(label, expand=False, fill=False)
544 sub_vbox.pack_start(proxy_widget, expand=False, fill=False) 544 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
545 545
546 label = self.gen_label_widget("<span weight=\"bold\">Set http proxy:</span>") 546 label = self.gen_label_widget("<span weight=\"bold\">Set http proxy:</span>")
547 tooltip = "Set the http proxy that will be used in do_fetch() source code" 547 tooltip = "Set the http proxy that will be used in do_fetch() source code"
548 proxy_widget, self.http_proxy_text = self.gen_entry_widget(self.configuration.http_proxy, self, tooltip, False) 548 proxy_widget, self.http_proxy_text = self.gen_entry_widget(self.configuration.http_proxy, self, tooltip, False)
549 self.http_proxy_text.set_editable(self.enable_proxy) 549 self.http_proxy_text.set_editable(self.configuration.enable_proxy)
550 self.http_proxy_text.set_sensitive(self.enable_proxy) 550 self.http_proxy_text.set_sensitive(self.configuration.enable_proxy)
551 sub_vbox.pack_start(label, expand=False, fill=False) 551 sub_vbox.pack_start(label, expand=False, fill=False)
552 sub_vbox.pack_start(proxy_widget, expand=False, fill=False) 552 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
553 553
554 label = self.gen_label_widget("<span weight=\"bold\">Set https proxy:</span>") 554 label = self.gen_label_widget("<span weight=\"bold\">Set https proxy:</span>")
555 tooltip = "Set the https proxy that will be used in do_fetch() source code" 555 tooltip = "Set the https proxy that will be used in do_fetch() source code"
556 proxy_widget, self.https_proxy_text = self.gen_entry_widget(self.configuration.https_proxy, self, tooltip, False) 556 proxy_widget, self.https_proxy_text = self.gen_entry_widget(self.configuration.https_proxy, self, tooltip, False)
557 self.https_proxy_text.set_editable(self.enable_proxy) 557 self.https_proxy_text.set_editable(self.configuration.enable_proxy)
558 self.https_proxy_text.set_sensitive(self.enable_proxy) 558 self.https_proxy_text.set_sensitive(self.configuration.enable_proxy)
559 sub_vbox.pack_start(label, expand=False, fill=False) 559 sub_vbox.pack_start(label, expand=False, fill=False)
560 sub_vbox.pack_start(proxy_widget, expand=False, fill=False) 560 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
561 561
562 label = self.gen_label_widget("<span weight=\"bold\">Set ftp proxy:</span>") 562 label = self.gen_label_widget("<span weight=\"bold\">Set ftp proxy:</span>")
563 tooltip = "Set the ftp proxy that will be used in do_fetch() source code" 563 tooltip = "Set the ftp proxy that will be used in do_fetch() source code"
564 proxy_widget, self.ftp_proxy_text = self.gen_entry_widget(self.configuration.ftp_proxy, self, tooltip, False) 564 proxy_widget, self.ftp_proxy_text = self.gen_entry_widget(self.configuration.ftp_proxy, self, tooltip, False)
565 self.ftp_proxy_text.set_editable(self.enable_proxy) 565 self.ftp_proxy_text.set_editable(self.configuration.enable_proxy)
566 self.ftp_proxy_text.set_sensitive(self.enable_proxy) 566 self.ftp_proxy_text.set_sensitive(self.configuration.enable_proxy)
567 sub_vbox.pack_start(label, expand=False, fill=False) 567 sub_vbox.pack_start(label, expand=False, fill=False)
568 sub_vbox.pack_start(proxy_widget, expand=False, fill=False) 568 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
569 569
570 label = self.gen_label_widget("<span weight=\"bold\">Set git proxy:</span>") 570 label = self.gen_label_widget("<span weight=\"bold\">Set git proxy:</span>")
571 tooltip = "Set the git proxy that will be used in do_fetch() source code" 571 tooltip = "Set the git proxy that will be used in do_fetch() source code"
572 proxy_widget, self.git_proxy_text = self.gen_entry_widget(self.configuration.git_proxy_host + ':' + self.configuration.git_proxy_port, self, tooltip, False) 572 proxy_widget, self.git_proxy_text = self.gen_entry_widget(self.configuration.git_proxy_host + ':' + self.configuration.git_proxy_port, self, tooltip, False)
573 self.git_proxy_text.set_editable(self.enable_proxy) 573 self.git_proxy_text.set_editable(self.configuration.enable_proxy)
574 self.git_proxy_text.set_sensitive(self.enable_proxy) 574 self.git_proxy_text.set_sensitive(self.configuration.enable_proxy)
575 sub_vbox.pack_start(label, expand=False, fill=False) 575 sub_vbox.pack_start(label, expand=False, fill=False)
576 sub_vbox.pack_start(proxy_widget, expand=False, fill=False) 576 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
577 577
578 label = self.gen_label_widget("<span weight=\"bold\">Set cvs proxy:</span>") 578 label = self.gen_label_widget("<span weight=\"bold\">Set cvs proxy:</span>")
579 tooltip = "Set the cvs proxy that will be used in do_fetch() source code" 579 tooltip = "Set the cvs proxy that will be used in do_fetch() source code"
580 proxy_widget, self.cvs_proxy_text = self.gen_entry_widget(self.configuration.cvs_proxy_host + ':' + self.configuration.cvs_proxy_port, self, tooltip, False) 580 proxy_widget, self.cvs_proxy_text = self.gen_entry_widget(self.configuration.cvs_proxy_host + ':' + self.configuration.cvs_proxy_port, self, tooltip, False)
581 self.cvs_proxy_text.set_editable(self.enable_proxy) 581 self.cvs_proxy_text.set_editable(self.configuration.enable_proxy)
582 self.cvs_proxy_text.set_sensitive(self.enable_proxy) 582 self.cvs_proxy_text.set_sensitive(self.configuration.enable_proxy)
583 sub_vbox.pack_start(label, expand=False, fill=False) 583 sub_vbox.pack_start(label, expand=False, fill=False)
584 sub_vbox.pack_start(proxy_widget, expand=False, fill=False) 584 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
585 585
@@ -600,19 +600,19 @@ class AdvancedSettingDialog (CrumbsDialog):
600 return advanced_vbox 600 return advanced_vbox
601 601
602 def proxy_checkbox_toggled_cb(self, button): 602 def proxy_checkbox_toggled_cb(self, button):
603 self.enable_proxy = self.proxy_checkbox.get_active() 603 self.configuration.enable_proxy = self.proxy_checkbox.get_active()
604 self.all_proxy_text.set_editable(self.enable_proxy) 604 self.all_proxy_text.set_editable(self.configuration.enable_proxy)
605 self.all_proxy_text.set_sensitive(self.enable_proxy) 605 self.all_proxy_text.set_sensitive(self.configuration.enable_proxy)
606 self.http_proxy_text.set_editable(self.enable_proxy) 606 self.http_proxy_text.set_editable(self.configuration.enable_proxy)
607 self.http_proxy_text.set_sensitive(self.enable_proxy) 607 self.http_proxy_text.set_sensitive(self.configuration.enable_proxy)
608 self.https_proxy_text.set_editable(self.enable_proxy) 608 self.https_proxy_text.set_editable(self.configuration.enable_proxy)
609 self.https_proxy_text.set_sensitive(self.enable_proxy) 609 self.https_proxy_text.set_sensitive(self.configuration.enable_proxy)
610 self.ftp_proxy_text.set_editable(self.enable_proxy) 610 self.ftp_proxy_text.set_editable(self.configuration.enable_proxy)
611 self.ftp_proxy_text.set_sensitive(self.enable_proxy) 611 self.ftp_proxy_text.set_sensitive(self.configuration.enable_proxy)
612 self.git_proxy_text.set_editable(self.enable_proxy) 612 self.git_proxy_text.set_editable(self.configuration.enable_proxy)
613 self.git_proxy_text.set_sensitive(self.enable_proxy) 613 self.git_proxy_text.set_sensitive(self.configuration.enable_proxy)
614 self.cvs_proxy_text.set_editable(self.enable_proxy) 614 self.cvs_proxy_text.set_editable(self.configuration.enable_proxy)
615 self.cvs_proxy_text.set_sensitive(self.enable_proxy) 615 self.cvs_proxy_text.set_sensitive(self.configuration.enable_proxy)
616 616
617 def response_cb(self, dialog, response_id): 617 def response_cb(self, dialog, response_id):
618 package_format = [] 618 package_format = []