Patchwork [bitbake-devel,01/14] fetch2/__init__: Make it clearer when uri_replace doesn't return a match

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

Comments

Richard Purdie - June 20, 2012, 2:12 p.m.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 bitbake/lib/bb/fetch2/__init__.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Patch

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 324eef2..73ac73a 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -210,8 +210,10 @@  def uri_replace(ud, uri_find, uri_replace, d):
                     if basename and not result_decoded[loc].endswith(basename):
                         result_decoded[loc] = os.path.join(result_decoded[loc], basename)
             else:
-                return ud.url
+                return None
     result = encodeurl(result_decoded)
+    if result == ud.url:
+        return None
     logger.debug(2, "For url %s returning %s" % (ud.url, result))
     return result
 
@@ -477,7 +479,7 @@  def try_mirrors(d, origud, mirrors, check = False):
         except ValueError:
             continue
         newuri = uri_replace(origud, find, replace, ld)
-        if newuri == origud.url:
+        if not newuri:
             continue
         try:
             ud = FetchData(newuri, ld)