[bitbake-devel] [PATCH 1/4] bb.fetch: simplify mirror tarball handling in try_mirror_url

Christopher Larson kergoth at gmail.com
Wed Aug 26 16:38:05 UTC 2015


From: Christopher Larson <chris_larson at mentor.com>

Rather than checking mirrortarball explicitly, simply check and see if the
fetch method used for the mirror differs from the fetch method used for the
original url. If so, and the localpaths differ, we can trust that further
processing by the original fetcher is necessary.

This will make it easier to add the ability to support multiple mirror
tarballs, to implement shallow git mirror tarball support.

Signed-off-by: Christopher Larson <chris_larson at mentor.com>
---
 lib/bb/fetch2/__init__.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 3d53b63..04d9679 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -937,8 +937,7 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
         # We may be obtaining a mirror tarball which needs further processing by the real fetcher
         # If that tarball is a local file:// we need to provide a symlink to it
         dldir = ld.getVar("DL_DIR", True)
-        if origud.mirrortarball and os.path.basename(ud.localpath) == os.path.basename(origud.mirrortarball) \
-                and os.path.basename(ud.localpath) != os.path.basename(origud.localpath):
+        if origud.method != ud.method:
             # Create donestamp in old format to avoid triggering a re-download
             bb.utils.mkdirhier(os.path.dirname(ud.donestamp))
             open(ud.donestamp, 'w').close()
@@ -947,7 +946,7 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
                 os.symlink(ud.localpath, dest)
             if not verify_donestamp(origud, ld) or origud.method.need_update(origud, ld):
                 origud.method.download(origud, ld)
-                if hasattr(origud.method,"build_mirror_data"):
+                if hasattr(origud.method, "build_mirror_data"):
                     origud.method.build_mirror_data(origud, ld)
             return ud.localpath
         # Otherwise the result is a local file:// and we symlink to it
-- 
2.2.1




More information about the bitbake-devel mailing list