mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 12:49:34 +02:00
Hob: allow users to setup the proxies
This patch is to read the proxy variables such as all_proxy, http_proxy, https_proxy, ftp_proxy, GIT_PROXY_HOST, GIT_PROXY_PORT, CVS_PROXY_HOST, and CVS_PROXY_PORT from the bitbake server, show them on the Settings dialog for users to change and set proxies for the build. (From Poky rev: bbef66e4005def54d70d3720ec131fa7edc22e2a) (Bitbake rev: 66c63167cd139706100bfa35eb4ca66c98407615) Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
7990d36f50
commit
8b0bc593b3
@@ -147,20 +147,23 @@ class AdvancedSettingDialog (CrumbsDialog):
|
||||
|
||||
dialog.destroy()
|
||||
|
||||
def gen_entry_widget(self, content, parent, tooltip=""):
|
||||
def gen_entry_widget(self, content, parent, tooltip="", need_button=True):
|
||||
hbox = gtk.HBox(False, 12)
|
||||
entry = gtk.Entry()
|
||||
entry.set_text(content)
|
||||
|
||||
table = gtk.Table(1, 10, True)
|
||||
hbox.pack_start(table, expand=True, fill=True)
|
||||
table.attach(entry, 0, 9, 0, 1)
|
||||
image = gtk.Image()
|
||||
image.set_from_stock(gtk.STOCK_OPEN,gtk.ICON_SIZE_BUTTON)
|
||||
open_button = gtk.Button()
|
||||
open_button.set_image(image)
|
||||
open_button.connect("clicked", self.entry_widget_select_path_cb, parent, entry)
|
||||
table.attach(open_button, 9, 10, 0, 1)
|
||||
if need_button:
|
||||
table = gtk.Table(1, 10, True)
|
||||
hbox.pack_start(table, expand=True, fill=True)
|
||||
table.attach(entry, 0, 9, 0, 1)
|
||||
image = gtk.Image()
|
||||
image.set_from_stock(gtk.STOCK_OPEN,gtk.ICON_SIZE_BUTTON)
|
||||
open_button = gtk.Button()
|
||||
open_button.set_image(image)
|
||||
open_button.connect("clicked", self.entry_widget_select_path_cb, parent, entry)
|
||||
table.attach(open_button, 9, 10, 0, 1)
|
||||
else:
|
||||
hbox.pack_start(entry, expand=True, fill=True)
|
||||
|
||||
info = HobInfoButton(tooltip, self)
|
||||
hbox.pack_start(info, expand=False, fill=False)
|
||||
@@ -307,7 +310,7 @@ class AdvancedSettingDialog (CrumbsDialog):
|
||||
|
||||
def __init__(self, title, configuration, all_image_types,
|
||||
all_package_formats, all_distros, all_sdk_machines,
|
||||
max_threads, parent, flags, buttons=None):
|
||||
max_threads, enable_proxy, parent, flags, buttons=None):
|
||||
super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons)
|
||||
|
||||
# class members from other objects
|
||||
@@ -318,6 +321,7 @@ 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
|
||||
@@ -352,6 +356,7 @@ class AdvancedSettingDialog (CrumbsDialog):
|
||||
self.nb.append_page(self.create_image_types_page(), gtk.Label("Image types"))
|
||||
self.nb.append_page(self.create_output_page(), gtk.Label("Output"))
|
||||
self.nb.append_page(self.create_build_environment_page(), gtk.Label("Build environment"))
|
||||
self.nb.append_page(self.create_proxy_page(), gtk.Label("Proxies"))
|
||||
self.nb.append_page(self.create_others_page(), gtk.Label("Others"))
|
||||
self.nb.set_current_page(0)
|
||||
self.vbox.pack_start(self.nb, expand=True, fill=True)
|
||||
@@ -492,6 +497,68 @@ class AdvancedSettingDialog (CrumbsDialog):
|
||||
|
||||
return advanced_vbox
|
||||
|
||||
def create_proxy_page(self):
|
||||
advanced_vbox = gtk.VBox(False, 6)
|
||||
advanced_vbox.set_border_width(6)
|
||||
|
||||
sub_vbox = gtk.VBox(False, 6)
|
||||
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.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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
sub_vbox.pack_start(label, expand=False, fill=False)
|
||||
sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
|
||||
|
||||
return advanced_vbox
|
||||
|
||||
def create_others_page(self):
|
||||
advanced_vbox = gtk.VBox(False, 6)
|
||||
advanced_vbox.set_border_width(6)
|
||||
@@ -506,6 +573,21 @@ 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)
|
||||
|
||||
def response_cb(self, dialog, response_id):
|
||||
self.variables = {}
|
||||
|
||||
@@ -553,6 +635,13 @@ class AdvancedSettingDialog (CrumbsDialog):
|
||||
self.variables[key] = value
|
||||
it = self.setting_store.iter_next(it)
|
||||
|
||||
self.configuration.all_proxy = self.all_proxy_text.get_text()
|
||||
self.configuration.http_proxy = self.http_proxy_text.get_text()
|
||||
self.configuration.https_proxy = self.https_proxy_text.get_text()
|
||||
self.configuration.ftp_proxy = self.ftp_proxy_text.get_text()
|
||||
self.configuration.git_proxy_host, self.configuration.git_proxy_port = self.git_proxy_text.get_text().split(':')
|
||||
self.configuration.cvs_proxy_host, self.configuration.cvs_proxy_port = self.cvs_proxy_text.get_text().split(':')
|
||||
|
||||
md5 = hashlib.md5(str(sorted(self.variables.items()))).hexdigest()
|
||||
self.settings_changed = (self.md5 != md5)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user