summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py32
1 files changed, 13 insertions, 19 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 24ffd22186..f86047a93e 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -184,7 +184,7 @@ class Wget(FetchMethod):
184 # request. 184 # request.
185 185
186 # Don't close connection when connection_cache is enabled, 186 # Don't close connection when connection_cache is enabled,
187 if fetch.connection_cache is None: 187 if fetch.connection_cache is None:
188 headers["Connection"] = "close" 188 headers["Connection"] = "close"
189 else: 189 else:
190 headers["Connection"] = "Keep-Alive" # Works for HTTP/1.0 190 headers["Connection"] = "Keep-Alive" # Works for HTTP/1.0
@@ -270,17 +270,16 @@ class Wget(FetchMethod):
270 fp.read() 270 fp.read()
271 fp.close() 271 fp.close()
272 272
273 newheaders = dict((k,v) for k,v in list(req.headers.items()) 273 newheaders = dict((k, v) for k, v in list(req.headers.items())
274 if k.lower() not in ("content-length", "content-type")) 274 if k.lower() not in ("content-length", "content-type"))
275 return self.parent.open(urllib.request.Request(req.get_full_url(), 275 return self.parent.open(urllib.request.Request(req.get_full_url(),
276 headers=newheaders, 276 headers=newheaders,
277 origin_req_host=req.origin_req_host, 277 origin_req_host=req.origin_req_host,
278 unverifiable=True)) 278 unverifiable=True))
279 279
280 """ 280
281 Some servers (e.g. GitHub archives, hosted on Amazon S3) return 403 281 # Some servers (e.g. GitHub archives, hosted on Amazon S3) return 403
282 Forbidden when they actually mean 405 Method Not Allowed. 282 # Forbidden when they actually mean 405 Method Not Allowed.
283 """
284 http_error_403 = http_error_405 283 http_error_403 = http_error_405
285 284
286 285
@@ -299,7 +298,7 @@ class Wget(FetchMethod):
299 if exported_proxies: 298 if exported_proxies:
300 handlers.append(urllib.request.ProxyHandler()) 299 handlers.append(urllib.request.ProxyHandler())
301 handlers.append(CacheHTTPHandler()) 300 handlers.append(CacheHTTPHandler())
302 # XXX: Since Python 2.7.9 ssl cert validation is enabled by default 301 # Since Python 2.7.9 ssl cert validation is enabled by default
303 # see PEP-0476, this causes verification errors on some https servers 302 # see PEP-0476, this causes verification errors on some https servers
304 # so disable by default. 303 # so disable by default.
305 import ssl 304 import ssl
@@ -318,7 +317,7 @@ class Wget(FetchMethod):
318 '''Adds Basic auth to http request, pass in login:password as string''' 317 '''Adds Basic auth to http request, pass in login:password as string'''
319 import base64 318 import base64
320 encodeuser = base64.b64encode(login_str.encode('utf-8')).decode("utf-8") 319 encodeuser = base64.b64encode(login_str.encode('utf-8')).decode("utf-8")
321 authheader = "Basic %s" % encodeuser 320 authheader = "Basic %s" % encodeuser
322 r.add_header("Authorization", authheader) 321 r.add_header("Authorization", authheader)
323 322
324 if ud.user and ud.pswd: 323 if ud.user and ud.pswd:
@@ -330,7 +329,7 @@ class Wget(FetchMethod):
330 login, unused, password = n.authenticators(urllib.parse.urlparse(uri).hostname) 329 login, unused, password = n.authenticators(urllib.parse.urlparse(uri).hostname)
331 add_basic_auth("%s:%s" % (login, password), r) 330 add_basic_auth("%s:%s" % (login, password), r)
332 except (TypeError, ImportError, IOError, netrc.NetrcParseError): 331 except (TypeError, ImportError, IOError, netrc.NetrcParseError):
333 pass 332 pass
334 333
335 with opener.open(r) as response: 334 with opener.open(r) as response:
336 pass 335 pass
@@ -395,18 +394,14 @@ class Wget(FetchMethod):
395 (oldpn, oldpv, oldsuffix) = old 394 (oldpn, oldpv, oldsuffix) = old
396 (newpn, newpv, newsuffix) = new 395 (newpn, newpv, newsuffix) = new
397 396
398 """ 397 # Check for a new suffix type that we have never heard of before
399 Check for a new suffix type that we have never heard of before 398 if newsuffix:
400 """
401 if (newsuffix):
402 m = self.suffix_regex_comp.search(newsuffix) 399 m = self.suffix_regex_comp.search(newsuffix)
403 if not m: 400 if not m:
404 bb.warn("%s has a possible unknown suffix: %s" % (newpn, newsuffix)) 401 bb.warn("%s has a possible unknown suffix: %s" % (newpn, newsuffix))
405 return False 402 return False
406 403
407 """ 404 # Not our package so ignore it
408 Not our package so ignore it
409 """
410 if oldpn != newpn: 405 if oldpn != newpn:
411 return False 406 return False
412 407
@@ -472,10 +467,9 @@ class Wget(FetchMethod):
472 467
473 return "" 468 return ""
474 469
475 def _check_latest_version_by_dir(self, dirver, package, package_regex, 470 def _check_latest_version_by_dir(self, dirver, package, package_regex, current_version, ud, d):
476 current_version, ud, d):
477 """ 471 """
478 Scan every directory in order to get upstream version. 472 Scan every directory in order to get upstream version.
479 """ 473 """
480 version_dir = ['', '', ''] 474 version_dir = ['', '', '']
481 version = ['', '', ''] 475 version = ['', '', '']