Skip to contentSkip to conversation

fetch/checkstatus(): do not print the URI twice in FetchError exception

PATCH New Alexander Kanavin 1 participant 2 messages Jan 8, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 fetch/checkstatus(): do not print the URI twice in FetchError exception

Previously, there was duplicate clutter in the output, particularly if the URI points to sstate cache items:

bb.fetch2.FetchError: Fetcher failure for URL: {uri}. URL {uri} doesn't work

---
 bitbake/lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/__init__.py +1 -1
index 22a2f80107c..677968a6a92 100644
@@ -1947,7 +1947,7 @@ class Fetch(object):
                     ret = m.try_mirrors(self, ud, self.d, mirrors, True)
 
             if not ret:
-                raise FetchError("URL %s doesn't work" % u, u)
+                raise FetchError("URL doesn't work", u)
 
     def unpack(self, root, urls=None):
         """
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 fetch/wget/checkstatus(): include the URL in debugging output about status check failure

Previously the output wasn't useful for finding out what was the actual URL that failed, particularly in heavily multi-threaded invocations:

DEBUG: checkstatus() urlopen failed: HTTP Error 404: Not Found

With this change, the problem is described specifically:

DEBUG: checkstatus() urlopen failed for http://cdn.jsdelivr.net/yocto/sstate/all/universal/4f/91/sstate:gettext-minimal-native:x86_64-linux:0.22.4:r0:x86_64:11:4f91b650ebd7be601cbd0e3a37a8cc6385a3f4ee616f931969b50709ed8bf044_create_spdx.tar.zst: HTTP Error 404: Not Found

This will help with CDN cache tests in particular. When some object isn't available, we need to know why: 4xx error, 5xx error, timeout error or any other issue.

---
 bitbake/lib/bb/fetch2/wget.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/fetch2/wget.py +1 -1
index dc883176104..dc025800e65 100644
@@ -375,7 +375,7 @@ class Wget(FetchMethod):
                     return self.checkstatus(fetch, ud, d, False)
                 else:
                     # debug for now to avoid spamming the logs in e.g. remote sstate searches
-                    logger.debug2("checkstatus() urlopen failed: %s" % e)
+                    logger.debug2("checkstatus() urlopen failed for %s: %s" % (uri,e))
                     return False
 
         return True
Signature · 1 line
2.39.2