]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake: Improve proxy handling got wget so urls can be excluded from the proxy
authorRichard Purdie <rpurdie@linux.intel.com>
Tue, 4 Nov 2008 19:13:03 +0000 (19:13 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 4 Nov 2008 19:13:03 +0000 (19:13 +0000)
bitbake-dev/lib/bb/fetch/wget.py
bitbake/lib/bb/fetch/wget.py

index 88193755d158c1dc0e5f61e065d30b96212112d5..75357d539bbfe786d9e1091e7b137e99839e71f0 100644 (file)
@@ -60,11 +60,30 @@ class Wget(Fetch):
             else:
                 fetchcmd = data.getVar("FETCHCOMMAND", d, 1)
 
+            uri = uri.split(";")[0]
+            uri_decoded = list(bb.decodeurl(uri))
+            uri_type = uri_decoded[0]
+            uri_host = uri_decoded[1]
+
             bb.msg.note(1, bb.msg.domain.Fetcher, "fetch " + uri)
-            fetchcmd = fetchcmd.replace("${URI}", uri.split(";")[0])
+            fetchcmd = fetchcmd.replace("${URI}", uri)
             fetchcmd = fetchcmd.replace("${FILE}", ud.basename)
-            httpproxy = data.getVar("http_proxy", d, True)
-            ftpproxy = data.getVar("ftp_proxy", d, True)
+            httpproxy = None
+            ftpproxy = None
+            if uri_type == 'http':
+                httpproxy = data.getVar("HTTP_PROXY", d, True)
+                httpproxy_ignore = data.getVar("HTTP_PROXY_IGNORE", d, True).split()
+                for p in httpproxy_ignore:
+                    if uri_host.endswith(p):
+                        httpproxy = None
+                        break
+            if uri_type == 'ftp':
+                ftpproxy = data.getVar("FTP_PROXY", d, True)
+                ftpproxy_ignore = data.getVar("HTTP_PROXY_IGNORE", d, True).split()
+                for p in ftpproxy_ignore:
+                    if uri_host.endswith(p):
+                        ftpproxy = None
+                        break
             if httpproxy:
                 fetchcmd = "http_proxy=" + httpproxy + " " + fetchcmd
             if ftpproxy:
index 88193755d158c1dc0e5f61e065d30b96212112d5..75357d539bbfe786d9e1091e7b137e99839e71f0 100644 (file)
@@ -60,11 +60,30 @@ class Wget(Fetch):
             else:
                 fetchcmd = data.getVar("FETCHCOMMAND", d, 1)
 
+            uri = uri.split(";")[0]
+            uri_decoded = list(bb.decodeurl(uri))
+            uri_type = uri_decoded[0]
+            uri_host = uri_decoded[1]
+
             bb.msg.note(1, bb.msg.domain.Fetcher, "fetch " + uri)
-            fetchcmd = fetchcmd.replace("${URI}", uri.split(";")[0])
+            fetchcmd = fetchcmd.replace("${URI}", uri)
             fetchcmd = fetchcmd.replace("${FILE}", ud.basename)
-            httpproxy = data.getVar("http_proxy", d, True)
-            ftpproxy = data.getVar("ftp_proxy", d, True)
+            httpproxy = None
+            ftpproxy = None
+            if uri_type == 'http':
+                httpproxy = data.getVar("HTTP_PROXY", d, True)
+                httpproxy_ignore = data.getVar("HTTP_PROXY_IGNORE", d, True).split()
+                for p in httpproxy_ignore:
+                    if uri_host.endswith(p):
+                        httpproxy = None
+                        break
+            if uri_type == 'ftp':
+                ftpproxy = data.getVar("FTP_PROXY", d, True)
+                ftpproxy_ignore = data.getVar("HTTP_PROXY_IGNORE", d, True).split()
+                for p in ftpproxy_ignore:
+                    if uri_host.endswith(p):
+                        ftpproxy = None
+                        break
             if httpproxy:
                 fetchcmd = "http_proxy=" + httpproxy + " " + fetchcmd
             if ftpproxy: