diff mbox series

fetch2: Make checkstatus respect try_premirror

Message ID 20250701115935.23596-1-michalwsieron@gmail.com
State New
Headers show
Series fetch2: Make checkstatus respect try_premirror | expand

Commit Message

Michal Sieron July 1, 2025, 11:59 a.m. UTC
Otherwise we might be hitting premirrors for repos that exist only
locally.

Signed-off-by: Michal Sieron <michalwsieron@gmail.com>
---
 lib/bb/fetch2/__init__.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Alexander Kanavin July 1, 2025, 12:16 p.m. UTC | #1
If someone isn't already very familiar with what try_premirror() does,
they wouldn't understand the issue or the fix. A better commit message
should include that information.

It would as well help if you explain in detail how to observe the
issue. Do we need to add a test for it?

Alex

On Tue, 1 Jul 2025 at 13:59, Michal Sieron via lists.openembedded.org
<michalwsieron=gmail.com@lists.openembedded.org> wrote:
>
> Otherwise we might be hitting premirrors for repos that exist only
> locally.
>
> Signed-off-by: Michal Sieron <michalwsieron@gmail.com>
> ---
>  lib/bb/fetch2/__init__.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
> index 0ad987c59..b5e8bfac0 100644
> --- a/lib/bb/fetch2/__init__.py
> +++ b/lib/bb/fetch2/__init__.py
> @@ -1975,9 +1975,13 @@ class Fetch(object):
>              ud.setup_localpath(self.d)
>              m = ud.method
>              logger.debug("Testing URL %s", u)
> +
> +            ret = False
>              # First try checking uri, u, from PREMIRRORS
> -            mirrors = mirror_from_string(self.d.getVar('PREMIRRORS'))
> -            ret = m.try_mirrors(self, ud, self.d, mirrors, True)
> +            if m.try_premirror(ud, self.d):
> +                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
>                  ret = m.checkstatus(self, ud, self.d)
> --
> 2.50.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#17732): https://lists.openembedded.org/g/bitbake-devel/message/17732
> Mute This Topic: https://lists.openembedded.org/mt/113925872/1686489
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 0ad987c59..b5e8bfac0 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -1975,9 +1975,13 @@  class Fetch(object):
             ud.setup_localpath(self.d)
             m = ud.method
             logger.debug("Testing URL %s", u)
+
+            ret = False
             # First try checking uri, u, from PREMIRRORS
-            mirrors = mirror_from_string(self.d.getVar('PREMIRRORS'))
-            ret = m.try_mirrors(self, ud, self.d, mirrors, True)
+            if m.try_premirror(ud, self.d):
+                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
                 ret = m.checkstatus(self, ud, self.d)