For bug #180009, add a PORTAGE_RSYNC_INITIAL_TIMEOUT config variable. The default...
authorZac Medico <zmedico@gentoo.org>
Mon, 28 May 2007 07:28:48 +0000 (07:28 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 28 May 2007 07:28:48 +0000 (07:28 -0000)
svn path=/main/trunk/; revision=6650

man/make.conf.5
pym/emerge/__init__.py

index a0d95c022b845ee7a5bb6ebc3863bb99940f5bfb..dc75f97f1c84c0f6a122cb1f494bc808f5d1d131 100644 (file)
@@ -356,6 +356,12 @@ emerge is running at.  In other words, this will not set the nice level,
 it will increment it.  For more information about nice levels and what
 are acceptable ranges, see \fBnice\fR(1).
 .TP
+\fBPORTAGE_RSYNC_INITIAL_TIMEOUT\fR = \fIinteger\fR
+Used by \fBemerge \-\-sync\fR as a timeout for the initial connection to an
+rsync server.
+.br
+Defaults to 15 seconds.
+.TP
 \fBPORTAGE_RSYNC_EXTRA_OPTS\fR = \fI[rsync options string]\fR
 Additional rsync options to be used by \fBemerge \-\-sync\fR.
 .br
index 193c7c33eb37c6d72d79266cfd0b66de95664156..5f4219259c39b550ee05a8272838c1d6f1ce854c 100644 (file)
@@ -4058,6 +4058,12 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                                pass
                del content
 
+               try:
+                       rsync_initial_timeout = \
+                               int(settings.get("PORTAGE_RSYNC_INITIAL_TIMEOUT", "15"))
+               except ValueError:
+                       rsync_initial_timeout = 15
+
                try:
                        if settings.has_key("RSYNC_RETRIES"):
                                print yellow("WARNING:")+" usage of RSYNC_RETRIES is deprecated, use PORTAGE_RSYNC_RETRIES instead"
@@ -4167,14 +4173,16 @@ def action_sync(settings, trees, mtimedb, myopts, myaction):
                                        # Timeout here in case the server is unresponsive.  The
                                        # --timeout rsync option doesn't apply to the initial
                                        # connection attempt.
-                                       signal.alarm(15)
+                                       if rsync_initial_timeout:
+                                               signal.alarm(rsync_initial_timeout)
                                        try:
                                                mypids.extend(portage.process.spawn(
                                                        mycommand, env=settings.environ(), returnpid=True))
                                                exitcode = os.waitpid(mypids[0], 0)[1]
                                                content = portage.grabfile(tmpservertimestampfile)
                                        finally:
-                                               signal.alarm(0)
+                                               if rsync_initial_timeout:
+                                                       signal.alarm(0)
                                                try:
                                                        os.unlink(tmpservertimestampfile)
                                                except OSError: