1.1 --- a/support/buildbot/bootstrap.pl Wed May 12 22:56:31 2010 -0700
1.2 +++ b/support/buildbot/bootstrap.pl Fri May 14 00:34:36 2010 -0500
1.3 @@ -1,24 +1,75 @@
1.4 #!/usr/bin/perl
1.5 +# vim: set ts=2 sw=2 tw=99 noet:
1.6
1.7 use strict;
1.8 use Cwd;
1.9 use File::Basename;
1.10 +use File::Path;
1.11
1.12 my ($myself, $path) = fileparse($0);
1.13 chdir($path);
1.14
1.15 require 'helpers.pm';
1.16
1.17 -#Go to main source dir
1.18 -chdir(Build::PathFormat('../..'));
1.19 +#Go back above build dir
1.20 +chdir(Build::PathFormat('../../..'));
1.21 +
1.22 +#Get the source path.
1.23 +our ($root) = getcwd();
1.24 +
1.25 +my $reconf = 0;
1.26
1.27 -#Do the annoying revision bumping.
1.28 -#Linux needs some help here.
1.29 -if ($^O eq "linux")
1.30 +#Create output folder if it doesn't exist.
1.31 +if (!(-d 'OUTPUT')) {
1.32 + $reconf = 1;
1.33 +} else {
1.34 + if (-f 'OUTPUT/sentinel') {
1.35 + my @s = stat('OUTPUT/sentinel');
1.36 + my $mtime = $s[9];
1.37 + my @files = ('build/pushbuild.txt', 'build/AMBuildScript', 'build/product.version');
1.38 + my ($i);
1.39 + for ($i = 0; $i <= $#files; $i++) {
1.40 + if (IsNewer($files[$i], $mtime)) {
1.41 + $reconf = 1;
1.42 + last;
1.43 + }
1.44 + }
1.45 + } else {
1.46 + $reconf = 1;
1.47 + }
1.48 +}
1.49 +
1.50 +if ($reconf) {
1.51 + rmtree('OUTPUT');
1.52 + mkdir('OUTPUT') or die("Failed to create output folder: $!\n");
1.53 + chdir('OUTPUT');
1.54 + my ($result);
1.55 + print "Attempting to reconfigure...\n";
1.56 + if ($^O eq "linux") {
1.57 + $result = `CC=gcc-4.1 CXX=gcc-4.1 python3.1 ../build/configure.py --enable-optimize`;
1.58 + } elsif ($^O eq "darwin") {
1.59 + $result = `CC=gcc-4.2 CXX=gcc-4.2 python3.1 ../build/configure.py --enable-optimize`;
1.60 + } else {
1.61 + $result = `C:\\Python31\\Python.exe ..\\build\\configure.py --enable-optimize`;
1.62 + }
1.63 + print "$result\n";
1.64 + if ($? != 0) {
1.65 + die('Could not configure!');
1.66 + }
1.67 + open(FILE, '>sentinel');
1.68 + print FILE "this is nothing.\n";
1.69 + close(FILE);
1.70 +}
1.71 +
1.72 +sub IsNewer
1.73 {
1.74 - Build::Command("flip -u modules.versions");
1.75 - Build::Command("flip -u support/versionchanger.pl");
1.76 - Build::Command("chmod +x support/versionchanger.pl");
1.77 + my ($file, $time) = (@_);
1.78 +
1.79 + my @s = stat($file);
1.80 + my $mtime = $s[9];
1.81 + return $mtime > $time;
1.82 }
1.83 -Build::Command(Build::PathFormat('support/versionchanger.pl') . ' --buildstring="-dev"');
1.84
1.85 +exit(0);
1.86 +
1.87 +