summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index d37174185a..28a3e54c7f 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -473,10 +473,13 @@ def uri_replace(ud, uri_find, uri_replace, replacements, d, mirrortarball=None):
473 basename = os.path.basename(ud.localpath) 473 basename = os.path.basename(ud.localpath)
474 if basename: 474 if basename:
475 uri_basename = os.path.basename(uri_decoded[loc]) 475 uri_basename = os.path.basename(uri_decoded[loc])
476 if uri_basename and basename != uri_basename and result_decoded[loc].endswith(uri_basename): 476 # Prefix with a slash as a sentinel in case
477 result_decoded[loc] = result_decoded[loc].replace(uri_basename, basename) 477 # result_decoded[loc] does not contain one.
478 elif not result_decoded[loc].endswith(basename): 478 path = "/" + result_decoded[loc]
479 result_decoded[loc] = os.path.join(result_decoded[loc], basename) 479 if uri_basename and basename != uri_basename and path.endswith("/" + uri_basename):
480 result_decoded[loc] = path[1:-len(uri_basename)] + basename
481 elif not path.endswith("/" + basename):
482 result_decoded[loc] = os.path.join(path[1:], basename)
480 else: 483 else:
481 return None 484 return None
482 result = encodeurl(result_decoded) 485 result = encodeurl(result_decoded)