Skip to contentSkip to conversation

fetch: fix handling of files with incorrect checksums from a premirror

PATCH New Joshua Lock 1 participant 1 message Jun 14, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch: fix handling of files with incorrect checksums from a premirror

Ensure that when an item fetched from a premirror has an invalid checksum the fetcher falls back to the usual logic of trying the upstream and any configured mirrors.

---
 lib/bb/fetch2/__init__.py | 9 +++++++++
 1 file changed, 9 insertions(+)
lib/bb/fetch2/__init__.py +9 -0
index 1f63a04..ec65216 100644
@@ -1621,6 +1621,15 @@ class Fetch(object):
                     logger.debug(1, "Trying PREMIRRORS")
                     mirrors = mirror_from_string(self.d.getVar('PREMIRRORS'))
                     localpath = try_mirrors(self, self.d, ud, mirrors, False)
+                    if localpath:
+                        try:
+                            # early checksum verification so that if the checksum of the premirror
+                            # contents mismatch the fetcher can still try upstream and mirrors
+                            update_stamp(ud, self.d)
+                        except ChecksumError as e:
+                            logger.warning("Checksum failure encountered with premirror download of %s - will attempt other sources." % u)
+                            logger.debug(1, str(e))
+                            localpath = ""
 
                 if premirroronly:
                     self.d.setVar("BB_NO_NETWORK", "1")
Signature · 1 line
2.9.4