From 87ef82dead665ea8805ccbab8ef871dc20008701 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 6 Dec 2011 22:20:11 +0000 Subject: bitbake/fetch: Fix uri_replace We were seeing duplicate endings to urls: DEBUG: For url ['http', 'www.apache.org', '/dist/subversion/subversion-1.7.1.tar.bz2', '', '', {}] comparing ['http', 'www.apache.org', '/dist', '', '', {}] to ['http', 'archive.apache.org', '/dist', '', '', {}] DEBUG: For url http://www.apache.org/dist/subversion/subversion-1.7.1.tar.bz2 returning http://archive.apache.org/dist/subversion/subversion-1.7.1.tar.bz2/subversion-1.7.1.tar.bz2 This patch addresses this by only performing substitutions when really needed. (Bitbake rev: a17473d51f54a9dfb4eeaa5ad516c4851d5ac142) Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'bitbake/lib/bb/fetch2') diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 42fef69c3c..6847873e7b 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -190,14 +190,15 @@ def uri_replace(ud, uri_find, uri_replace, d): else: result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc]) if uri_find_decoded.index(i) == 2: + basename = None if 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)) + basename = os.path.basename(ud.localpath) elif 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)) + basename = os.path.basename(ud.localpath) + if basename and result_decoded[loc].endswith("/"): + result_decoded[loc] = os.path.dirname(result_decoded[loc]) + if basename and not result_decoded[loc].endswith(basename): + result_decoded[loc] = os.path.join(result_decoded[loc], basename) else: return ud.url result = encodeurl(result_decoded) -- cgit v1.2.3-54-g00ecf