commit:     c7c04b4f4f4f5e6f18ad76366b535dcbad72989e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 27 19:40:01 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Oct 27 19:42:44 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c7c04b4f

RsyncSync: fix PORTAGE_RSYNC_RETRIES (bug 497596)

When PORTAGE_RSYNC_RETRIES is set to a positive integer, recycle
the uris until the specified number of retries has been exhausted.

Bug: https://bugs.gentoo.org/497596

 pym/portage/sync/modules/rsync/rsync.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/pym/portage/sync/modules/rsync/rsync.py 
b/pym/portage/sync/modules/rsync/rsync.py
index 45a70e7dd..01e4e5924 100644
--- a/pym/portage/sync/modules/rsync/rsync.py
+++ b/pym/portage/sync/modules/rsync/rsync.py
@@ -202,6 +202,7 @@ class RsyncSync(NewBase):
 
                # reverse, for use with pop()
                uris.reverse()
+               uris_orig = uris[:]
 
                effective_maxretries = maxretries
                if effective_maxretries < 0:
@@ -210,10 +211,13 @@ class RsyncSync(NewBase):
                while (1):
                        if uris:
                                dosyncuri = uris.pop()
-                       else:
+                       elif maxretries < 0 or retries > maxretries:
                                writemsg("!!! Exhausted addresses for %s\n"
                                        % _unicode_decode(hostname), 
noiselevel=-1)
                                return (1, False)
+                       else:
+                               uris.extend(uris_orig)
+                               dosyncuri = uris.pop()
 
                        if (retries==0):
                                if "--ask" in opts:

Reply via email to