mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Fixing some mis-use error cases, adding comments. Added --testonly flag. code=slamm, r=mcafee
This commit is contained in:
parent
f0d92f8b67
commit
36175be02d
@ -6,14 +6,30 @@ use Sys::Hostname;
|
||||
use POSIX "sys_wait_h";
|
||||
use Cwd;
|
||||
|
||||
$Version = '$Revision: 1.12 $ ';
|
||||
$Version = '$Revision: 1.13 $ ';
|
||||
|
||||
|
||||
sub PrintUsage {
|
||||
die "usage: $0 --depend --clobber --once --manual\n"
|
||||
." --classic --compress --example-config --noreport --notest\n"
|
||||
." --timestamp -tag TREETAG -t TREENAME\n"
|
||||
." --configfile CONFIGFILENAME --version --testonly\n";
|
||||
die <<END_USAGE
|
||||
usage: $0 [options]
|
||||
Options:
|
||||
--depend Build depend (must have this option or clobber).
|
||||
--clobber Build clobber.
|
||||
--once Do not loop.
|
||||
--compress Use '-z3' for cvs.
|
||||
--example-config Print an example 'tinderconfig.pl'.
|
||||
--noreport Do not report status to tinderbox server.
|
||||
--notest Do not run smoke test.
|
||||
--timestamp Pull by date.
|
||||
-tag TREETAG Pull by tag (-r TREETAG).
|
||||
-t TREENAME The name of the tree
|
||||
--mozconfig FILENAME Provide a mozconfig file for client.mk to use.
|
||||
--version Print the version number (same as cvs revision).
|
||||
--testonly Only run the smoke test (do not pull or build).
|
||||
--help
|
||||
More details:
|
||||
To get started, run '$0 --example-config'.
|
||||
END_USAGE
|
||||
}
|
||||
|
||||
&InitVars;
|
||||
@ -54,9 +70,11 @@ sub ParseArgs {
|
||||
$BuildTree = shift @ARGV;
|
||||
&PrintUsage if $BuildTree eq '';
|
||||
}
|
||||
elsif ($arg eq '--configfile') {
|
||||
$ConfigFileName = shift @ARGV;
|
||||
&PrintUsage if $ConfigFileName eq '';
|
||||
elsif ($arg eq '--mozconfig' or $arg eq '--configfile') {
|
||||
# File generated by the build configurator,
|
||||
# http://cvs-mirror.mozilla.org/webtools/build/config.cgi
|
||||
$MozConfigFileName = shift @ARGV;
|
||||
&PrintUsage if $MozConfigFileName eq '';
|
||||
}
|
||||
elsif ($arg eq '--version' or $arg eq '-v') {
|
||||
die "$0: version" . substr($Version,9,6) . "\n";
|
||||
@ -188,7 +206,7 @@ sub SetupEnv {
|
||||
."$BaseDir/$DirName/mozilla/${ObjDir}dist/bin:/usr/lib/png:"
|
||||
."/usr/local/lib:$BaseDir/$DirName/mozilla/dist/bin";
|
||||
$ENV{DISPLAY} = $DisplayServer;
|
||||
$ENV{MOZCONFIG} = "$BaseDir/$ConfigFileName";
|
||||
$ENV{MOZCONFIG} = "$BaseDir/$MozConfigFileName" if $MozConfigFileName ne '';
|
||||
}
|
||||
|
||||
sub SetupPath {
|
||||
@ -320,7 +338,7 @@ sub SetupPath {
|
||||
|
||||
sub LoadConfig {
|
||||
if (-r 'tinder-config.pl') {
|
||||
do 'tinder-config.pl';
|
||||
require 'tinder-config.pl';
|
||||
} else {
|
||||
warn "Error: Need tinderbox config file, tinder-config.pl\n";
|
||||
warn " To get started, run the following,\n";
|
||||
@ -333,11 +351,13 @@ sub LoadConfig {
|
||||
sub BuildIt {
|
||||
my $fe, @felist, $EarlyExit, $LastTime, $SaveCVSCO, $comptmp;
|
||||
|
||||
die "\$BuildName is the empty string ('')\n" if $BuildName eq '';
|
||||
|
||||
$comptmp = '';
|
||||
$jflag = '';
|
||||
|
||||
mkdir $DirName, 0777;
|
||||
chdir $DirName || die "Couldn't enter $DirName";
|
||||
chdir $DirName or die "Couldn't enter $DirName";
|
||||
|
||||
$StartDir = getcwd();
|
||||
$LastTime = 0;
|
||||
@ -349,7 +369,7 @@ sub BuildIt {
|
||||
while (not $EarlyExit) {
|
||||
chdir $StartDir;
|
||||
|
||||
if (!$TestOnly && (time - $LastTime < (60 * $BuildSleep))) {
|
||||
if (not $TestOnly and (time - $LastTime < (60 * $BuildSleep))) {
|
||||
$SleepTime = (60 * $BuildSleep) - (time - $LastTime);
|
||||
print "\n\nSleeping $SleepTime seconds ...\n";
|
||||
sleep $SleepTime;
|
||||
@ -383,7 +403,7 @@ sub BuildIt {
|
||||
|
||||
print "Opening $logfile\n";
|
||||
|
||||
open LOG, ">$logfile" || print "can't open $?\n";
|
||||
open LOG, ">$logfile" or print "can't open $?\n";
|
||||
print LOG "current dir is -- " . $ENV{HOST} . ":$CurrentDir\n";
|
||||
print LOG "Build Administrator is $BuildAdministrator\n";
|
||||
&PrintEnv;
|
||||
@ -402,12 +422,12 @@ sub BuildIt {
|
||||
$BuildStatus = 0;
|
||||
|
||||
mkdir $TopLevel, 0777;
|
||||
chdir $TopLevel || die "chdir($TopLevel): $!\n";
|
||||
|
||||
if (!$TestOnly) {
|
||||
chdir $TopLevel or die "chdir($TopLevel): $!\n";
|
||||
|
||||
unless ($TestOnly) {
|
||||
print "$CVS $CVSCO mozilla/client.mk\n";
|
||||
print LOG "$CVS $CVSCO mozilla/client.mk\n";
|
||||
open PULL, "$CVS $CVSCO mozilla/client.mk 2>&1 |" || die "open: $!\n";
|
||||
open PULL, "$CVS $CVSCO mozilla/client.mk 2>&1 |" or die "open: $!\n";
|
||||
while (<PULL>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
@ -415,10 +435,10 @@ sub BuildIt {
|
||||
close PULL;
|
||||
}
|
||||
|
||||
chdir $Topsrcdir || die "chdir $Topsrcdir: $!\n";
|
||||
chdir $Topsrcdir or die "chdir $Topsrcdir: $!\n";
|
||||
|
||||
# Let us delete the binaries before rebuilding
|
||||
if (!$TestOnly) {
|
||||
unless ($TestOnly) {
|
||||
@felist = split /,/, $FE;
|
||||
|
||||
foreach $fe (@felist) {
|
||||
@ -431,18 +451,18 @@ sub BuildIt {
|
||||
|
||||
$ENV{MOZ_CO_DATE} = "$BuildStart" if $UseTimeStamp;
|
||||
|
||||
# If we are building depend, don't clobber.
|
||||
if ($BuildDepend) {
|
||||
print LOG "$Make -f client.mk\n";
|
||||
open MAKEDEPEND, "$Make -f client.mk 2>&1 |";
|
||||
while (<MAKEDEPEND>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close MAKEDEPEND;
|
||||
} else {
|
||||
# Building clobber
|
||||
if (!$TestOnly) {
|
||||
# If we are building depend, don't clobber.
|
||||
unless ($TestOnly) {
|
||||
if ($BuildDepend) {
|
||||
print LOG "$Make -f client.mk\n";
|
||||
open MAKEDEPEND, "$Make -f client.mk 2>&1 |";
|
||||
while (<MAKEDEPEND>) {
|
||||
print $_;
|
||||
print LOG $_;
|
||||
}
|
||||
close MAKEDEPEND;
|
||||
} else {
|
||||
# Building clobber
|
||||
print LOG "$Make -f client.mk checkout clean build 2>&1 |\n";
|
||||
open MAKECLOBBER, "$Make -f client.mk checkout clean build 2>&1 |";
|
||||
while (<MAKECLOBBER>) {
|
||||
@ -458,7 +478,7 @@ sub BuildIt {
|
||||
if ($RunTest) {
|
||||
print LOG "export binary exists, build successful. Testing...\n";
|
||||
$BuildStatus = &RunSmokeTest($fe);
|
||||
if ($BuildStatus == 0 && defined($BloatStats) && $BloatStats) {
|
||||
if ($BuildStatus == 0 and $BloatStats) {
|
||||
$BuildStatusStr = 'success';
|
||||
print LOG "export binary exists, build successful. Gathering bloat stats...\n";
|
||||
$BuildStatus = &RunBloatTest($fe);
|
||||
@ -504,8 +524,8 @@ sub BuildIt {
|
||||
# preed@netscape.com; good things: no need for system() call, and now it's
|
||||
# all in perl, so we don't have to do OS checking like before.
|
||||
#
|
||||
open LOG, "$logfile" || die "Couldn't open logfile: $!\n";
|
||||
open OUTLOG, ">${logfile}.last" || die "Couldn't open logfile: $!\n";
|
||||
open LOG, "$logfile" or die "Couldn't open logfile: $!\n";
|
||||
open OUTLOG, ">${logfile}.last" or die "Couldn't open logfile: $!\n";
|
||||
|
||||
while (<LOG>) {
|
||||
for ($q = 0; ; $q++) {
|
||||
@ -578,7 +598,7 @@ sub DeleteBinary {
|
||||
|
||||
$BinName = "$BuildDir/$TopLevel/${Topsrcdir}$BinaryName{$fe}";
|
||||
print LOG "unlinking $BinName\n";
|
||||
unlink $BinName || print LOG "unlinking $BinName failed\n";
|
||||
unlink $BinName or print LOG "unlinking $BinName failed\n";
|
||||
}
|
||||
|
||||
sub PrintEnv {
|
||||
@ -806,3 +826,6 @@ $ConfigGuess = './build/autoconf/config.guess';
|
||||
$Logfile = '${BuildDir}.log';
|
||||
$Compiler = 'gcc';
|
||||
$ShellOverride = ''; # Only used if the default shell is too stupid
|
||||
|
||||
# Need to end with a true value, (since we're using "require").
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user