bitbake: fetch2: Update replace_uri to handle uri types explicitly

For mirror mapping, we never use regexps for the type component of
the url. Doing so causes various slightly bizarre behaviour such as
https:// urls being translated to files:// urls which we have no handler
for. This patch forces the type matches to be direct, not regexp based
and gives the expected bahvriour.

(From Poky rev: 695d8aca0999d2d61970b990e83c3132ba6f12cb)

(Bitbake rev: 604df1b25cf114e083f52917df2df64e01279c25)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2012-06-20 16:37:22 +00:00
parent dd249ebe67
commit df0059b465
1 changed files with 6 additions and 0 deletions

View File

@ -203,6 +203,12 @@ def uri_replace(ud, uri_find, uri_replace, d):
# Overwrite any specified replacement parameters
for k in uri_replace_decoded[loc]:
result_decoded[loc][k] = uri_replace_decoded[loc][k]
elif loc == 0:
# Principle of least surprise. We could end up with https matching against http and
# generating "files://" urls if we use the regexp engine below.
if i != uri_decoded[loc]:
return None
result_decoded[loc] = uri_replace_decoded[loc]
elif (re.match(i, uri_decoded[loc])):
if not uri_replace_decoded[loc]:
result_decoded[loc] = ""