From 407bc3cf359493714508d60d907fdc433e15ee66 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 29 May 2011 17:34:32 -0700 Subject: [PATCH] build: when build fails, show maintainer's last successful build version. --- .last_go_version | 1 + build.pl | 33 ++++++++++++++++++++------------- 2 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 .last_go_version diff --git a/.last_go_version b/.last_go_version new file mode 100644 index 000000000..4b728aee3 --- /dev/null +++ b/.last_go_version @@ -0,0 +1 @@ +6g version weekly.2011-05-22 8485+ diff --git a/build.pl b/build.pl index 0bee9426a..409f269bb 100755 --- a/build.pl +++ b/build.pl @@ -101,6 +101,7 @@ if ($target eq "allfast") { foreach my $target (sort grep { !$targets{$_}{tags}{not_in_all} } keys %targets) { build($target); } + record_go_version(); exit; } @@ -108,6 +109,7 @@ if ($target eq "all") { foreach my $target (sort keys %targets) { build($target); } + record_go_version(); exit; } @@ -163,19 +165,15 @@ sub fixit_tip { return "Failed to find 'gotry'. Is Go installed? Or have you put \$GOROOT/bin in your \$PATH?"; } $gover = $1; - if ($gover =~ /release/) { - return "You're running a release version of Go ($gover) but \n". - "Camlistore generally tracks the 'weekly' releases.\n". - "See: http://blog.golang.org/2011/03/go-becomes-more-stable.html\n"; + my $last = do { open(my $fh, ".last_go_version") or die; local $/; <$fh> }; + $last =~ s!^[68]g version !!; + chomp $last; + chomp $gover; + if ($last eq $gover) { + return ""; } - unless ($gover =~ /weekly\.(\d\d\d\d)-(\d\d)-(\d\d)/) { - return "Failed to parse your Go version. You have \"$gover\" but since\n". - "I can't parse it, I can't tell you if it's too old or not.\n"; - } - my ($yyyy, $mm, $dd) = ($1, $2, $3); - # TODO: check the internet to see what the latest Go weekly is? - # Or keep it in git here? Or go purely on number of days passed? - return "You're running Go weekly release $gover; maybe it's too old?"; + return "You're running Go version: $gover (maintainer's last version used was $last)\nCamlistore generally tracks Go tip closely (run \"hg update tip\" in \$GOROOT)"; + } if ($target =~ /\bandroid\b/) { @@ -248,7 +246,7 @@ sub build { if (system("make", @quiet, "-C", $target, "install") != 0) { my $chain = ""; if (@history > 1) { - $chain = "(via chain @history)"; + $chain = "via chain @history"; } my $help_msg = fixit_tip($target); if ($help_msg) { @@ -411,6 +409,15 @@ sub read_targets { #print Dumper(\%targets); } +sub record_go_version { + return unless $ENV{USER} eq "bradfitz"; + return unless `uname -m` =~ /x86_64/; + my $ver = `6g -V`; + open(my $fh, ">.last_go_version") or return; + print $fh $ver; + close($fh); +} + __DATA__ TARGET: clients/go/camdbinit