Bug 378226, Push() subroutines for Build & Repack steps, r=rhelmer

This commit is contained in:
nrthomas@gmail.com 2007-07-12 10:47:39 -07:00
parent 701cf071d3
commit c210754cf2
4 changed files with 145 additions and 3 deletions

View File

@ -9,7 +9,7 @@ use strict;
use POSIX "uname";
use File::Copy qw(move);
use Bootstrap::Util qw(GetLocaleManifest);
use Bootstrap::Util qw(GetLocaleManifest CvsCatfile);
# shared static config
my %config;
@ -132,6 +132,40 @@ sub GetLocaleInfo {
return $this->Get(var => 'localeInfo');
}
##
# GetFtpCandidateDir - construct the FTP path for pushing builds & updates to
# returns scalar
#
# mandatory argument:
# bitsUnsigned - boolean - 1 for unsigned, 0 for signed
# adds "unsigned/" prefix for windows and version >= 2.0
##
sub GetFtpCandidateDir {
my $this = shift;
my %args = @_;
if (! defined($args{'bitsUnsigned'})) {
die "ASSERT: Bootstep::Config::GetFtpCandidateDir(): bitsUnsigned is a required argument";
}
my $bitsUnsigned = $args{'bitsUnsigned'};
my $product = $config{'product'};
my $version = $config{'version'};
my $rc = $config{'rc'};
my $candidateDir = CvsCatfile('/home', 'ftp', 'pub', $product, 'nightly',
$version . '-candidates', 'rc' . $rc ) . '/';
my $osFileMatch = $this->SystemInfo(var => 'osname');
if ($bitsUnsigned && ($osFileMatch eq 'win32') && ($version ge '2.0')) {
$candidateDir .= 'unsigned/';
}
return $candidateDir;
}
##
# Exists checks to see if a config variable exists.
# Returns boolean (1 or 0)

View File

@ -2,7 +2,9 @@
# Build step. Calls tinderbox to produce en-US Firefox build.
#
package Bootstrap::Step::Build;
use Bootstrap::Step;
@ISA = ("Bootstrap::Step");
sub Execute {
@ -66,6 +68,57 @@ sub Verify {
}
}
sub Push {
my $this = shift;
my $config = new Bootstrap::Config();
my $productTag = $config->Get(var => 'productTag');
my $rc = $config->Get(var => 'rc');
my $logDir = $config->Get(var => 'logDir');
my $sshUser = $config->Get(var => 'sshUser');
my $sshServer = $config->Get(var => 'sshServer');
my $rcTag = $productTag . '_RC' . $rc;
my $buildLog = catfile($logDir, 'build_' . $rcTag . '-build.log');
my $pushLog = catfile($logDir, 'build_' . $rcTag . '-push.log');
my $logParser = new MozBuild::TinderLogParse(
logFile => $buildLog,
);
my $pushDir = $logParser->GetPushDir();
if (! defined($pushDir)) {
die("No pushDir found in $buildLog");
}
$pushDir =~ s!^http://ftp.mozilla.org/pub/mozilla.org!/home/ftp/pub!;
my $candidateDir = $config->GetFtpCandidateDir(bitsUnsigned => 1);
my $osFileMatch = $config->SystemInfo(var => 'osname');
if ($osFileMatch eq 'win32') {
$osFileMatch = 'win';
} elsif ($osFileMatch eq 'macosx') {
$osFileMatch = 'mac';
}
$this->Shell(
cmd => 'ssh',
cmdArgs => ['-2', '-l', $sshUser, $sshServer,
'mkdir -p ' . $candidateDir],
logFile => $pushLog,
);
$this->Shell(
cmd => 'ssh',
cmdArgs => ['-2', '-l', $sshUser, $sshServer,
'rsync', '-av',
'--include=*' . $osFileMatch . '*',
'--exclude=*',
$pushDir,
$candidateDir],
logFile => $pushLog,
);
}
sub Announce {
my $this = shift;
@ -94,8 +147,9 @@ sub Announce {
$this->SendAnnouncement(
subject => "$product $version build step finished",
message => "$product $version en-US build is ready to be copied to the candidates dir.\nBuild ID is $buildID\nPush Dir is $pushDir",
message => "$product $version en-US build was copied to the candidates dir.\nBuild ID is $buildID\nPush Dir was $pushDir",
);
}
1;

View File

@ -160,6 +160,58 @@ sub Verify {
logFile => catfile($logDir, 'repack_metadiff-l10n_verification.log'),
);
}
sub Push {
my $this = shift;
my $config = new Bootstrap::Config();
my $productTag = $config->Get(var => 'productTag');
my $rc = $config->Get(var => 'rc');
my $logDir = $config->Get(var => 'logDir');
my $sshUser = $config->Get(var => 'sshUser');
my $sshServer = $config->Get(var => 'sshServer');
my $rcTag = $productTag . '_RC' . $rc;
my $buildLog = catfile($logDir, 'repack_' . $rcTag . '-build-l10n.log');
my $pushLog = catfile($logDir, 'repack_' . $rcTag . '-push-l10n.log');
my $logParser = new MozBuild::TinderLogParse(
logFile => $buildLog,
);
my $pushDir = $logParser->GetPushDir();
if (! defined($pushDir)) {
die("No pushDir found in $buildLog");
}
$pushDir =~ s!^http://ftp.mozilla.org/pub/mozilla.org!/home/ftp/pub!;
my $candidateDir = $config->GetFtpCandidateDir(bitsUnsigned => 1);
my $osFileMatch = $config->SystemInfo(var => 'osname');
if ($osFileMatch eq 'win32') {
$osFileMatch = 'win';
} elsif ($osFileMatch eq 'macosx') {
$osFileMatch = 'mac';
}
$this->Shell(
cmd => 'ssh',
cmdArgs => ['-2', '-l', $sshUser, $sshServer,
'mkdir -p ' . $candidateDir],
logFile => $pushLog,
);
$this->Shell(
cmd => 'ssh',
cmdArgs => ['-2', '-l', $sshUser, $sshServer,
'rsync', '-av',
'--include=*' . $osFileMatch . '*',
'--include=*.xpi',
'--exclude=*',
$pushDir, $candidateDir],
logFile => $pushLog,
);
}
sub Announce {
my $this = shift;
@ -185,7 +237,7 @@ sub Announce {
$this->SendAnnouncement(
subject => "$product $version l10n repack step finished",
message => "$product $version l10n builds are ready to be copied to the candidates directory.\nPush Dir is $pushDir",
message => "$product $version l10n builds were copied to the candidates directory.\nPush Dir was $pushDir",
);
}

View File

@ -87,6 +87,8 @@ sub GetPushDir {
close FILE or die("Cannot close file $log: $!");
chomp($pushDir);
return $pushDir;
}