Fix the exitcode logic for bug #209144 so that when the server is
authorZac Medico <zmedico@gentoo.org>
Sun, 10 Feb 2008 01:53:56 +0000 (01:53 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 10 Feb 2008 01:53:56 +0000 (01:53 -0000)
out of date it's not interpreted like an actual rsync exitcode
(to avoid a misleading exitcode interpretation message). (trunk r9320)

Bug #209144 - For emerge --sync, show an informative error and don't
return 1 when PORTAGE_RSYNC_RETRIES is exceeded. (trunk r9321)

svn path=/main/branches/2.1.2/; revision=9322

bin/emerge

index 89a048a2a482d27f9b424e416f27792de8fbc19f..6482bfb25c5d3edc020d83b814a28e5e12d0d03d 100755 (executable)
@@ -5154,6 +5154,8 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                        ("-6" in all_rsync_opts or "--ipv6" in all_rsync_opts):
                        family = socket.AF_INET6
                ips=[]
+               SERVER_OUT_OF_DATE = -1
+               EXCEEDED_MAX_RETRIES = -2
                while (1):
                        if ips:
                                del ips[0]
@@ -5296,7 +5298,7 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                                        print ">>> In order to force sync, remove '%s'." % servertimestampfile
                                        print ">>>"
                                        print
-                                       exitcode = 1
+                                       exitcode = SERVER_OUT_OF_DATE
                                elif (servertimestamp == 0) or (servertimestamp > mytimestamp):
                                        # actual sync
                                        mycommand = rsynccommand + [dosyncuri+"/", myportdir]
@@ -5322,10 +5324,17 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                                # over retries
                                # exit loop
                                updatecache_flg=False
+                               exitcode = EXCEEDED_MAX_RETRIES
                                break
 
                if (exitcode==0):
                        emergelog(xterm_titles, "=== Sync completed with %s" % dosyncuri)
+               elif exitcode == SERVER_OUT_OF_DATE:
+                       sys.exit(1)
+               elif exitcode == EXCEEDED_MAX_RETRIES:
+                       sys.stderr.write(
+                               ">>> Exceeded PORTAGE_RSYNC_RETRIES: %s\n" % maxretries)
+                       sys.exit(1)
                elif (exitcode>0):
                        print
                        if exitcode==1: