]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake/fetch: Respect forcefetch even when pulling from a mirror
authorJoshua Lock <josh@linux.intel.com>
Fri, 27 Aug 2010 13:04:33 +0000 (14:04 +0100)
committerJoshua Lock <josh@linux.intel.com>
Wed, 1 Sep 2010 10:14:23 +0000 (11:14 +0100)
When pulling from a premirror we would prefer a local tarball even when the
caller had specified the forcefetch parameter.
Add an extra parameter 'force' to try_mirrors, defaulting to False. If set
the mirrors will be tested even if the file exists locally.

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

index 47a44708be292996a8f4dd327c0eca11ba07ed51..ab097dda53f060e77f2c2a9c4a13cfdb6bd8d28c 100644 (file)
@@ -258,7 +258,7 @@ def go(d, urls = None):
 
         # First try fetching uri, u, from PREMIRRORS
         mirrors = [ i.split() for i in (bb.data.getVar('PREMIRRORS', d, 1) or "").split('\n') if i ]
-        localpath = try_mirrors(d, u, mirrors)
+        localpath = try_mirrors(d, u, mirrors, False, m.forcefetch(u, ud, d))
         if not localpath:
             # Next try fetching from the original uri, u
             try:
@@ -430,7 +430,7 @@ def runfetchcmd(cmd, d, quiet = False):
 
     return output
 
-def try_mirrors(d, uri, mirrors, check = False):
+def try_mirrors(d, uri, mirrors, check = False, force = False):
     """
     Try to use a mirrored version of the sources.
     This method will be automatically called before the fetchers go.
@@ -440,7 +440,7 @@ def try_mirrors(d, uri, mirrors, check = False):
     mirrors is the list of mirrors we're going to try
     """
     fpath = os.path.join(data.getVar("DL_DIR", d, 1), os.path.basename(uri))
-    if not check and os.access(fpath, os.R_OK):
+    if not check and os.access(fpath, os.R_OK) and not force:
         bb.msg.debug(1, bb.msg.domain.Fetcher, "%s already exists, skipping checkout." % fpath)
         return fpath