summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2024-12-03 20:05:07 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-12-20 16:25:28 +0000
commitc03be6b81ca17df7d710dbc67404f655e007a175 (patch)
tree4dc3aaa639d4d2a710c2b7c670a3683ae6074aaf /bitbake
parente8ab6bc411dc44cae69beebdbdf9ce4af9e47be0 (diff)
downloadpoky-c03be6b81ca17df7d710dbc67404f655e007a175.tar.gz
bitbake: fetch2/wget: correctly construct the target URL in checkstatus()
ud.path has been unescaped (eg %20 is space) but as we're reconstructing a URL we should re-escape it. For example, unzip has a SRC_URI containing "UnZip%206.x%20%28latest%29/UnZip%206.0/unzip60.tar.gz" which then throws exceptions if the unescaped string " (latest)" is used. Also, this code uses the extracted ud.host and ud.path variables. These are unescaped but potentially stale as eg the cargo fetcher subclasses Wget() and reassigns ud.url on construction. Simplify the code by reconstructing a URL from ud.url directly instead of bouncing through intermediate variables that may be wrong or unescaped. (Bitbake rev: c9906bb289dcfd9ae41f10bd5399ccc17a4cc437) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index fcb71246d9..198426065b 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -376,8 +376,8 @@ class Wget(FetchMethod):
376 opener = urllib.request.build_opener(*handlers) 376 opener = urllib.request.build_opener(*handlers)
377 377
378 try: 378 try:
379 uri_base = ud.url.split(";")[0] 379 parts = urllib.parse.urlparse(ud.url.split(";")[0])
380 uri = "{}://{}{}".format(urllib.parse.urlparse(uri_base).scheme, ud.host, ud.path) 380 uri = "{}://{}{}".format(parts.scheme, parts.netloc, parts.path)
381 r = urllib.request.Request(uri) 381 r = urllib.request.Request(uri)
382 r.get_method = lambda: "HEAD" 382 r.get_method = lambda: "HEAD"
383 # Some servers (FusionForge, as used on Alioth) require that the 383 # Some servers (FusionForge, as used on Alioth) require that the