From 604df1b25cf114e083f52917df2df64e01279c25 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 20 Jun 2012 16:37:22 +0000 Subject: 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) Signed-off-by: Richard Purdie --- lib/bb/fetch2/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index 88905f9b4..1b99a0fe4 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -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] = "" -- cgit 1.2.3-korg