]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
fetch2: Fix missing function call
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 30 May 2013 08:50:41 +0000 (09:50 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 30 May 2013 08:53:37 +0000 (09:53 +0100)
Fix the issue:

File: '/srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/build-appliance/build/bitbake/lib/bb/fetch2/__init__.py', lineno: 813, function: try_mirror_url
     0809:    except bb.fetch2.BBFetchException as e:
     0810:        if isinstance(e, ChecksumError):
     0811:            logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url))
     0812:            logger.warn(str(e))
 *** 0813:            self.rename_bad_checksum(ud, e.checksum)
     0814:        elif isinstance(e, NoChecksumError):
     0815:            raise
     0816:        else:
     0817:            logger.debug(1, "Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url))
Exception: NameError: global name 'self' is not defined

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/fetch2/__init__.py

index 52c53eb96bf61d09baed853d9537e71e8ff92081..1988dc760d059e861045f135233dd72f197c0154 100644 (file)
@@ -759,6 +759,19 @@ def build_mirroruris(origud, mirrors, ld):
 
     return uris, uds
 
+def rename_bad_checksum(ud, suffix):
+    """
+    Renames files to have suffix from parameter
+    """
+
+    if ud.localpath is None:
+        return
+
+    new_localpath = "%s_bad-checksum_%s" % (ud.localpath, suffix)
+    bb.warn("Renaming %s to %s" % (ud.localpath, new_localpath))
+    bb.utils.movefile(ud.localpath, new_localpath)
+
+
 def try_mirror_url(newuri, origud, ud, ld, check = False):
     # Return of None or a value means we're finished
     # False means try another url
@@ -810,7 +823,7 @@ def try_mirror_url(newuri, origud, ud, ld, check = False):
         if isinstance(e, ChecksumError):
             logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url))
             logger.warn(str(e))
-            self.rename_bad_checksum(ud, e.checksum)
+            rename_bad_checksum(ud, e.checksum)
         elif isinstance(e, NoChecksumError):
             raise
         else:
@@ -1386,7 +1399,7 @@ class Fetch(object):
                         if isinstance(e, ChecksumError):
                             logger.warn("Checksum failure encountered with download of %s - will attempt other sources if available" % u)
                             logger.debug(1, str(e))
-                            self.rename_bad_checksum(ud, e.checksum)
+                            rename_bad_checksum(ud, e.checksum)
                         elif isinstance(e, NoChecksumError):
                             raise
                         else:
@@ -1494,18 +1507,6 @@ class Fetch(object):
             if ud.lockfile:
                 bb.utils.unlockfile(lf)
 
-    def rename_bad_checksum(self, ud, suffix):
-        """
-        Renames files to have suffix from parameter
-        """
-
-        if ud.localpath is None:
-            return
-
-        new_localpath = "%s_bad-checksum_%s" % (ud.localpath, suffix)
-        bb.warn("Renaming %s to %s" % (ud.localpath, new_localpath))
-        bb.utils.movefile(ud.localpath, new_localpath)
-
 from . import cvs
 from . import git
 from . import gitsm