]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake/fetch: if mirror fetching fails, ensure exception is raised
authorJoshua Lock <josh@linux.intel.com>
Tue, 5 Oct 2010 11:44:08 +0000 (12:44 +0100)
committerJoshua Lock <josh@linux.intel.com>
Tue, 5 Oct 2010 15:54:10 +0000 (16:54 +0100)
We catch any exception raised by the fetchers go() method and attempt to work
around it by trying any (post) mirrors which are configured. However, should
the mirrors fail the exception is lost and the fetch is assumed to have
completed successfully.

Instead, save the exception and if the local file does not exist after trying
the mirrors re-raise the exception.

Fixes [BUGID #362]

Signed-off-by: Joshua Lock <josh@linux.intel.com>
bitbake/lib/bb/fetch/__init__.py

index a787cb656b2d71648bda4c47d0c25f8c36977bc6..65ac468797a7edb407dbd2db4da4f79c149e6bb2 100644 (file)
@@ -272,10 +272,12 @@ def go(d, urls = None):
             try:
                 m.go(u, ud, d)
                 localpath = ud.localpath
-            except:
+            except FetchError:
                 # Finally, try fetching uri, u, from MIRRORS
                 mirrors = [ i.split() for i in (bb.data.getVar('MIRRORS', d, 1) or "").split('\n') if i ]
                 localpath = try_mirrors (d, u, mirrors)
+                if not localpath or not os.path.exists(localpath):
+                    raise FetchError("Unable to fetch URL %s from any source." % u)
 
         if localpath:
             ud.localpath = localpath