Skip to contentSkip to conversation

Hob: add proxy support into Hob

PATCH New Shane Wang 1 participant 2 messages Mar 27, 2012

lore
Share & tools
lore

Shane Wang

author
#0 lore raw

cover Hob: add proxy support into Hob

This patch is to add proxy support into Hob.
So, with that, users can set up http_proxy, ftp_proxy, https_proxy, all_proxy, git proxy and cvs proxy for build.

The following changes since commit d3e0beed9eef53018158c9f999cd20b44629aa61:

guile: Deal with hardcoded path issues (2012-03-27 00:29:00 +0100)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib shane/proxy
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=shane/proxy

Shane Wang (1):
Hob: allow users to setup the proxies

 bitbake/lib/bb/ui/crumbs/builder.py         |   39 +++++++++
 bitbake/lib/bb/ui/crumbs/hig.py             |  111 ++++++++++++++++++++++++---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |   32 ++++++++
 3 files changed, 171 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.6
author
#1 lore raw

PATCH 1/1 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.

---
 bitbake/lib/bb/ui/crumbs/builder.py         |   39 +++++++++
 bitbake/lib/bb/ui/crumbs/hig.py             |  111 ++++++++++++++++++++++++---
 bitbake/lib/bb/ui/crumbs/hobeventhandler.py |   32 ++++++++
 3 files changed, 171 insertions(+), 11 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +39 -0
index f32a066..40aa767 100755
@@ -68,6 +68,16 @@ class Configuration:
         self.selected_recipes = []
         self.selected_packages = []
 
+        # proxy settings
+        self.all_proxy = params["all_proxy"]
+        self.http_proxy = params["http_proxy"]
+        self.ftp_proxy = params["ftp_proxy"]
+        self.https_proxy = params["https_proxy"]
+        self.git_proxy_host = params["git_proxy_host"]
+        self.git_proxy_port = params["git_proxy_port"]
+        self.cvs_proxy_host = params["cvs_proxy_host"]
+        self.cvs_proxy_port = params["cvs_proxy_port"]
+
     def load(self, template):
         self.curr_mach = template.getVar("MACHINE")
         self.curr_package_format = " ".join(template.getVar("PACKAGE_CLASSES").split("package_")).strip()
@@ -93,6 +103,15 @@ class Configuration:
         self.selected_image = template.getVar("__SELECTED_IMAGE__")
         self.selected_recipes = template.getVar("DEPENDS").split()
         self.selected_packages = template.getVar("IMAGE_INSTALL").split()
+        # proxy
+        self.all_proxy = template.getVar("all_proxy")
+        self.http_proxy = template.getVar("http_proxy")
+        self.ftp_proxy = template.getVar("ftp_proxy")
+        self.https_proxy = template.getVar("https_proxy")
+        self.git_proxy_host = template.getVar("GIT_PROXY_HOST")
+        self.git_proxy_port = template.getVar("GIT_PROXY_PORT")
+        self.cvs_proxy_host = template.getVar("CVS_PROXY_HOST")
+        self.cvs_proxy_port = template.getVar("CVS_PROXY_PORT")
 
     def save(self, template, filename):
         # bblayers.conf
@@ -120,6 +139,15 @@ class Configuration:
         template.setVar("__SELECTED_IMAGE__", self.selected_image)
         template.setVar("DEPENDS", self.selected_recipes)
         template.setVar("IMAGE_INSTALL", self.selected_packages)
+        # proxy
+        template.setVar("all_proxy", self.all_proxy)
+        template.setVar("http_proxy", self.http_proxy)
+        template.setVar("ftp_proxy", self.ftp_proxy)
+        template.setVar("https_proxy", self.https_proxy)
+        template.setVar("GIT_PROXY_HOST", self.git_proxy_host)
+        template.setVar("GIT_PROXY_PORT", self.git_proxy_port)
+        template.setVar("CVS_PROXY_HOST", self.cvs_proxy_host)
+        template.setVar("CVS_PROXY_PORT", self.cvs_proxy_port)
 
 class Parameters:
     '''Represents other variables like available machines, etc.'''
@@ -140,6 +168,7 @@ class Parameters:
         self.runnable_machine_patterns = params["runnable_machine_patterns"].split()
         self.deployable_image_types = params["deployable_image_types"].split()
         self.tmpdir = params["tmpdir"]
+        self.enable_proxy = False
 
 class Builder(gtk.Window):
 
@@ -367,6 +396,14 @@ class Builder(gtk.Window):
         self.handler.set_image_fstypes(self.configuration.image_fstypes)
         self.handler.set_extra_config(self.configuration.extra_setting)
         self.handler.set_extra_inherit("packageinfo")
+        # set proxies
+        if self.parameters.enable_proxy:
+            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)
 
     def update_recipe_model(self, selected_image, selected_recipes):
         self.recipe_model.set_selected_image(selected_image)
@@ -753,6 +790,7 @@ 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
@@ -761,6 +799,7 @@ class Builder(gtk.Window):
                        "Save", gtk.RESPONSE_YES))
         response = dialog.run()
         if response == gtk.RESPONSE_YES:
+            self.parameters.enable_proxy = dialog.enable_proxy
             self.configuration = dialog.configuration
             # DO reparse recipes
             if dialog.settings_changed:
bitbake/lib/bb/ui/crumbs/hig.py +100 -11

157 lines not on this page · raw message

bitbake/lib/bb/ui/crumbs/hobeventhandler.py +32 -0
index 8042fbd..8330b00 100644
@@ -313,6 +313,26 @@ class HobHandler(gobject.GObject):
             value = extra_setting[key]
             self.server.runCommand(["setVariable", key, value])
 
+    def set_http_proxy(self, http_proxy):
+        self.server.runCommand(["setVariable", "http_proxy", http_proxy])
+
+    def set_https_proxy(self, https_proxy):
+        self.server.runCommand(["setVariable", "https_proxy", https_proxy])
+
+    def set_ftp_proxy(self, ftp_proxy):
+        self.server.runCommand(["setVariable", "ftp_proxy", ftp_proxy])
+
+    def set_all_proxy(self, all_proxy):
+        self.server.runCommand(["setVariable", "all_proxy", all_proxy])
+
+    def set_git_proxy(self, host, port):
+        self.server.runCommand(["setVariable", "GIT_PROXY_HOST", host])
+        self.server.runCommand(["setVariable", "GIT_PROXY_PORT", port])
+
+    def set_cvs_proxy(self, host, port):
+        self.server.runCommand(["setVariable", "CVS_PROXY_HOST", host])
+        self.server.runCommand(["setVariable", "CVS_PROXY_PORT", port])
+
     def request_package_info_async(self):
         self.commands_async.append(self.SUB_GENERATE_PKGINFO)
         self.run_next_command(self.POPULATE_PACKAGEINFO)
@@ -440,4 +460,16 @@ class HobHandler(gobject.GObject):
         params["runnable_machine_patterns"] = self.server.runCommand(["getVariable", "RUNNABLE_MACHINE_PATTERNS"]) or ""
         params["deployable_image_types"] = self.server.runCommand(["getVariable", "DEPLOYABLE_IMAGE_TYPES"]) or ""
         params["tmpdir"] = self.server.runCommand(["getVariable", "TMPDIR"]) or ""
+
+        params["git_proxy_host"] = self.server.runCommand(["getVariable", "GIT_PROXY_HOST"]) or ""
+        params["git_proxy_port"] = self.server.runCommand(["getVariable", "GIT_PROXY_PORT"]) or ""
+
+        params["http_proxy"] = self.server.runCommand(["getVariable", "http_proxy"]) or ""
+        params["ftp_proxy"] = self.server.runCommand(["getVariable", "ftp_proxy"]) or ""
+        params["https_proxy"] = self.server.runCommand(["getVariable", "https_proxy"]) or ""
+        params["all_proxy"] = self.server.runCommand(["getVariable", "all_proxy"]) or ""
+
+        params["cvs_proxy_host"] = self.server.runCommand(["getVariable", "CVS_PROXY_HOST"]) or ""
+        params["cvs_proxy_port"] = self.server.runCommand(["getVariable", "CVS_PROXY_PORT"]) or ""
+
         return params
Signature · 1 line
1.7.6