Apply commandline arguments after the config file.

This commit is contained in:
slamm%netscape.com 2000-02-26 00:08:03 +00:00
Родитель ec5aa889d9
Коммит 4cea63e574
1 изменённых файлов: 39 добавлений и 35 удалений

Просмотреть файл

@ -11,7 +11,7 @@ use POSIX qw(sys_wait_h strftime);
use Cwd;
use File::Basename; # for basename();
$::Version = '$Revision: 1.67 $ ';
$::Version = '$Revision: 1.68 $ ';
sub PrintUsage {
die <<END_USAGE
@ -37,14 +37,17 @@ More details:
END_USAGE
}
InitVars();
ParseArgs();
ConditionalArgs();
TinderboxClientUtils::GetSystemInfo();
TinderboxClientUtils::LoadConfig();
TinderboxClientUtils::SetupEnv();
TinderboxClientUtils::SetupPath();
BuildIt();
{
InitVars();
my $args = ParseArgs();
ConditionalArgs();
TinderboxClientUtils::GetSystemInfo();
TinderboxClientUtils::LoadConfig();
ApplyArgs($args); # Apply command-line arguments after the config file.
TinderboxClientUtils::SetupEnv();
TinderboxClientUtils::SetupPath();
BuildIt();
}
# End of main
#======================================================================
@ -77,39 +80,29 @@ sub PrintExampleConfig {
sub ParseArgs {
PrintUsage() if $#ARGV == -1;
$args = {};
while (my $arg = shift @ARGV) {
$Settings::BuildDepend = 0, next if $arg eq '--clobber';
$Settings::BuildDepend = 1, next if $arg eq '--depend';
PrintExampleConfig(), exit if $arg eq '--example-config';
PrintUsage(), exit if $arg eq '--help' or $arg eq '-h';
$Settings::ReportStatus = 0, next if $arg eq '--noreport';
$Settings::ReportFinalStatus = 0, next if $arg eq '--nofinalreport';
$Settings::RunTest = 0, next if $arg eq '--notest';
$Settings::TestOnly = 1, next if $arg eq '--testonly';
$Settings::BuildOnce = 1, next if $arg eq '--once';
$Settings::UseTimeStamp = 0, next if $arg eq '--notimestamp';
$args->{ReportStatus} = 0, next if $arg eq '--noreport';
$args->{ReportFinalStatus} = 0, next if $arg eq '--nofinalreport';
$args->{RunTest} = 0, next if $arg eq '--notest';
$args->{TestOnly} = 1, next if $arg eq '--testonly';
$args->{BuildOnce} = 1, next if $arg eq '--once';
$args->{UseTimeStamp} = 0, next if $arg eq '--notimestamp';
if ($arg eq '--display') {
my %args_with_options = qw(
--display DisplayServer
-tag BuildTag
-t BuildTree
--mozconfig MozConfigFileName
);
if (defined $args_with_options{$arg}) {
my $arg_arg = shift @ARGV;
PrintUsage() if $arg_arg eq '' or $arg_arg =~ /^-/;
$Settings::DisplayServer = $arg_arg;
}
elsif ($arg eq '-tag') {
my $arg_arg = shift @ARGV;
PrintUsage() if $arg_arg eq '' or $arg_arg =~ /^-/;
$Settings::BuildTag = $arg_arg;
}
elsif ($arg eq '-t') {
my $arg_arg = shift @ARGV;
PrintUsage() if $arg_arg eq '' or $arg_arg =~ /^-/;
$Settings::BuildTree = $arg_arg;
}
elsif ($arg eq '--mozconfig' or $arg eq '--configfile') {
# File generated by the build configurator,
# http://cvs-mirror.mozilla.org/webtools/build/config.cgi
my $arg_arg = shift @ARGV;
PrintUsage() if $arg_arg eq '' or $arg_arg =~ /^-/;
$Settings::MozConfigFileName = $arg_arg;
$args->{$args_with_options{$arg}} = $arg_arg;
}
elsif ($arg eq '--version' or $arg eq '-v') {
die "$0: version" . substr($::Version,9,6) . "\n";
@ -117,7 +110,16 @@ sub ParseArgs {
PrintUsage();
}
}
PrintUsage() if $Settings::BuildTree =~ /^\s+$/i;
return $args;
}
sub ApplyArgs {
my ($args) = $_[0];
my ($variable_name, $value);
while (($variable_name, $value) = each %{$args}) {
eval "\$Settings::$variable_name = \"$value\";";
}
}
sub ConditionalArgs {
@ -250,6 +252,8 @@ sub mail_build_started_message {
open LOG, "|$Settings::mail $Settings::Tinderbox_server";
PrintUsage() if $Settings::BuildTree =~ /^\s+$/i;
print_log "\n";
print_log "tinderbox: tree: $Settings::BuildTree\n";
print_log "tinderbox: builddate: $start_time\n";