2007-04-24 15:04:12 -07:00
|
|
|
##
|
|
|
|
# TinderConfig - creates config file for Tinderbox
|
|
|
|
##
|
|
|
|
|
|
|
|
package Bootstrap::Step::TinderConfig;
|
|
|
|
|
|
|
|
use Bootstrap::Step;
|
|
|
|
use Bootstrap::Config;
|
2007-09-18 16:38:06 -07:00
|
|
|
use Bootstrap::Util qw(CvsCatfile CvsTag);
|
|
|
|
|
2007-04-24 15:04:12 -07:00
|
|
|
use MozBuild::TinderLogParse;
|
|
|
|
use MozBuild::Util qw(MkdirWithPath);
|
|
|
|
|
|
|
|
@ISA = ("Bootstrap::Step");
|
|
|
|
|
|
|
|
sub Execute {
|
|
|
|
my $this = shift;
|
|
|
|
|
|
|
|
my $config = new Bootstrap::Config();
|
|
|
|
my $configBumpDir = $config->Get(var => 'configBumpDir');
|
|
|
|
my $productTag = $config->Get(var => 'productTag');
|
2008-01-08 09:39:11 -08:00
|
|
|
my $version = $config->GetVersion(longName => 0);
|
2007-09-18 16:38:06 -07:00
|
|
|
my $rc = int($config->Get(var => 'rc'));
|
2007-04-24 15:04:12 -07:00
|
|
|
my $mozillaCvsroot = $config->Get(var => 'mozillaCvsroot');
|
|
|
|
my $product = $config->Get(var => 'product');
|
2007-08-10 16:30:01 -07:00
|
|
|
my $logDir = $config->Get(sysvar => 'logDir');
|
2007-04-24 15:04:12 -07:00
|
|
|
my $branchTag = $config->Get(var => 'branchTag');
|
|
|
|
my $osname = $config->SystemInfo(var => 'osname');
|
|
|
|
|
|
|
|
my $releaseTag = $productTag . '_RELEASE';
|
|
|
|
|
2007-09-18 16:38:06 -07:00
|
|
|
my $productConfigBumpDir = catfile($configBumpDir,
|
|
|
|
"$product-$version-rc$rc");
|
|
|
|
|
|
|
|
if (-e $productConfigBumpDir) {
|
|
|
|
die "ASSERT: Step::TinderConfig::Execute(): $productConfigBumpDir " .
|
|
|
|
'already exists?';
|
|
|
|
}
|
|
|
|
|
|
|
|
MkdirWithPath(dir => $productConfigBumpDir)
|
|
|
|
or die("Cannot mkdir $productConfigBumpDir: $!");
|
2007-04-24 15:04:12 -07:00
|
|
|
|
2008-01-18 13:02:39 -08:00
|
|
|
my @branches = @{DetermineBranches()};
|
|
|
|
|
|
|
|
if (scalar(@branches) != 2) {
|
|
|
|
die("ASSERT: Bootstrap::Step::TinderConfig(): Got " .
|
|
|
|
scalar(@branches) . " branches from DetermineBranches(), " .
|
|
|
|
"needed 2.");
|
2007-12-06 07:31:31 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach my $branch (@branches) {
|
|
|
|
$this->CvsCo(cvsroot => $mozillaCvsroot,
|
|
|
|
checkoutDir => $branch,
|
|
|
|
tag => $branch,
|
|
|
|
modules => [CvsCatfile('mozilla', 'tools',
|
|
|
|
'tinderbox-configs', $product, $osname)],
|
|
|
|
logFile => catfile($logDir,
|
|
|
|
'build_config-checkout-' . $branch . '.log'),
|
|
|
|
workDir => $productConfigBumpDir
|
2007-04-24 15:04:12 -07:00
|
|
|
);
|
2007-09-18 16:38:06 -07:00
|
|
|
|
|
|
|
my @bumpConfigFiles = qw(tinder-config.pl mozconfig);
|
|
|
|
|
|
|
|
foreach my $configFile (@bumpConfigFiles) {
|
2007-04-24 15:04:12 -07:00
|
|
|
$config->Bump( configFile =>
|
2007-09-18 16:38:06 -07:00
|
|
|
catfile($productConfigBumpDir, $branch, $configFile));
|
2007-04-24 15:04:12 -07:00
|
|
|
$this->Shell(
|
|
|
|
cmd => 'cvs',
|
|
|
|
cmdArgs => ['-d', $mozillaCvsroot,
|
|
|
|
'ci', '-m',
|
|
|
|
'"Automated configuration bump, release for '
|
2007-09-18 16:38:06 -07:00
|
|
|
. $product . ' ' . $version . "rc$rc" . '"',
|
|
|
|
$configFile],
|
2007-04-24 15:04:12 -07:00
|
|
|
logFile => catfile($logDir,
|
|
|
|
'build_config-checkin-' . $configFile . '-' .
|
|
|
|
$branch . '.log'),
|
2007-09-18 16:38:06 -07:00
|
|
|
dir => catfile($productConfigBumpDir, $branch)
|
2007-04-24 15:04:12 -07:00
|
|
|
);
|
|
|
|
}
|
2007-09-18 16:38:06 -07:00
|
|
|
|
2008-01-17 11:40:20 -08:00
|
|
|
if ($version eq 'nightly') {
|
2008-01-18 13:02:39 -08:00
|
|
|
$this->Log(msg => 'Skipping TinderConfig tagging for nightly mode');
|
|
|
|
next;
|
2008-01-17 11:40:20 -08:00
|
|
|
}
|
|
|
|
|
2007-09-18 16:38:06 -07:00
|
|
|
my @tagNames = ($productTag . '_RELEASE',
|
|
|
|
$productTag . '_RC' . $rc);
|
|
|
|
|
|
|
|
foreach my $configTagName (@tagNames) {
|
|
|
|
# XXX - Don't like doing this this way (specifically, the logic
|
|
|
|
# change depending on the name of the branch in this loop...)
|
|
|
|
#
|
|
|
|
# Also, the force argument to CvsTag() is interesting; we only
|
|
|
|
# want to cvs tag -F a whatever_RELEASE tag if we're not tagging
|
|
|
|
# the first RC; so, the logic is (rc > 1 && we're doing a _RELEASE
|
|
|
|
# tag; also, we have to surround it in int(); otherwise, if it's
|
|
|
|
# false, we get the empty string, which is undef which is bad.
|
|
|
|
$configTagName .= '_l10n' if ($branch =~ /l10n/);
|
|
|
|
|
|
|
|
my $rv = CvsTag(tagName => $configTagName,
|
|
|
|
force => int($rc > 1 &&
|
|
|
|
$configTagName =~ /_RELEASE/),
|
|
|
|
files => \@bumpConfigFiles,
|
|
|
|
cvsDir => catfile($productConfigBumpDir,
|
|
|
|
$branch),
|
|
|
|
logFile => catfile($logDir, 'build_config-tag-' .
|
|
|
|
$branch . '.log'),
|
|
|
|
output => 1
|
|
|
|
);
|
|
|
|
|
|
|
|
if ($rv->{'timedOut'} || ($rv->{'exitValue'} != 0)) {
|
|
|
|
$this->Log(msg => "CvsTag() in TinderConfig() failed; " .
|
|
|
|
"tag: $configTagName, rv: $rv->{'exitValue'}, " .
|
|
|
|
"timeout: $rv->{'timedOut'}, output: $rv->{'output'}");
|
|
|
|
die("Bootstrap::Step::TinderConfig tag failed: "
|
|
|
|
. $rv->{'exitValue'});
|
|
|
|
}
|
|
|
|
}
|
2007-04-24 15:04:12 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sub Verify {
|
|
|
|
my $this = shift;
|
|
|
|
|
|
|
|
my $config = new Bootstrap::Config();
|
|
|
|
my $branchTag = $config->Get(var => 'branchTag');
|
2007-08-10 16:30:01 -07:00
|
|
|
my $logDir = $config->Get(sysvar => 'logDir');
|
2008-01-18 13:02:39 -08:00
|
|
|
my $version = $config->Get(var => 'version');
|
2007-12-06 07:31:31 -08:00
|
|
|
|
2008-01-18 13:02:39 -08:00
|
|
|
my @branches = @{DetermineBranches()};
|
|
|
|
|
|
|
|
if (scalar(@branches) != 2) {
|
|
|
|
die("ASSERT: Bootstrap::Step::TinderConfig(): Got " .
|
|
|
|
scalar(@branches) . " branches from DetermineBranches(), " .
|
|
|
|
"needed 2.");
|
2007-12-06 07:31:31 -08:00
|
|
|
}
|
2007-04-24 15:04:12 -07:00
|
|
|
|
2007-12-06 07:31:31 -08:00
|
|
|
foreach my $branch (@branches) {
|
2007-04-24 15:04:12 -07:00
|
|
|
$this->CheckLog(
|
|
|
|
log => catfile($logDir,
|
|
|
|
'build_config-checkout-' . $branch . '.log'),
|
|
|
|
notAllowed => 'fail',
|
|
|
|
);
|
2007-09-18 16:38:06 -07:00
|
|
|
|
2007-04-24 15:04:12 -07:00
|
|
|
$this->CheckLog(
|
|
|
|
log => catfile($logDir,
|
|
|
|
'build_config-checkout-' . $branch . '.log'),
|
|
|
|
notAllowed => 'aborted',
|
|
|
|
);
|
2007-09-18 16:38:06 -07:00
|
|
|
|
2008-01-17 11:40:20 -08:00
|
|
|
# In nightly mode we don't do any tagging, so there's nothing to verify
|
|
|
|
if ($version eq 'nightly') {
|
|
|
|
$this->Log(msg => 'Skipping tag verification for nightly mode.');
|
|
|
|
} else {
|
|
|
|
$this->CheckLog(
|
|
|
|
log => catfile($logDir, 'build_config-tag-' . $branch . '.log'),
|
|
|
|
checkFor => '^T',
|
|
|
|
);
|
|
|
|
}
|
2007-09-18 16:38:06 -07:00
|
|
|
|
2007-04-24 15:04:12 -07:00
|
|
|
foreach my $configFile ('mozconfig', 'tinder-config.pl') {
|
|
|
|
$this->CheckLog(
|
|
|
|
log => catfile($logDir,
|
|
|
|
'build_config-checkin-' . $configFile . '-' . $branch . '.log'),
|
|
|
|
notAllowed => 'fail',
|
|
|
|
);
|
|
|
|
$this->CheckLog(
|
|
|
|
log => catfile($logDir,
|
|
|
|
'build_config-checkin-' . $configFile . '-' . $branch . '.log'),
|
|
|
|
notAllowed => 'aborted',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-01-18 13:02:39 -08:00
|
|
|
|
|
|
|
sub DetermineBranches {
|
|
|
|
my $this = shift;
|
|
|
|
my %args = @_;
|
|
|
|
|
|
|
|
my $config = new Bootstrap::Config();
|
|
|
|
my $version = $config->Get(var => 'version');
|
|
|
|
my $branchTag = $config->Get(var => 'branchTag');
|
|
|
|
|
|
|
|
my @branches = ();
|
|
|
|
# tinderbox-configs tags are different on branches vs trunk
|
|
|
|
# Additionally, nightlies use different branches
|
|
|
|
# Do the right thing in all cases
|
|
|
|
if ($branchTag eq 'HEAD') {
|
|
|
|
if ($version eq 'nightly') {
|
|
|
|
push(@branches, ('HEAD', 'l10n'));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
push(@branches, ('release', 'l10n_release'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if ($version eq 'nightly') {
|
|
|
|
push(@branches, $branchTag);
|
2008-01-18 14:08:22 -08:00
|
|
|
push(@branches, $branchTag . '_l10n');
|
2008-01-18 13:02:39 -08:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
push(@branches, $branchTag . '_release');
|
|
|
|
push(@branches, $branchTag . '_l10n_release');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return \@branches;
|
|
|
|
}
|