summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorAníbal Limón <limon.anibal@gmail.com>2015-07-08 18:34:19 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-12 22:50:43 +0100
commit804f1a2312f85125c83e2dae2af69abdd7ef7681 (patch)
tree5727bc1f3ac853858502ccae51dc3c4f7fa73aa8 /bitbake/lib
parent913631c4666ea3e7a5484ad8340fca44c015c390 (diff)
downloadpoky-804f1a2312f85125c83e2dae2af69abdd7ef7681.tar.gz
bitbake: fetch2/wget.py: checkstatus fix using proxy handler
Only use ProxyHandler opener when exists proxies in env. (Bitbake rev: 0f062c5d99e12ce20c0e46a8e602448032144ff6) Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py20
1 files changed, 16 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 8cb5f2be81..7e90efb4df 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -221,17 +221,29 @@ class Wget(FetchMethod):
221 def export_proxies(d): 221 def export_proxies(d):
222 variables = ['http_proxy', 'HTTP_PROXY', 'https_proxy', 'HTTPS_PROXY', 222 variables = ['http_proxy', 'HTTP_PROXY', 'https_proxy', 'HTTPS_PROXY',
223 'ftp_proxy', 'FTP_PROXY', 'no_proxy', 'NO_PROXY'] 223 'ftp_proxy', 'FTP_PROXY', 'no_proxy', 'NO_PROXY']
224 exported = False
224 225
225 for v in variables: 226 for v in variables:
226 if not v in os.environ.keys(): 227 if v in os.environ.keys():
227 os.environ[v] = d.getVar(v, True) or '' 228 exported = True
229 else:
230 v_proxy = d.getVar(v, True)
231 if v_proxy is not None:
232 os.environ[v] = v_proxy
233 exported = True
234
235 return exported
228 236
229 def head_method(self): 237 def head_method(self):
230 return "HEAD" 238 return "HEAD"
231 239
232 export_proxies(d) 240 exported_proxies = export_proxies(d)
241 if exported_proxies == True:
242 opener = urllib2.build_opener(urllib2.ProxyHandler, CacheHTTPHandler)
243 else:
244 opener = urllib2.build_opener(CacheHTTPHandler)
245
233 urllib2.Request.get_method = head_method 246 urllib2.Request.get_method = head_method
234 opener = urllib2.build_opener(urllib2.ProxyHandler, CacheHTTPHandler)
235 urllib2.install_opener(opener) 247 urllib2.install_opener(opener)
236 248
237 uri = ud.url.split(";")[0] 249 uri = ud.url.split(";")[0]