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
poky-bf8501897b7ebc4b5630fa5ab1055804ee45f93a.tar.bz2
poky-bf8501897b7ebc4b5630fa5ab1055804ee45f93a.zip
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):
result_decoded = ['', '', '', '', '', {}]
for loc, i in enumerate(uri_find_decoded):
result_decoded[loc] = uri_decoded[loc]
- if isinstance(i, basestring):
- if (re.match(i, uri_decoded[loc])):
- if not uri_replace_decoded[loc]:
- result_decoded[loc] = ""
- else:
- result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
- if loc == 2:
- basename = None
- if ud.mirrortarball:
- basename = os.path.basename(ud.mirrortarball)
- elif 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)
+ if loc == 5:
+ continue
+ elif (re.match(i, uri_decoded[loc])):
+ if not uri_replace_decoded[loc]:
+ result_decoded[loc] = ""
else:
- return None
+ result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
+ if loc == 2:
+ basename = None
+ if ud.mirrortarball:
+ basename = os.path.basename(ud.mirrortarball)
+ elif 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 None
result = encodeurl(result_decoded)
if result == ud.url:
return None