summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-20 12:54:46 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-21 13:10:33 +0100
commitbf8501897b7ebc4b5630fa5ab1055804ee45f93a (patch)
tree261c46d0731c09e9ac09e1bbfac710a574e8f763 /bitbake
parenta7d5c5700658fc00517bcc264c94249090c34195 (diff)
downloadpoky-bf8501897b7ebc4b5630fa5ab1055804ee45f93a.tar.gz
bitbake: fetch2: Remove basestring test and simplify uri_replace
(From Poky rev: d5657883d34bfef6beec594ac8d799f617b6b3ad) (Bitbake rev: 84ffc261f376429b3a6b5d7bf2f6217cd10ca12a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py35
1 files changed, 18 insertions, 17 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index ce2fb23b48..05ecd3c343 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -193,24 +193,25 @@ def uri_replace(ud, uri_find, uri_replace, d):
193 result_decoded = ['', '', '', '', '', {}] 193 result_decoded = ['', '', '', '', '', {}]
194 for loc, i in enumerate(uri_find_decoded): 194 for loc, i in enumerate(uri_find_decoded):
195 result_decoded[loc] = uri_decoded[loc] 195 result_decoded[loc] = uri_decoded[loc]
196 if isinstance(i, basestring): 196 if loc == 5:
197 if (re.match(i, uri_decoded[loc])): 197 continue
198 if not uri_replace_decoded[loc]: 198 elif (re.match(i, uri_decoded[loc])):
199 result_decoded[loc] = "" 199 if not uri_replace_decoded[loc]:
200 else: 200 result_decoded[loc] = ""
201 result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
202 if loc == 2:
203 basename = None
204 if ud.mirrortarball:
205 basename = os.path.basename(ud.mirrortarball)
206 elif ud.localpath:
207 basename = os.path.basename(ud.localpath)
208 if basename and result_decoded[loc].endswith("/"):
209 result_decoded[loc] = os.path.dirname(result_decoded[loc])
210 if basename and not result_decoded[loc].endswith(basename):
211 result_decoded[loc] = os.path.join(result_decoded[loc], basename)
212 else: 201 else:
213 return None 202 result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
203 if loc == 2:
204 basename = None
205 if ud.mirrortarball:
206 basename = os.path.basename(ud.mirrortarball)
207 elif ud.localpath:
208 basename = os.path.basename(ud.localpath)
209 if basename and result_decoded[loc].endswith("/"):
210 result_decoded[loc] = os.path.dirname(result_decoded[loc])
211 if basename and not result_decoded[loc].endswith(basename):
212 result_decoded[loc] = os.path.join(result_decoded[loc], basename)
213 else:
214 return None
214 result = encodeurl(result_decoded) 215 result = encodeurl(result_decoded)
215 if result == ud.url: 216 if result == ud.url:
216 return None 217 return None