summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2021-11-02 17:02:45 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-03 12:30:51 +0000
commitfb2300c144bde40bec766aafbc72d1cfdf793af7 (patch)
tree0cb6e07a8cfc08a983c36f30e6fdcb12b64fb3f4 /bitbake
parent1a344c32427d57d5b41c5172e9644718f511f860 (diff)
downloadpoky-fb2300c144bde40bec766aafbc72d1cfdf793af7.tar.gz
bitbake: fetch2: fix downloadfilename issue with premirror
The following commit to fix [Yocto #13039] causes regression of the behavior of PREMIRRORS. "bitbake: fetch2: fix premirror URI when downloadfilename defined" Take meta-openembedded/meta-networking/recipes-protocols/freediameter/freediameter_1.4.0.bb as an example. SRC_URI = "\ http://www.freediameter.net/hg/${fd_pkgname}/archive/${PV}.tar.gz;downloadfilename=${fd_pkgname}-${PV}.tar.gz \ ... " With the above commit, it now tries to fetch 1.4.0.tar.gz instead of freeDiameter-1.4.0.tar.gz. This makes https://downloads.yoctoproject.org/mirror/sources not work for freediameter, as it holds freeDiameter-1.4.0.tar.gz. The commit above tries to avoid fetching from invalid url such as: https://<some_mirror>/1.4.0.tar.gz/freeDiameter-1.4.0.tar.gz. And its solution is to make basename to be 1.4.0.tar.gz, thus causing the regression. This patch fixes the above regression. For Yocto #13039, it now tries to fetch from url: https://<some_mirror>/freeDiameter-1.4.0.tar.gz. (Bitbake rev: 78949cf3fd31d8a408e93af7e27bcf26ae7942f4) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 96c30007dc0b32eee2b15771daec7948bc9bfd97) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 259b2637a6..8078991d71 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -466,9 +466,13 @@ def uri_replace(ud, uri_find, uri_replace, replacements, d, mirrortarball=None):
466 # Kill parameters, they make no sense for mirror tarballs 466 # Kill parameters, they make no sense for mirror tarballs
467 uri_decoded[5] = {} 467 uri_decoded[5] = {}
468 elif ud.localpath and ud.method.supports_checksum(ud): 468 elif ud.localpath and ud.method.supports_checksum(ud):
469 basename = os.path.basename(uri_decoded[loc]) 469 basename = os.path.basename(ud.localpath)
470 if basename and not result_decoded[loc].endswith(basename): 470 if basename:
471 result_decoded[loc] = os.path.join(result_decoded[loc], basename) 471 uri_basename = os.path.basename(uri_decoded[loc])
472 if basename != uri_basename and result_decoded[loc].endswith(uri_basename):
473 result_decoded[loc] = result_decoded[loc].replace(uri_basename, basename)
474 elif not result_decoded[loc].endswith(basename):
475 result_decoded[loc] = os.path.join(result_decoded[loc], basename)
472 else: 476 else:
473 return None 477 return None
474 result = encodeurl(result_decoded) 478 result = encodeurl(result_decoded)