diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-12-06 22:20:11 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-15 22:56:16 +0000 |
commit | 87ef82dead665ea8805ccbab8ef871dc20008701 (patch) | |
tree | a8d9aea61935e52561bf4b4fe3d4a7f7ebe4565b /bitbake/lib | |
parent | d3d9a37aa7addac066762f624ec857d34c57343b (diff) | |
download | poky-87ef82dead665ea8805ccbab8ef871dc20008701.tar.gz |
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 13 |
1 files changed, 7 insertions, 6 deletions
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): | |||
190 | else: | 190 | else: |
191 | result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc]) | 191 | result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc]) |
192 | if uri_find_decoded.index(i) == 2: | 192 | if uri_find_decoded.index(i) == 2: |
193 | basename = None | ||
193 | if ud.mirrortarball: | 194 | if ud.mirrortarball: |
194 | if result_decoded[loc].endswith("/"): | 195 | basename = os.path.basename(ud.localpath) |
195 | result_decoded[loc] = os.path.dirname(result_decoded[loc]) | ||
196 | result_decoded[loc] = os.path.join(result_decoded[loc], os.path.basename(ud.mirrortarball)) | ||
197 | elif ud.localpath: | 196 | elif ud.localpath: |
198 | if result_decoded[loc].endswith("/"): | 197 | basename = os.path.basename(ud.localpath) |
199 | result_decoded[loc] = os.path.dirname(result_decoded[loc]) | 198 | if basename and result_decoded[loc].endswith("/"): |
200 | result_decoded[loc] = os.path.join(result_decoded[loc], os.path.basename(ud.localpath)) | 199 | result_decoded[loc] = os.path.dirname(result_decoded[loc]) |
200 | if basename and not result_decoded[loc].endswith(basename): | ||
201 | result_decoded[loc] = os.path.join(result_decoded[loc], basename) | ||
201 | else: | 202 | else: |
202 | return ud.url | 203 | return ud.url |
203 | result = encodeurl(result_decoded) | 204 | result = encodeurl(result_decoded) |