summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-24 16:11:26 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-24 22:11:45 +0000
commit437928dfa4fdcf6abe4b4eb9ca03fd7db31404a0 (patch)
tree9116c77403e054944f563035a5b7470dbf1416f1 /bitbake/lib/bb/fetch2
parent2d8e5349a3dec405e005dc249d1412bad5a5977b (diff)
downloadpoky-437928dfa4fdcf6abe4b4eb9ca03fd7db31404a0.tar.gz
fetch2: Improve uri_replace to handle paths with no trailing '/'
Currently if you specify a mirror like: file://.* http://linux.freescale.net/yocto/sstate-cache it won't work as you expect whilst: file://.* http://linux.freescale.net/yocto/sstate-cache/ will since it has the trailing slash. This patch handles both cases correctly. It also adds some debug to the uri_replace function since its near impossible to debug it without some kind of output. [YOCTO #1578] (Bitbake rev: a0246bf09c93bb657eaf6ba61d090b247ed33640) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index a055faaf19..d3c761d00d 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -175,6 +175,7 @@ def uri_replace(ud, uri_find, uri_replace, d):
175 uri_decoded = list(decodeurl(ud.url)) 175 uri_decoded = list(decodeurl(ud.url))
176 uri_find_decoded = list(decodeurl(uri_find)) 176 uri_find_decoded = list(decodeurl(uri_find))
177 uri_replace_decoded = list(decodeurl(uri_replace)) 177 uri_replace_decoded = list(decodeurl(uri_replace))
178 logger.debug(2, "For url %s comparing %s to %s" % (uri_decoded, uri_find_decoded, uri_replace_decoded))
178 result_decoded = ['', '', '', '', '', {}] 179 result_decoded = ['', '', '', '', '', {}]
179 for i in uri_find_decoded: 180 for i in uri_find_decoded:
180 loc = uri_find_decoded.index(i) 181 loc = uri_find_decoded.index(i)
@@ -187,12 +188,18 @@ def uri_replace(ud, uri_find, uri_replace, d):
187 result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc]) 188 result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
188 if uri_find_decoded.index(i) == 2: 189 if uri_find_decoded.index(i) == 2:
189 if ud.mirrortarball: 190 if ud.mirrortarball:
190 result_decoded[loc] = os.path.join(os.path.dirname(result_decoded[loc]), os.path.basename(ud.mirrortarball)) 191 if result_decoded[loc].endswith("/"):
192 result_decoded[loc] = os.path.dirname(result_decoded[loc])
193 result_decoded[loc] = os.path.join(result_decoded[loc], os.path.basename(ud.mirrortarball))
191 elif ud.localpath: 194 elif ud.localpath:
192 result_decoded[loc] = os.path.join(os.path.dirname(result_decoded[loc]), os.path.basename(ud.localpath)) 195 if result_decoded[loc].endswith("/"):
196 result_decoded[loc] = os.path.dirname(result_decoded[loc])
197 result_decoded[loc] = os.path.join(result_decoded[loc], os.path.basename(ud.localpath))
193 else: 198 else:
194 return ud.url 199 return ud.url
195 return encodeurl(result_decoded) 200 result = encodeurl(result_decoded)
201 logger.debug(2, "For url %s returning %s" % (ud.url, result))
202 return result
196 203
197methods = [] 204methods = []
198urldata_cache = {} 205urldata_cache = {}