summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py39
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py111
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobeventhandler.py32
3 files changed, 171 insertions, 11 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 93b8fd0d17..2af14dc6ef 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -68,6 +68,16 @@ class Configuration:
68 self.selected_recipes = [] 68 self.selected_recipes = []
69 self.selected_packages = [] 69 self.selected_packages = []
70 70
71 # proxy settings
72 self.all_proxy = params["all_proxy"]
73 self.http_proxy = params["http_proxy"]
74 self.ftp_proxy = params["ftp_proxy"]
75 self.https_proxy = params["https_proxy"]
76 self.git_proxy_host = params["git_proxy_host"]
77 self.git_proxy_port = params["git_proxy_port"]
78 self.cvs_proxy_host = params["cvs_proxy_host"]
79 self.cvs_proxy_port = params["cvs_proxy_port"]
80
71 def load(self, template): 81 def load(self, template):
72 self.curr_mach = template.getVar("MACHINE") 82 self.curr_mach = template.getVar("MACHINE")
73 self.curr_package_format = " ".join(template.getVar("PACKAGE_CLASSES").split("package_")).strip() 83 self.curr_package_format = " ".join(template.getVar("PACKAGE_CLASSES").split("package_")).strip()
@@ -93,6 +103,15 @@ class Configuration:
93 self.selected_image = template.getVar("__SELECTED_IMAGE__") 103 self.selected_image = template.getVar("__SELECTED_IMAGE__")
94 self.selected_recipes = template.getVar("DEPENDS").split() 104 self.selected_recipes = template.getVar("DEPENDS").split()
95 self.selected_packages = template.getVar("IMAGE_INSTALL").split() 105 self.selected_packages = template.getVar("IMAGE_INSTALL").split()
106 # proxy
107 self.all_proxy = template.getVar("all_proxy")
108 self.http_proxy = template.getVar("http_proxy")
109 self.ftp_proxy = template.getVar("ftp_proxy")
110 self.https_proxy = template.getVar("https_proxy")
111 self.git_proxy_host = template.getVar("GIT_PROXY_HOST")
112 self.git_proxy_port = template.getVar("GIT_PROXY_PORT")
113 self.cvs_proxy_host = template.getVar("CVS_PROXY_HOST")
114 self.cvs_proxy_port = template.getVar("CVS_PROXY_PORT")
96 115
97 def save(self, template, filename): 116 def save(self, template, filename):
98 # bblayers.conf 117 # bblayers.conf
@@ -120,6 +139,15 @@ class Configuration:
120 template.setVar("__SELECTED_IMAGE__", self.selected_image) 139 template.setVar("__SELECTED_IMAGE__", self.selected_image)
121 template.setVar("DEPENDS", self.selected_recipes) 140 template.setVar("DEPENDS", self.selected_recipes)
122 template.setVar("IMAGE_INSTALL", self.selected_packages) 141 template.setVar("IMAGE_INSTALL", self.selected_packages)
142 # proxy
143 template.setVar("all_proxy", self.all_proxy)
144 template.setVar("http_proxy", self.http_proxy)
145 template.setVar("ftp_proxy", self.ftp_proxy)
146 template.setVar("https_proxy", self.https_proxy)
147 template.setVar("GIT_PROXY_HOST", self.git_proxy_host)
148 template.setVar("GIT_PROXY_PORT", self.git_proxy_port)
149 template.setVar("CVS_PROXY_HOST", self.cvs_proxy_host)
150 template.setVar("CVS_PROXY_PORT", self.cvs_proxy_port)
123 151
124class Parameters: 152class Parameters:
125 '''Represents other variables like available machines, etc.''' 153 '''Represents other variables like available machines, etc.'''
@@ -146,6 +174,7 @@ class Parameters:
146 self.tune_pkgarch = params["tune_pkgarch"] 174 self.tune_pkgarch = params["tune_pkgarch"]
147 self.bb_version = params["bb_version"] 175 self.bb_version = params["bb_version"]
148 self.tune_arch = params["tune_arch"] 176 self.tune_arch = params["tune_arch"]
177 self.enable_proxy = False
149 178
150class Builder(gtk.Window): 179class Builder(gtk.Window):
151 180
@@ -373,6 +402,14 @@ class Builder(gtk.Window):
373 self.handler.set_image_fstypes(self.configuration.image_fstypes) 402 self.handler.set_image_fstypes(self.configuration.image_fstypes)
374 self.handler.set_extra_config(self.configuration.extra_setting) 403 self.handler.set_extra_config(self.configuration.extra_setting)
375 self.handler.set_extra_inherit("packageinfo") 404 self.handler.set_extra_inherit("packageinfo")
405 # set proxies
406 if self.parameters.enable_proxy:
407 self.handler.set_http_proxy(self.configuration.http_proxy)
408 self.handler.set_https_proxy(self.configuration.https_proxy)
409 self.handler.set_ftp_proxy(self.configuration.ftp_proxy)
410 self.handler.set_all_proxy(self.configuration.all_proxy)
411 self.handler.set_git_proxy(self.configuration.git_proxy_host, self.configuration.git_proxy_port)
412 self.handler.set_cvs_proxy(self.configuration.cvs_proxy_host, self.configuration.cvs_proxy_port)
376 413
377 def update_recipe_model(self, selected_image, selected_recipes): 414 def update_recipe_model(self, selected_image, selected_recipes):
378 self.recipe_model.set_selected_image(selected_image) 415 self.recipe_model.set_selected_image(selected_image)
@@ -773,6 +810,7 @@ class Builder(gtk.Window):
773 all_distros = self.parameters.all_distros, 810 all_distros = self.parameters.all_distros,
774 all_sdk_machines = self.parameters.all_sdk_machines, 811 all_sdk_machines = self.parameters.all_sdk_machines,
775 max_threads = self.parameters.max_threads, 812 max_threads = self.parameters.max_threads,
813 enable_proxy = self.parameters.enable_proxy,
776 parent = self, 814 parent = self,
777 flags = gtk.DIALOG_MODAL 815 flags = gtk.DIALOG_MODAL
778 | gtk.DIALOG_DESTROY_WITH_PARENT 816 | gtk.DIALOG_DESTROY_WITH_PARENT
@@ -783,6 +821,7 @@ class Builder(gtk.Window):
783 HobButton.style_button(button) 821 HobButton.style_button(button)
784 response = dialog.run() 822 response = dialog.run()
785 if response == gtk.RESPONSE_YES: 823 if response == gtk.RESPONSE_YES:
824 self.parameters.enable_proxy = dialog.enable_proxy
786 self.configuration = dialog.configuration 825 self.configuration = dialog.configuration
787 # DO reparse recipes 826 # DO reparse recipes
788 if dialog.settings_changed: 827 if dialog.settings_changed:
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 772f78eac5..4753c92d2a 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -147,20 +147,23 @@ class AdvancedSettingDialog (CrumbsDialog):
147 147
148 dialog.destroy() 148 dialog.destroy()
149 149
150 def gen_entry_widget(self, content, parent, tooltip=""): 150 def gen_entry_widget(self, content, parent, tooltip="", need_button=True):
151 hbox = gtk.HBox(False, 12) 151 hbox = gtk.HBox(False, 12)
152 entry = gtk.Entry() 152 entry = gtk.Entry()
153 entry.set_text(content) 153 entry.set_text(content)
154 154
155 table = gtk.Table(1, 10, True) 155 if need_button:
156 hbox.pack_start(table, expand=True, fill=True) 156 table = gtk.Table(1, 10, True)
157 table.attach(entry, 0, 9, 0, 1) 157 hbox.pack_start(table, expand=True, fill=True)
158 image = gtk.Image() 158 table.attach(entry, 0, 9, 0, 1)
159 image.set_from_stock(gtk.STOCK_OPEN,gtk.ICON_SIZE_BUTTON) 159 image = gtk.Image()
160 open_button = gtk.Button() 160 image.set_from_stock(gtk.STOCK_OPEN,gtk.ICON_SIZE_BUTTON)
161 open_button.set_image(image) 161 open_button = gtk.Button()
162 open_button.connect("clicked", self.entry_widget_select_path_cb, parent, entry) 162 open_button.set_image(image)
163 table.attach(open_button, 9, 10, 0, 1) 163 open_button.connect("clicked", self.entry_widget_select_path_cb, parent, entry)
164 table.attach(open_button, 9, 10, 0, 1)
165 else:
166 hbox.pack_start(entry, expand=True, fill=True)
164 167
165 info = HobInfoButton(tooltip, self) 168 info = HobInfoButton(tooltip, self)
166 hbox.pack_start(info, expand=False, fill=False) 169 hbox.pack_start(info, expand=False, fill=False)
@@ -307,7 +310,7 @@ class AdvancedSettingDialog (CrumbsDialog):
307 310
308 def __init__(self, title, configuration, all_image_types, 311 def __init__(self, title, configuration, all_image_types,
309 all_package_formats, all_distros, all_sdk_machines, 312 all_package_formats, all_distros, all_sdk_machines,
310 max_threads, parent, flags, buttons=None): 313 max_threads, enable_proxy, parent, flags, buttons=None):
311 super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons) 314 super(AdvancedSettingDialog, self).__init__(title, parent, flags, buttons)
312 315
313 # class members from other objects 316 # class members from other objects
@@ -318,6 +321,7 @@ class AdvancedSettingDialog (CrumbsDialog):
318 self.all_distros = all_distros 321 self.all_distros = all_distros
319 self.all_sdk_machines = all_sdk_machines 322 self.all_sdk_machines = all_sdk_machines
320 self.max_threads = max_threads 323 self.max_threads = max_threads
324 self.enable_proxy = enable_proxy
321 325
322 # class members for internal use 326 # class members for internal use
323 self.distro_combo = None 327 self.distro_combo = None
@@ -352,6 +356,7 @@ class AdvancedSettingDialog (CrumbsDialog):
352 self.nb.append_page(self.create_image_types_page(), gtk.Label("Image types")) 356 self.nb.append_page(self.create_image_types_page(), gtk.Label("Image types"))
353 self.nb.append_page(self.create_output_page(), gtk.Label("Output")) 357 self.nb.append_page(self.create_output_page(), gtk.Label("Output"))
354 self.nb.append_page(self.create_build_environment_page(), gtk.Label("Build environment")) 358 self.nb.append_page(self.create_build_environment_page(), gtk.Label("Build environment"))
359 self.nb.append_page(self.create_proxy_page(), gtk.Label("Proxies"))
355 self.nb.append_page(self.create_others_page(), gtk.Label("Others")) 360 self.nb.append_page(self.create_others_page(), gtk.Label("Others"))
356 self.nb.set_current_page(0) 361 self.nb.set_current_page(0)
357 self.vbox.pack_start(self.nb, expand=True, fill=True) 362 self.vbox.pack_start(self.nb, expand=True, fill=True)
@@ -492,6 +497,68 @@ class AdvancedSettingDialog (CrumbsDialog):
492 497
493 return advanced_vbox 498 return advanced_vbox
494 499
500 def create_proxy_page(self):
501 advanced_vbox = gtk.VBox(False, 6)
502 advanced_vbox.set_border_width(6)
503
504 sub_vbox = gtk.VBox(False, 6)
505 advanced_vbox.pack_start(sub_vbox, expand=False, fill=False)
506 self.proxy_checkbox = gtk.CheckButton("Enable Proxy")
507 self.proxy_checkbox.set_tooltip_text("Check this box to setup the proxy you specified")
508 self.proxy_checkbox.set_active(self.enable_proxy)
509 self.proxy_checkbox.connect("toggled", self.proxy_checkbox_toggled_cb)
510 sub_vbox.pack_start(self.proxy_checkbox, expand=False, fill=False)
511
512 label = self.gen_label_widget("<span weight=\"bold\">Set all proxy:</span>")
513 tooltip = "Set the all proxy that will be used if the proxy for a URL isn't specified."
514 proxy_widget, self.all_proxy_text = self.gen_entry_widget(self.configuration.all_proxy, self, tooltip, False)
515 self.all_proxy_text.set_editable(self.enable_proxy)
516 self.all_proxy_text.set_sensitive(self.enable_proxy)
517 sub_vbox.pack_start(label, expand=False, fill=False)
518 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
519
520 label = self.gen_label_widget("<span weight=\"bold\">Set http proxy:</span>")
521 tooltip = "Set the http proxy that will be used in do_fetch() source code"
522 proxy_widget, self.http_proxy_text = self.gen_entry_widget(self.configuration.http_proxy, self, tooltip, False)
523 self.http_proxy_text.set_editable(self.enable_proxy)
524 self.http_proxy_text.set_sensitive(self.enable_proxy)
525 sub_vbox.pack_start(label, expand=False, fill=False)
526 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
527
528 label = self.gen_label_widget("<span weight=\"bold\">Set https proxy:</span>")
529 tooltip = "Set the https proxy that will be used in do_fetch() source code"
530 proxy_widget, self.https_proxy_text = self.gen_entry_widget(self.configuration.https_proxy, self, tooltip, False)
531 self.https_proxy_text.set_editable(self.enable_proxy)
532 self.https_proxy_text.set_sensitive(self.enable_proxy)
533 sub_vbox.pack_start(label, expand=False, fill=False)
534 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
535
536 label = self.gen_label_widget("<span weight=\"bold\">Set ftp proxy:</span>")
537 tooltip = "Set the ftp proxy that will be used in do_fetch() source code"
538 proxy_widget, self.ftp_proxy_text = self.gen_entry_widget(self.configuration.ftp_proxy, self, tooltip, False)
539 self.ftp_proxy_text.set_editable(self.enable_proxy)
540 self.ftp_proxy_text.set_sensitive(self.enable_proxy)
541 sub_vbox.pack_start(label, expand=False, fill=False)
542 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
543
544 label = self.gen_label_widget("<span weight=\"bold\">Set git proxy:</span>")
545 tooltip = "Set the git proxy that will be used in do_fetch() source code"
546 proxy_widget, self.git_proxy_text = self.gen_entry_widget(self.configuration.git_proxy_host + ':' + self.configuration.git_proxy_port, self, tooltip, False)
547 self.git_proxy_text.set_editable(self.enable_proxy)
548 self.git_proxy_text.set_sensitive(self.enable_proxy)
549 sub_vbox.pack_start(label, expand=False, fill=False)
550 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
551
552 label = self.gen_label_widget("<span weight=\"bold\">Set cvs proxy:</span>")
553 tooltip = "Set the cvs proxy that will be used in do_fetch() source code"
554 proxy_widget, self.cvs_proxy_text = self.gen_entry_widget(self.configuration.cvs_proxy_host + ':' + self.configuration.cvs_proxy_port, self, tooltip, False)
555 self.cvs_proxy_text.set_editable(self.enable_proxy)
556 self.cvs_proxy_text.set_sensitive(self.enable_proxy)
557 sub_vbox.pack_start(label, expand=False, fill=False)
558 sub_vbox.pack_start(proxy_widget, expand=False, fill=False)
559
560 return advanced_vbox
561
495 def create_others_page(self): 562 def create_others_page(self):
496 advanced_vbox = gtk.VBox(False, 6) 563 advanced_vbox = gtk.VBox(False, 6)
497 advanced_vbox.set_border_width(6) 564 advanced_vbox.set_border_width(6)
@@ -506,6 +573,21 @@ class AdvancedSettingDialog (CrumbsDialog):
506 573
507 return advanced_vbox 574 return advanced_vbox
508 575
576 def proxy_checkbox_toggled_cb(self, button):
577 self.enable_proxy = self.proxy_checkbox.get_active()
578 self.all_proxy_text.set_editable(self.enable_proxy)
579 self.all_proxy_text.set_sensitive(self.enable_proxy)
580 self.http_proxy_text.set_editable(self.enable_proxy)
581 self.http_proxy_text.set_sensitive(self.enable_proxy)
582 self.https_proxy_text.set_editable(self.enable_proxy)
583 self.https_proxy_text.set_sensitive(self.enable_proxy)
584 self.ftp_proxy_text.set_editable(self.enable_proxy)
585 self.ftp_proxy_text.set_sensitive(self.enable_proxy)
586 self.git_proxy_text.set_editable(self.enable_proxy)
587 self.git_proxy_text.set_sensitive(self.enable_proxy)
588 self.cvs_proxy_text.set_editable(self.enable_proxy)
589 self.cvs_proxy_text.set_sensitive(self.enable_proxy)
590
509 def response_cb(self, dialog, response_id): 591 def response_cb(self, dialog, response_id):
510 self.variables = {} 592 self.variables = {}
511 593
@@ -553,6 +635,13 @@ class AdvancedSettingDialog (CrumbsDialog):
553 self.variables[key] = value 635 self.variables[key] = value
554 it = self.setting_store.iter_next(it) 636 it = self.setting_store.iter_next(it)
555 637
638 self.configuration.all_proxy = self.all_proxy_text.get_text()
639 self.configuration.http_proxy = self.http_proxy_text.get_text()
640 self.configuration.https_proxy = self.https_proxy_text.get_text()
641 self.configuration.ftp_proxy = self.ftp_proxy_text.get_text()
642 self.configuration.git_proxy_host, self.configuration.git_proxy_port = self.git_proxy_text.get_text().split(':')
643 self.configuration.cvs_proxy_host, self.configuration.cvs_proxy_port = self.cvs_proxy_text.get_text().split(':')
644
556 md5 = hashlib.md5(str(sorted(self.variables.items()))).hexdigest() 645 md5 = hashlib.md5(str(sorted(self.variables.items()))).hexdigest()
557 self.settings_changed = (self.md5 != md5) 646 self.settings_changed = (self.md5 != md5)
558 647
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 8583fa49e5..9c5dc771f6 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -313,6 +313,26 @@ class HobHandler(gobject.GObject):
313 value = extra_setting[key] 313 value = extra_setting[key]
314 self.server.runCommand(["setVariable", key, value]) 314 self.server.runCommand(["setVariable", key, value])
315 315
316 def set_http_proxy(self, http_proxy):
317 self.server.runCommand(["setVariable", "http_proxy", http_proxy])
318
319 def set_https_proxy(self, https_proxy):
320 self.server.runCommand(["setVariable", "https_proxy", https_proxy])
321
322 def set_ftp_proxy(self, ftp_proxy):
323 self.server.runCommand(["setVariable", "ftp_proxy", ftp_proxy])
324
325 def set_all_proxy(self, all_proxy):
326 self.server.runCommand(["setVariable", "all_proxy", all_proxy])
327
328 def set_git_proxy(self, host, port):
329 self.server.runCommand(["setVariable", "GIT_PROXY_HOST", host])
330 self.server.runCommand(["setVariable", "GIT_PROXY_PORT", port])
331
332 def set_cvs_proxy(self, host, port):
333 self.server.runCommand(["setVariable", "CVS_PROXY_HOST", host])
334 self.server.runCommand(["setVariable", "CVS_PROXY_PORT", port])
335
316 def request_package_info_async(self): 336 def request_package_info_async(self):
317 self.commands_async.append(self.SUB_GENERATE_PKGINFO) 337 self.commands_async.append(self.SUB_GENERATE_PKGINFO)
318 self.run_next_command(self.POPULATE_PACKAGEINFO) 338 self.run_next_command(self.POPULATE_PACKAGEINFO)
@@ -446,4 +466,16 @@ class HobHandler(gobject.GObject):
446 params["tune_pkgarch"] = self.server.runCommand(["getVariable", "TUNE_PKGARCH"]) or "" 466 params["tune_pkgarch"] = self.server.runCommand(["getVariable", "TUNE_PKGARCH"]) or ""
447 params["bb_version"] = self.server.runCommand(["getVariable", "BB_MIN_VERSION"]) or "" 467 params["bb_version"] = self.server.runCommand(["getVariable", "BB_MIN_VERSION"]) or ""
448 params["tune_arch"] = self.server.runCommand(["getVariable", "TUNE_ARCH"]) or "" 468 params["tune_arch"] = self.server.runCommand(["getVariable", "TUNE_ARCH"]) or ""
469
470 params["git_proxy_host"] = self.server.runCommand(["getVariable", "GIT_PROXY_HOST"]) or ""
471 params["git_proxy_port"] = self.server.runCommand(["getVariable", "GIT_PROXY_PORT"]) or ""
472
473 params["http_proxy"] = self.server.runCommand(["getVariable", "http_proxy"]) or ""
474 params["ftp_proxy"] = self.server.runCommand(["getVariable", "ftp_proxy"]) or ""
475 params["https_proxy"] = self.server.runCommand(["getVariable", "https_proxy"]) or ""
476 params["all_proxy"] = self.server.runCommand(["getVariable", "all_proxy"]) or ""
477
478 params["cvs_proxy_host"] = self.server.runCommand(["getVariable", "CVS_PROXY_HOST"]) or ""
479 params["cvs_proxy_port"] = self.server.runCommand(["getVariable", "CVS_PROXY_PORT"]) or ""
480
449 return params 481 return params