Bug 5686

Summary: fetch2: error when upstream failed but MIRROR succeeded
Product: [Build System, Metadata & Runtime] BitBake Reporter: Robert Yang <liezhi.yang>
Component: bitbakeAssignee: Robert Yang <liezhi.yang>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: poky.bs.watcher, poky.watcher, richard.purdie, sgw
Version: 1.6   
Target Milestone: 1.6 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Robert Yang 2013-12-25 07:22:06 UTC
The fetcher will try:

1) PREMIRROR
2) Upstream
3) MIRROR

If it fails to download from the Upstream, but succeed to download from the MIRROR, then we will get the error "Unable to fetch URL from any source", this is incorrect, it should not show the error since it succeeds. (e.g.: xf86-video-omapfb)

ERROR: Fetcher failure: Fetch command failed with exit code 128, output:
Cloning into bare repository '/buildarea/lyang1/yocto/testfec/../share/downloads/git2/git.pingu.fi.xf86-video-omapfb'...

fatal: repository 'http://git.pingu.fi/xf86-video-omapfb/' not found

ERROR: Function failed: Fetcher failure for URL: 'git://git.pingu.fi/xf86-video-omapfb;protocol=http'. Unable to fetch URL from any source.
ERROR: Logfile of failure stored in: /buildarea/lyang1/yocto/testfec/tmp/work/i586-poky-linux/xf86-video-omapfb/2_0.1.1+gitrAUTOINC+28c006c94e-r21.7/temp/log.do_fetch.28024
ERROR: Task 0 (/buildarea/lyang1/yocto/poky/meta/recipes-graphics/xorg-driver/xf86-video-omapfb_git.bb, do_fetch) failed with exit code '1'

The following patch will fix the problem:

diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 8fdf59c..f93668f 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -810,7 +810,7 @@ def try_mirror_url(origud, ud, ld, check = False):
                 origud.method.download(origud, ld)
                 if hasattr(ud.method,"build_mirror_data"):
                     origud.method.build_mirror_data(origud, ld)
-            return None
+            return ud.localpath
         # Otherwise the result is a local file:// and we symlink to it
         if not os.path.exists(origud.localpath):
             if os.path.islink(origud.localpath):