Files
Mozilla/mozilla/tools/release/release
rhelmer%mozilla.com cf5be8be88 implement release steps b=356185 r=preed
git-svn-id: svn://10.0.0.236/trunk@216496 18797224-902f-48f8-a5cc-f745e15eee43
2006-12-05 19:12:59 +00:00

125 lines
2.9 KiB
Perl
Executable File

#!/usr/bin/perl -w
use strict;
use Getopt::Long;
use MozBuild::Util;
use Bootstrap::Step::Tag;
use Bootstrap::Step::Build;
use Bootstrap::Step::Source;
use Bootstrap::Step::Repack;
use Bootstrap::Step::Updates;
use Bootstrap::Step::Stage;
use Bootstrap::Step::Sign;
my @allSteps = (
'Tag',
'Build',
'Source',
'Repack',
'Updates',
'Stage',
'Sign',
);
my %config;
sub main {
ProcessArgs();
DetermineSteps();
}
sub ProcessArgs {
GetOptions(
\%config,
"step|s=s", "only|o=s", "list|l", "help|h", "execute|e", "verify|v",
);
if ($config{'list'}) {
print "Bootstrap listing all steps.\n";
for my $step (@allSteps) {
print "$step\n";
}
exit(0);
}
if ($config{'help'}) {
print "Usage: release [-l] [-s Step] [-o Step] [-e | v] [-h]\n";
print " -l list all Steps\n";
print " -s start at Step\n";
print " -o only run one Step\n";
print " -e only run Execute\n";
print " -v only run Verify\n";
print " -h this usage message\n";
exit(0);
}
}
sub DetermineSteps() {
my $currentStep = 0;
my $desiredStep;
if (defined($config{'step'})) {
$desiredStep = $config{'step'};
print "Bootstrap skip to step: $desiredStep\n";
}
if (defined($config{'only'})) {
$desiredStep = $config{'only'};
print "Bootstrap only run step: $desiredStep\n";
}
if (defined($desiredStep)) {
my $stepNumber = 0;
for my $stepName (@allSteps) {
if ($stepName eq "$desiredStep") {
$currentStep = $stepNumber;
} else {
$stepNumber += 1;
}
if ($stepNumber > scalar(@allSteps)) {
die("Step $desiredStep not found!\n");
}
}
} else {
print "Bootstrap running default steps.\n";
}
while ($currentStep < scalar(@allSteps)) {
my $stepName = $allSteps[$currentStep];
PerformStep( 'stepName' => $stepName );
$currentStep += 1;
if (defined($config{'only'})) {
if ($config{'only'} eq $stepName) {
exit(0);
}
}
}
print "Bootstrap finished all steps.\n";
}
sub PerformStep {
my %args = @_;
my $stepName = $args{'stepName'};
print "Bootstrap running $stepName\n";
my $step = "Bootstrap::Step::$stepName"->new();
eval {
if (defined($config{'execute'})) {
print "Bootstrap only running Execute\n";
$step->Execute();
} elsif (defined($config{'verify'})) {
print "Bootstrap only running Verify\n";
$step->Verify();
} else {
$step->Execute();
$step->Verify();
}
};
if ($@)
{
print "Step $stepName died: $@";
exit(1);
}
}
&main();