From 4839ec9fcd6e9bcab410854c340b19eed4fc030d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 10 Feb 2008 01:53:56 +0000 Subject: Fix the exitcode logic for bug #209144 so that when the server is 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 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/emerge b/bin/emerge index 89a048a2a..6482bfb25 100755 --- a/bin/emerge +++ b/bin/emerge @@ -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: -- cgit v1.2.3-1-g7c22