summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRudolf J Streif <rudolf.streif@ibeeto.com>2024-06-06 13:17:00 -0700
committerSteve Sakoman <steve@sakoman.com>2024-10-10 12:01:06 -0700
commit8b08aecc806492ca7628d532c07e7d7c5f4b5358 (patch)
treebea5e5232dcba55e7a1a8721914da9b64b680866 /bitbake/lib/bb
parent5a511dadc0f694cb3fa214a3ffd4a2f62bd7aa19 (diff)
downloadpoky-8b08aecc806492ca7628d532c07e7d7c5f4b5358.tar.gz
bitbake: fetch2/wget: Canonicalize DL_DIR paths for wget2 compatibility
Some distributions (namely Fedora Core 40) have started replacing wget with wget2. There are some changes to wget2 that make it incompatible with wget: 1. ftp/ftps is not supported anymore 2. progress 'dot' is not yet supported 3. Relative paths in -P and -O are not correctly dealt with Item 1: Is already dealt with since Scarthgap by only adding the option --passive-ftp when the URL specifies ftp/sftp. While that won't help if ftp/sftp is actually required it at least does not break http/https downloads. Item 2: While not supported it at least does not break the operation. Item 3: If there are relative path components in -P or -O then wget2 only deals with them correctly if there is one, and only one, relative path component at the beginning of the path: -P ./downloads works -P ../downloads works -P ../../downloads does not work -P ./../downloads does not work -P /home/user/downloads/../downloads does not work In cases where there are more than one relative path component at the beginning of the path and/or one or more reltaive path component somewhere in the middle or end of the path, wget2 aborts with the message Internal error: Unexpected relative path: '<path>') Such can happen if DL_DIR includes relative path components e.g. DL_DIR = "${TOPDIR}/../../downloads". This patch canonicalizes DL_DIR before it is passed to wget. (Bitbake rev: 07081a94997142746f7d345c27bc6805231d025d) Signed-off-by: Rudolf J Streif <rudolf.streif@ibeeto.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 3e4208952b086adc510e78c1c5f9cf4550d79dc9) Signed-off-by: Steve Sakoman <steve@sakoman.com> (cherry picked from commit 47678142e26bb76d1351886060deff5e75039bc9) Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 708f3a42e6..3849c8a5a1 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -109,7 +109,8 @@ class Wget(FetchMethod):
109 109
110 fetchcmd = self.basecmd 110 fetchcmd = self.basecmd
111 111
112 localpath = os.path.join(d.getVar("DL_DIR"), ud.localfile) + ".tmp" 112 dldir = os.path.realpath(d.getVar("DL_DIR"))
113 localpath = os.path.join(dldir, ud.localfile) + ".tmp"
113 bb.utils.mkdirhier(os.path.dirname(localpath)) 114 bb.utils.mkdirhier(os.path.dirname(localpath))
114 fetchcmd += " -O %s" % shlex.quote(localpath) 115 fetchcmd += " -O %s" % shlex.quote(localpath)
115 116
@@ -129,9 +130,9 @@ class Wget(FetchMethod):
129 uri = ud.url.split(";")[0] 130 uri = ud.url.split(";")[0]
130 if os.path.exists(ud.localpath): 131 if os.path.exists(ud.localpath):
131 # file exists, but we didnt complete it.. trying again.. 132 # file exists, but we didnt complete it.. trying again..
132 fetchcmd += d.expand(" -c -P ${DL_DIR} '%s'" % uri) 133 fetchcmd += " -c -P " + dldir + " '" + uri + "'"
133 else: 134 else:
134 fetchcmd += d.expand(" -P ${DL_DIR} '%s'" % uri) 135 fetchcmd += " -P " + dldir + " '" + uri + "'"
135 136
136 self._runwget(ud, d, fetchcmd, False) 137 self._runwget(ud, d, fetchcmd, False)
137 138