diff mbox series

[RFC,v2,3/7] fetch2: rename u to url in Fetch class

Message ID 20250905064419.2589111-4-stefan.herbrechtsmeier-oss@weidmueller.com
State New
Headers show
Series fetch2: add support for implicit urls | expand

Commit Message

Stefan Herbrechtsmeier Sept. 5, 2025, 6:44 a.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

Rename the varialbe u to url in the Fetch class to clarify its meaning.
Avoid using short variable names over long ranges and simplify
subsequent changes.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
---

(no changes since v1)

 lib/bb/fetch2/__init__.py | 42 +++++++++++++++++++--------------------
 1 file changed, 21 insertions(+), 21 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index de301543a..bc9808da1 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -1841,8 +1841,8 @@  class Fetch(object):
         """
         local = []
 
-        for u in self.urls:
-            ud = self.ud[u]
+        for url in self.urls:
+            ud = self.ud[url]
             ud.setup_localpath(self.d)
             local.append(ud.localpath)
 
@@ -1859,8 +1859,8 @@  class Fetch(object):
         premirroronly = bb.utils.to_boolean(self.d.getVar("BB_FETCH_PREMIRRORONLY"))
 
         checksum_missing_messages = []
-        for u in urls:
-            ud = self.ud[u]
+        for url in urls:
+            ud = self.ud[url]
             ud.setup_localpath(self.d)
             m = ud.method
             done = False
@@ -1882,7 +1882,7 @@  class Fetch(object):
                             # contents mismatch the fetcher can still try upstream and mirrors
                             m.update_donestamp(ud, self.d)
                         except ChecksumError as e:
-                            logger.warning("Checksum failure encountered with premirror download of %s - will attempt other sources." % u)
+                            logger.warning("Checksum failure encountered with premirror download of %s - will attempt other sources." % url)
                             logger.debug(str(e))
                             done = False
 
@@ -1914,14 +1914,14 @@  class Fetch(object):
 
                     except BBFetchException as e:
                         if isinstance(e, ChecksumError):
-                            logger.warning("Checksum failure encountered with download of %s - will attempt other sources if available" % u)
+                            logger.warning("Checksum failure encountered with download of %s - will attempt other sources if available" % url)
                             logger.debug(str(e))
                             if os.path.exists(ud.localpath):
                                 rename_bad_checksum(ud, e.checksum)
                         elif isinstance(e, NoChecksumError):
                             raise
                         else:
-                            logger.warning('Failed to fetch URL %s, attempting MIRRORS if available' % u)
+                            logger.warning('Failed to fetch URL %s, attempting MIRRORS if available' % url)
                             logger.debug(str(e))
                         firsterr = e
                         # Remove any incomplete fetch
@@ -1934,13 +1934,13 @@  class Fetch(object):
                 if not done or not m.done(ud, d):
                     if firsterr:
                         logger.error(str(firsterr))
-                    raise FetchError("Unable to fetch URL from any source.", u)
+                    raise FetchError("Unable to fetch URL from any source.", url)
 
                 m.update_donestamp(ud, d)
 
             except IOError as e:
                 if e.errno in [errno.ESTALE]:
-                    logger.error("Stale Error Observed %s." % u)
+                    logger.error("Stale Error Observed %s." % url)
                     raise ChecksumError("Stale Error Detected")
 
             except BBFetchException as e:
@@ -1949,7 +1949,7 @@  class Fetch(object):
                     checksum_missing_messages.append(message)
                     continue
                 elif isinstance(e, ChecksumError):
-                    logger.error("Checksum failure fetching %s" % u)
+                    logger.error("Checksum failure fetching %s" % url)
                 raise
 
             finally:
@@ -1971,24 +1971,24 @@  class Fetch(object):
         if not urls:
             urls = self.urls
 
-        for u in urls:
-            ud = self.ud[u]
+        for url in urls:
+            ud = self.ud[url]
             ud.setup_localpath(self.d)
             m = ud.method
-            logger.debug("Testing URL %s", u)
-            # First try checking uri, u, from PREMIRRORS
+            logger.debug("Testing URL %s", url)
+            # First try checking uri, url, from PREMIRRORS
             mirrors = mirror_from_string(self.d.getVar('PREMIRRORS'))
             ret = m.try_mirrors(self, ud, self.d, mirrors, True)
             if not ret:
-                # Next try checking from the original uri, u
+                # Next try checking from the original uri, url
                 ret = m.checkstatus(self, ud, self.d)
                 if not ret:
-                    # Finally, try checking uri, u, from MIRRORS
+                    # Finally, try checking uri, url, from MIRRORS
                     mirrors = mirror_from_string(self.d.getVar('MIRRORS'))
                     ret = m.try_mirrors(self, ud, self.d, mirrors, True)
 
             if not ret:
-                raise FetchError("URL doesn't work", u)
+                raise FetchError("URL doesn't work", url)
 
     def unpack(self, root, urls=None):
         """
@@ -2000,16 +2000,16 @@  class Fetch(object):
 
         unpack_tracer.start(root, self.ud, self.d)
 
-        for u in urls:
-            ud = self.ud[u]
+        for url in urls:
+            ud = self.ud[url]
             ud.setup_localpath(self.d)
 
             if ud.lockfile:
                 lf = bb.utils.lockfile(ud.lockfile)
 
-            unpack_tracer.start_url(u)
+            unpack_tracer.start_url(url)
             ud.method.unpack(ud, root, self.d)
-            unpack_tracer.finish_url(u)
+            unpack_tracer.finish_url(url)
 
             if ud.lockfile:
                 bb.utils.unlockfile(lf)