mirror of
https://git.yoctoproject.org/poky
synced 2026-04-20 18:32:12 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
aad5c9f699
commit
e7d4eba0a9
@@ -71,6 +71,7 @@ class Configuration:
|
||||
self.all_proxy = self.http_proxy = self.ftp_proxy = self.https_proxy = ""
|
||||
self.git_proxy_host = self.git_proxy_port = ""
|
||||
self.cvs_proxy_host = self.cvs_proxy_port = ""
|
||||
self.enable_proxy = None
|
||||
|
||||
def clear_selection(self):
|
||||
self.selected_image = None
|
||||
@@ -100,6 +101,9 @@ class Configuration:
|
||||
self.default_task = params["default_task"]
|
||||
|
||||
# proxy settings
|
||||
self.enable_proxy = params["http_proxy"] != "" or params["https_proxy"] != "" or params["ftp_proxy"] != "" \
|
||||
or params["git_proxy_host"] != "" or params["git_proxy_port"] != "" \
|
||||
or params["cvs_proxy_host"] != "" or params["cvs_proxy_port"] != "" or params["all_proxy"] != ""
|
||||
self.all_proxy = params["all_proxy"]
|
||||
self.http_proxy = params["http_proxy"]
|
||||
self.ftp_proxy = params["ftp_proxy"]
|
||||
@@ -147,6 +151,7 @@ class Configuration:
|
||||
self.selected_recipes = template.getVar("DEPENDS").split()
|
||||
self.selected_packages = template.getVar("IMAGE_INSTALL").split()
|
||||
# proxy
|
||||
self.enable_proxy = eval(template.getVar("enable_proxy"))
|
||||
self.all_proxy = template.getVar("all_proxy")
|
||||
self.http_proxy = template.getVar("http_proxy")
|
||||
self.ftp_proxy = template.getVar("ftp_proxy")
|
||||
@@ -184,6 +189,7 @@ class Configuration:
|
||||
template.setVar("DEPENDS", self.selected_recipes)
|
||||
template.setVar("IMAGE_INSTALL", self.user_selected_packages)
|
||||
# proxy
|
||||
template.setVar("enable_proxy", self.enable_proxy)
|
||||
template.setVar("all_proxy", self.all_proxy)
|
||||
template.setVar("http_proxy", self.http_proxy)
|
||||
template.setVar("ftp_proxy", self.ftp_proxy)
|
||||
@@ -213,7 +219,6 @@ class Parameters:
|
||||
self.all_sdk_machines = []
|
||||
self.all_layers = []
|
||||
self.image_names = []
|
||||
self.enable_proxy = False
|
||||
|
||||
# for build log to show
|
||||
self.bb_version = ""
|
||||
@@ -582,13 +587,20 @@ class Builder(gtk.Window):
|
||||
self.handler.set_extra_inherit("packageinfo")
|
||||
self.handler.set_extra_inherit("image_types")
|
||||
# set proxies
|
||||
if self.parameters.enable_proxy:
|
||||
if self.configuration.enable_proxy == True:
|
||||
self.handler.set_http_proxy(self.configuration.http_proxy)
|
||||
self.handler.set_https_proxy(self.configuration.https_proxy)
|
||||
self.handler.set_ftp_proxy(self.configuration.ftp_proxy)
|
||||
self.handler.set_all_proxy(self.configuration.all_proxy)
|
||||
self.handler.set_git_proxy(self.configuration.git_proxy_host, self.configuration.git_proxy_port)
|
||||
self.handler.set_cvs_proxy(self.configuration.cvs_proxy_host, self.configuration.cvs_proxy_port)
|
||||
elif self.configuration.enable_proxy == False:
|
||||
self.handler.set_http_proxy('')
|
||||
self.handler.set_https_proxy('')
|
||||
self.handler.set_ftp_proxy('')
|
||||
self.handler.set_all_proxy('')
|
||||
self.handler.set_git_proxy('', '')
|
||||
self.handler.set_cvs_proxy('', '')
|
||||
|
||||
def update_recipe_model(self, selected_image, selected_recipes):
|
||||
self.recipe_model.set_selected_image(selected_image)
|
||||
@@ -1010,7 +1022,6 @@ class Builder(gtk.Window):
|
||||
all_distros = self.parameters.all_distros,
|
||||
all_sdk_machines = self.parameters.all_sdk_machines,
|
||||
max_threads = self.parameters.max_threads,
|
||||
enable_proxy = self.parameters.enable_proxy,
|
||||
parent = self,
|
||||
flags = gtk.DIALOG_MODAL
|
||||
| gtk.DIALOG_DESTROY_WITH_PARENT
|
||||
@@ -1022,7 +1033,6 @@ class Builder(gtk.Window):
|
||||
response = dialog.run()
|
||||
settings_changed = False
|
||||
if response == gtk.RESPONSE_YES:
|
||||
self.parameters.enable_proxy = dialog.enable_proxy
|
||||
self.configuration = dialog.configuration
|
||||
self.save_defaults() # remember settings
|
||||
settings_changed = dialog.settings_changed
|
||||
|
||||
@@ -309,7 +309,7 @@ class AdvancedSettingDialog (CrumbsDialog):
|
||||
|
||||
def __init__(self, title, configuration, all_image_types,
|
||||
all_package_formats, all_distros, all_sdk_machines,
|
||||
max_threads, enable_proxy, parent, flags, buttons=None):
|
||||
max_threads, parent, flags, buttons=None):
|
||||
super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons)
|
||||
|
||||
# class members from other objects
|
||||
@@ -320,7 +320,6 @@ class AdvancedSettingDialog (CrumbsDialog):
|
||||
self.all_distros = all_distros
|
||||
self.all_sdk_machines = all_sdk_machines
|
||||
self.max_threads = max_threads
|
||||
self.enable_proxy = enable_proxy
|
||||
|
||||
# class members for internal use
|
||||
self.distro_combo = None
|
||||
@@ -356,7 +355,8 @@ class AdvancedSettingDialog (CrumbsDialog):
|
||||
data += ("SDK_MACHINE: " + self._get_sorted_value(self.configuration.curr_sdk_machine))
|
||||
data += ("TOOLCHAIN_BUILD: " + self._get_sorted_value(self.configuration.toolchain_build))
|
||||
data += ("IMAGE_FSTYPES: " + self._get_sorted_value(self.configuration.image_fstypes))
|
||||
if self.enable_proxy:
|
||||
data += ("ENABLE_PROXY: " + self._get_sorted_value(self.configuration.enable_proxy))
|
||||
if self.configuration.enable_proxy:
|
||||
data += ("ALL_PROXY: " + self._get_sorted_value(self.configuration.all_proxy))
|
||||
data += ("HTTP_PROXY: " + self._get_sorted_value(self.configuration.http_proxy))
|
||||
data += ("HTTPS_PROXY: " + self._get_sorted_value(self.configuration.https_proxy))
|
||||
@@ -531,55 +531,55 @@ class AdvancedSettingDialog (CrumbsDialog):
|
||||
advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
|
||||
self.proxy_checkbox = gtk.CheckButton("Enable proxy")
|
||||
self.proxy_checkbox.set_tooltip_text("Check this box to setup the proxy you specified")
|
||||
self.proxy_checkbox.set_active(self.enable_proxy)
|
||||
self.proxy_checkbox.set_active(self.configuration.enable_proxy)
|
||||
self.proxy_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb)
|
||||
sub_vbox.pack_start(self.proxy_checkbox, expand=False, fill=False)
|
||||
|
||||
label = self.gen_label_widget("<span weight=\"bold\">Set all proxy:</span>")
|
||||
tooltip = "Set the all proxy that will be used if the proxy for a URL isn't specified."
|
||||
proxy_widget, self.all_proxy_text = self.gen_entry_widget(self.configuration.all_proxy, self, tooltip, False)
|
||||
self.all_proxy_text.set_editable(self.enable_proxy)
|
||||
self.all_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.all_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.all_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
sub_vbox.pack_start(label, expand=False, fill=False)
|
||||
sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
|
||||
|
||||
label = self.gen_label_widget("<span weight=\"bold\">Set http proxy:</span>")
|
||||
tooltip = "Set the http proxy that will be used in do_fetch() source code"
|
||||
proxy_widget, self.http_proxy_text = self.gen_entry_widget(self.configuration.http_proxy, self, tooltip, False)
|
||||
self.http_proxy_text.set_editable(self.enable_proxy)
|
||||
self.http_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.http_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.http_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
sub_vbox.pack_start(label, expand=False, fill=False)
|
||||
sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
|
||||
|
||||
label = self.gen_label_widget("<span weight=\"bold\">Set https proxy:</span>")
|
||||
tooltip = "Set the https proxy that will be used in do_fetch() source code"
|
||||
proxy_widget, self.https_proxy_text = self.gen_entry_widget(self.configuration.https_proxy, self, tooltip, False)
|
||||
self.https_proxy_text.set_editable(self.enable_proxy)
|
||||
self.https_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.https_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.https_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
sub_vbox.pack_start(label, expand=False, fill=False)
|
||||
sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
|
||||
|
||||
label = self.gen_label_widget("<span weight=\"bold\">Set ftp proxy:</span>")
|
||||
tooltip = "Set the ftp proxy that will be used in do_fetch() source code"
|
||||
proxy_widget, self.ftp_proxy_text = self.gen_entry_widget(self.configuration.ftp_proxy, self, tooltip, False)
|
||||
self.ftp_proxy_text.set_editable(self.enable_proxy)
|
||||
self.ftp_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.ftp_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.ftp_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
sub_vbox.pack_start(label, expand=False, fill=False)
|
||||
sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
|
||||
|
||||
label = self.gen_label_widget("<span weight=\"bold\">Set git proxy:</span>")
|
||||
tooltip = "Set the git proxy that will be used in do_fetch() source code"
|
||||
proxy_widget, self.git_proxy_text = self.gen_entry_widget(self.configuration.git_proxy_host + ':' + self.configuration.git_proxy_port, self, tooltip, False)
|
||||
self.git_proxy_text.set_editable(self.enable_proxy)
|
||||
self.git_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.git_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.git_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
sub_vbox.pack_start(label, expand=False, fill=False)
|
||||
sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
|
||||
|
||||
label = self.gen_label_widget("<span weight=\"bold\">Set cvs proxy:</span>")
|
||||
tooltip = "Set the cvs proxy that will be used in do_fetch() source code"
|
||||
proxy_widget, self.cvs_proxy_text = self.gen_entry_widget(self.configuration.cvs_proxy_host + ':' + self.configuration.cvs_proxy_port, self, tooltip, False)
|
||||
self.cvs_proxy_text.set_editable(self.enable_proxy)
|
||||
self.cvs_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.cvs_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.cvs_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
sub_vbox.pack_start(label, expand=False, fill=False)
|
||||
sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
|
||||
|
||||
@@ -600,19 +600,19 @@ class AdvancedSettingDialog (CrumbsDialog):
|
||||
return advanced_vbox
|
||||
|
||||
def proxy_checkbox_toggled_cb(self, button):
|
||||
self.enable_proxy = self.proxy_checkbox.get_active()
|
||||
self.all_proxy_text.set_editable(self.enable_proxy)
|
||||
self.all_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.http_proxy_text.set_editable(self.enable_proxy)
|
||||
self.http_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.https_proxy_text.set_editable(self.enable_proxy)
|
||||
self.https_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.ftp_proxy_text.set_editable(self.enable_proxy)
|
||||
self.ftp_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.git_proxy_text.set_editable(self.enable_proxy)
|
||||
self.git_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.cvs_proxy_text.set_editable(self.enable_proxy)
|
||||
self.cvs_proxy_text.set_sensitive(self.enable_proxy)
|
||||
self.configuration.enable_proxy = self.proxy_checkbox.get_active()
|
||||
self.all_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.all_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
self.http_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.http_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
self.https_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.https_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
self.ftp_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.ftp_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
self.git_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.git_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
self.cvs_proxy_text.set_editable(self.configuration.enable_proxy)
|
||||
self.cvs_proxy_text.set_sensitive(self.configuration.enable_proxy)
|
||||
|
||||
def response_cb(self, dialog, response_id):
|
||||
package_format = []
|
||||
|
||||
Reference in New Issue
Block a user