summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-24 16:11:26 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-01-30 16:16:12 +0000
commitf87c92143ef0dc068ded80bb39f04e37d1f06edd (patch)
treefa947d81b8d256ead43f89af9b4c07fd8b041628 /bitbake
parentf38e44bbb22f5c1ea8b53dd82522ae8d8a4f5fa2 (diff)
downloadpoky-f87c92143ef0dc068ded80bb39f04e37d1f06edd.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')
-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 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):
197 uri_decoded = list(decodeurl(ud.url)) 197 uri_decoded = list(decodeurl(ud.url))
198 uri_find_decoded = list(decodeurl(uri_find)) 198 uri_find_decoded = list(decodeurl(uri_find))
199 uri_replace_decoded = list(decodeurl(uri_replace)) 199 uri_replace_decoded = list(decodeurl(uri_replace))
200 logger.debug(2, "For url %s comparing %s to %s" % (uri_decoded, uri_find_decoded, uri_replace_decoded))
200 result_decoded = ['', '', '', '', '', {}] 201 result_decoded = ['', '', '', '', '', {}]
201 for i in uri_find_decoded: 202 for i in uri_find_decoded:
202 loc = uri_find_decoded.index(i) 203 loc = uri_find_decoded.index(i)
@@ -209,12 +210,18 @@ def uri_replace(ud, uri_find, uri_replace, d):
209 result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc]) 210 result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
210 if uri_find_decoded.index(i) == 2: 211 if uri_find_decoded.index(i) == 2:
211 if ud.mirrortarball: 212 if ud.mirrortarball:
212 result_decoded[loc] = os.path.join(os.path.dirname(result_decoded[loc]), os.path.basename(ud.mirrortarball)) 213 if result_decoded[loc].endswith("/"):
214 result_decoded[loc] = os.path.dirname(result_decoded[loc])
215 result_decoded[loc] = os.path.join(result_decoded[loc], os.path.basename(ud.mirrortarball))
213 elif ud.localpath: 216 elif ud.localpath:
214 result_decoded[loc] = os.path.join(os.path.dirname(result_decoded[loc]), os.path.basename(ud.localpath)) 217 if result_decoded[loc].endswith("/"):
218 result_decoded[loc] = os.path.dirname(result_decoded[loc])
219 result_decoded[loc] = os.path.join(result_decoded[loc], os.path.basename(ud.localpath))
215 else: 220 else:
216 return ud.url 221 return ud.url
217 return encodeurl(result_decoded) 222 result = encodeurl(result_decoded)
223 logger.debug(2, "For url %s returning %s" % (ud.url, result))
224 return result
218 225
219methods = [] 226methods = []
220urldata_cache = {} 227urldata_cache = {}