summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 52c53eb96b..1988dc760d 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -759,6 +759,19 @@ def build_mirroruris(origud, mirrors, ld):
759 759
760 return uris, uds 760 return uris, uds
761 761
762def rename_bad_checksum(ud, suffix):
763 """
764 Renames files to have suffix from parameter
765 """
766
767 if ud.localpath is None:
768 return
769
770 new_localpath = "%s_bad-checksum_%s" % (ud.localpath, suffix)
771 bb.warn("Renaming %s to %s" % (ud.localpath, new_localpath))
772 bb.utils.movefile(ud.localpath, new_localpath)
773
774
762def try_mirror_url(newuri, origud, ud, ld, check = False): 775def try_mirror_url(newuri, origud, ud, ld, check = False):
763 # Return of None or a value means we're finished 776 # Return of None or a value means we're finished
764 # False means try another url 777 # False means try another url
@@ -810,7 +823,7 @@ def try_mirror_url(newuri, origud, ud, ld, check = False):
810 if isinstance(e, ChecksumError): 823 if isinstance(e, ChecksumError):
811 logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url)) 824 logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url))
812 logger.warn(str(e)) 825 logger.warn(str(e))
813 self.rename_bad_checksum(ud, e.checksum) 826 rename_bad_checksum(ud, e.checksum)
814 elif isinstance(e, NoChecksumError): 827 elif isinstance(e, NoChecksumError):
815 raise 828 raise
816 else: 829 else:
@@ -1386,7 +1399,7 @@ class Fetch(object):
1386 if isinstance(e, ChecksumError): 1399 if isinstance(e, ChecksumError):
1387 logger.warn("Checksum failure encountered with download of %s - will attempt other sources if available" % u) 1400 logger.warn("Checksum failure encountered with download of %s - will attempt other sources if available" % u)
1388 logger.debug(1, str(e)) 1401 logger.debug(1, str(e))
1389 self.rename_bad_checksum(ud, e.checksum) 1402 rename_bad_checksum(ud, e.checksum)
1390 elif isinstance(e, NoChecksumError): 1403 elif isinstance(e, NoChecksumError):
1391 raise 1404 raise
1392 else: 1405 else:
@@ -1494,18 +1507,6 @@ class Fetch(object):
1494 if ud.lockfile: 1507 if ud.lockfile:
1495 bb.utils.unlockfile(lf) 1508 bb.utils.unlockfile(lf)
1496 1509
1497 def rename_bad_checksum(self, ud, suffix):
1498 """
1499 Renames files to have suffix from parameter
1500 """
1501
1502 if ud.localpath is None:
1503 return
1504
1505 new_localpath = "%s_bad-checksum_%s" % (ud.localpath, suffix)
1506 bb.warn("Renaming %s to %s" % (ud.localpath, new_localpath))
1507 bb.utils.movefile(ud.localpath, new_localpath)
1508
1509from . import cvs 1510from . import cvs
1510from . import git 1511from . import git
1511from . import gitsm 1512from . import gitsm