Patchwork [bitbake-devel,10/14] fetch2: Add parameter handling to uri_replace()

login
register
mail settings
Submitter Richard Purdie
Date June 20, 2012, 2:13 p.m.
Message ID <f1c1213d1b9c58153fc1a7e25de5c06f79fcbd79.1340200208.git.richard.purdie@linuxfoundation.org>
Download mbox | patch
Permalink /patch/30293/
State New
Headers show

Comments

Richard Purdie - June 20, 2012, 2:13 p.m.
This means that parameters in the source expression are used as part of the
match. Parameters in the destination are used explicitly in the final
url.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 bitbake/lib/bb/fetch2/__init__.py |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

Patch

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 7045e1b..37f13e2 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -194,7 +194,15 @@  def uri_replace(ud, uri_find, uri_replace, d):
     for loc, i in enumerate(uri_find_decoded):
         result_decoded[loc] = uri_decoded[loc]
         if loc == 5:
-            continue
+            # Handle URL parameters
+            if i:
+                # Any specified URL parameters must match
+                for k in uri_replace_decoded[loc]:
+                    if uri_decoded[loc][k] != uri_replace_decoded[loc][k]:
+                        return None
+            # Overwrite any specified replacement parameters
+            for k in uri_replace_decoded[loc]:
+                result_decoded[loc][k] = uri_replace_decoded[loc][k]
         elif (re.match(i, uri_decoded[loc])):
             if not uri_replace_decoded[loc]:
                 result_decoded[loc] = ""