Files
Mozilla/mozilla/tools/release/Bootstrap/Step/Updates.pm
rhelmer%mozilla.com b10dcf0c62 move to new RunShellCommand, split into substeps, various fixes and features. r=preed, b=368579
git-svn-id: svn://10.0.0.236/trunk@219314 18797224-902f-48f8-a5cc-f745e15eee43
2007-02-01 03:50:47 +00:00

148 lines
4.7 KiB
Perl

#
# Updates step. Generates binary update (MAR) files as well as AUS config
# snippets.
#
package Bootstrap::Step::Updates;
use Bootstrap::Step;
use Bootstrap::Config;
use File::Find qw(find);
use MozBuild::Util qw(MkdirWithPath);
@ISA = ("Bootstrap::Step");
my $config = new Bootstrap::Config;
sub Execute {
my $this = shift;
my $product = $config->Get('var' => 'product');
my $logDir = $config->Get('var' => 'logDir');
my $version = $config->Get('var' => 'version');
my $mozillaCvsroot = $config->Get('var' => 'mozillaCvsroot');
my $mofoCvsroot = $config->Get('var' => 'mofoCvsroot');
my $updateDir = $config->Get('var' => 'updateDir');
my $patcherConfig = $config->Get('var' => 'patcherConfig');
# Create updates area.
if (not -d $updateDir) {
MkdirWithPath('dir' => $updateDir)
or die "Cannot mkdir $updateDir: $!";
}
$this->Shell(
'cmd' => 'cvs',
'cmdArgs' => ['-d', $mozillaCvsroot, 'co', '-d', 'patcher',
catfile('mozilla', 'tools', 'patcher')],
'logFile' => catfile($logDir, 'updates_patcher-checkout.log'),
'dir' => $updateDir,
);
# config lives in private repo
$this->Shell(
'cmd' => 'cvs',
'cmdArgs' => ['-d', $mofoCvsroot, 'co', '-d', 'config',
catfile('release', 'patcher', $patcherConfig)],
'logFile' => catfile($logDir, 'updates_patcher-config-checkout.log'),
'dir' => $updateDir,
);
# build tools
my $originalCvsrootEnv = $ENV{'CVSROOT'};
$ENV{'CVSROOT'} = $mozillaCvsroot;
$this->Shell(
'cmd' => './patcher2.pl',
'cmdArgs' => ['--build-tools', '--app=' . $product,
'--config=../config/' . $patcherConfig],
'logFile' => catfile($logDir, 'updates_patcher-build-tools.log'),
'dir' => catfile($updateDir, 'patcher'),
);
if ($originalCvsrootEnv) {
$ENV{'CVSROOT'} = $originalCvsrootEnv;
}
# download complete MARs
$this->Shell(
'cmd' => './patcher2.pl',
'cmdArgs' => ['--download', '--app=' . $product,
'--config=../config/' . $patcherConfig],
'logFile' => catfile($logDir, 'updates_patcher-download.log'),
'dir' => catfile($updateDir, 'patcher'),
);
# Create partial patches and snippets
$this->Shell(
'cmd' => './patcher2.pl',
'cmdArgs' => ['--create-patches', '--app=' . $product,
'--config=../config/' . $patcherConfig],
'logFile' => catfile($logDir, 'updates_patcher-create-patches.log'),
'dir' => catfile($updateDir, 'patcher'),
'timeout' => 18000,
);
### quick verification
# ensure that there are only test channels
my $testDir = catfile($updateDir, 'patcher', 'temp', $product,
$oldVersion . '-' . $version, 'aus2.test');
File::Find::find(\&TestAusCallback, $testDir);
}
sub Verify {
my $this = shift;
my $logDir = $config->Get('var' => 'logDir');
my $version = $config->Get('var' => 'version');
my $oldVersion = $config->Get('var' => 'oldVersion');
my $mozillaCvsroot = $config->Get('var' => 'mozillaCvsroot');
my $updateDir = $config->Get('var' => 'updateDir');
my $verifyDir = $config->Get('var' => 'verifyDir');
my $product = $config->Get('var' => 'product');
# Create verification area.
my $verifyDirVersion = catfile($verifyDir, $product . '-' . $version);
MkdirWithPath('dir' => $verifyDirVersion)
or die("Could not mkdir $verifyDirVersion: $!");
foreach my $dir ('updates', 'common') {
$this->Shell(
'cmd' => 'cvs',
'cmdArgs' => ['-d', $mozillaCvsroot, 'co', '-d', $dir,
catfile('mozilla', 'testing', 'release', $dir)],
'logFile' => catfile($logDir,
'updates_verify_checkout-' . $dir . '.log'),
'dir' => $verifyDirVersion,
);
}
# Customize updates.cfg to contain the channels you are interested in
# testing.
$this->Shell(
'cmd' => './verify.sh',
'cmdArgs' => ['-c'],
'logFile' => catfile($logDir, 'updates_verify.log'),
'dir' => catfile($verifyDirVersion, 'updates'),
);
}
sub TestAusCallback {
my $dir = $File::Find::name;
if (($dir =~ /beta/) or ($dir =~ /release/)) {
if (not $dir =~ /test/) {
die("Non-test directory found in $testDir/aus2.test: $dir");
}
}
}
sub Announce {
my $this = shift;
my $product = $config->Get('var' => 'product');
my $version = $config->Get('var' => 'version');
$this->SendAnnouncement(
subject => "$product $version update step finished",
message => "$product $version updates are ready to be deployed to AUS and the candidates dir.",
);
}
1;