Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Sep 2012 15:15:41 +0000 (UTC)
From:      Dag-Erling Smørgrav <des@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r240888 - user/des/tinderbox
Message-ID:  <201209241515.q8OFFfsR042490@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: des
Date: Mon Sep 24 15:15:41 2012
New Revision: 240888
URL: http://svn.freebsd.org/changeset/base/240888

Log:
  If svn checkout or update fails, retry up to three times (four attempts
  total) at increasing intervals before giving up.
  
  When svn checkout or update succeeds, use svnversion to retrieve the
  version number and log it so it appears in the summary.

Modified:
  user/des/tinderbox/tinderbox.pl

Modified: user/des/tinderbox/tinderbox.pl
==============================================================================
--- user/des/tinderbox/tinderbox.pl	Mon Sep 24 15:02:31 2012	(r240887)
+++ user/des/tinderbox/tinderbox.pl	Mon Sep 24 15:15:41 2012	(r240888)
@@ -95,6 +95,13 @@ my @svncmds = (
     '/usr/local/bin/svn',
 );
 
+my @svnversioncmds = (
+    '/usr/bin/svnversion',
+    '/usr/local/bin/svnversion',
+);
+
+my $svnattempts = 4;
+
 BEGIN {
     ($starttime) = POSIX::times();
 }
@@ -598,8 +605,18 @@ MAIN:{
 	    } else {
 		push(@svnargs, "checkout", $svnbase, $srcdir);
 	    }
-	    spawn($svncmd, @svnargs)
-		or error("unable to check out the source tree");
+	    for (0..$svnattempts) {
+		last if spawn($svncmd, @svnargs);
+		error("unable to check out the source tree")
+		    if ($_ == $svnattempts);
+		my $delay = 30 * ($_ + 1);
+		warning("sleeping $delay s and retrying...");
+		sleep($delay);
+	    }
+	    my $svnversioncmd = [grep({ -x } @svnversioncmds)]->[0]
+		or error("unable to locate svnversion binary");
+	    my $svnversion = `$svnversioncmd $srcdir`;
+	    message("At svn revision $svnversion");
 	} elsif (defined($cvsup)) {
 	    logstage("cvsupping the source tree");
 	    open(my $fh, ">", "$sandbox/supfile")



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209241515.q8OFFfsR042490>