diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index fb6138b028..557025f701 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -197,6 +197,7 @@ def uri_replace(ud, uri_find, uri_replace, d): uri_decoded = list(decodeurl(ud.url)) uri_find_decoded = list(decodeurl(uri_find)) uri_replace_decoded = list(decodeurl(uri_replace)) + logger.debug(2, "For url %s comparing %s to %s" % (uri_decoded, uri_find_decoded, uri_replace_decoded)) result_decoded = ['', '', '', '', '', {}] for i in uri_find_decoded: loc = uri_find_decoded.index(i) @@ -209,12 +210,18 @@ def uri_replace(ud, uri_find, uri_replace, d): result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc]) if uri_find_decoded.index(i) == 2: if ud.mirrortarball: - result_decoded[loc] = os.path.join(os.path.dirname(result_decoded[loc]), os.path.basename(ud.mirrortarball)) + if result_decoded[loc].endswith("/"): + result_decoded[loc] = os.path.dirname(result_decoded[loc]) + result_decoded[loc] = os.path.join(result_decoded[loc], os.path.basename(ud.mirrortarball)) elif ud.localpath: - result_decoded[loc] = os.path.join(os.path.dirname(result_decoded[loc]), os.path.basename(ud.localpath)) + if result_decoded[loc].endswith("/"): + result_decoded[loc] = os.path.dirname(result_decoded[loc]) + result_decoded[loc] = os.path.join(result_decoded[loc], os.path.basename(ud.localpath)) else: return ud.url - return encodeurl(result_decoded) + result = encodeurl(result_decoded) + logger.debug(2, "For url %s returning %s" % (ud.url, result)) + return result methods = [] urldata_cache = {}