proj/portage:master commit in: lib/portage/_emirrordist/

"Sam James" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1786673596.070a60520aad5c596e52da57f41840c6ed7b4c5a.sam@gentoo>
commit:     070a60520aad5c596e52da57f41840c6ed7b4c5a
Author:     jinqiang zhang <peeweep <AT> 0x0 <DOT> ee>
AuthorDate: Sat Jul  4 08:14:18 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Aug 14 02:13:16 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=070a6052

emirrordist: fix dropping untried primary URIs

When --tries is less than the number of primary URIs (e.g. emirrordist
--tries=1 with kernel-2.eclass's GENPATCHES_URI), this can cause
unexpected fetch failures. In this case, when remaining_tries drops to
0, _next_uri() will return None even if untried URIs remain in
_primaryuri_stack.

Signed-off-by: jinqiang zhang <peeweep <AT> 0x0.ee>
Part-of: https://github.com/gentoo/portage/pull/1621
Closes: https://github.com/gentoo/portage/pull/1621
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/_emirrordist/FetchTask.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/portage/_emirrordist/FetchTask.py b/lib/portage/_emirrordist/FetchTask.py
index a09658311..7d7c68a12 100644
--- a/lib/portage/_emirrordist/FetchTask.py
+++ b/lib/portage/_emirrordist/FetchTask.py
@@ -273,7 +273,7 @@ class FetchTask(CompositeTask):
 
     def _next_uri(self):
         remaining_tries = self.config.options.tries - len(self._tried_uris)
-        if remaining_tries > 0:
+        if remaining_tries > 0 or self._primaryuri_stack:
             if remaining_tries <= self.config.options.tries // 2:
                 while self._primaryuri_stack:
                     uri = self._primaryuri_stack.pop()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.