pass build ID to FTP for use by PatcherConfig b=387970 r=preed
git-svn-id: svn://10.0.0.236/trunk@232082 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#
|
||||
package Bootstrap::Step::Build;
|
||||
|
||||
use File::Temp qw(tempfile);
|
||||
|
||||
use Bootstrap::Step;
|
||||
|
||||
@ISA = ("Bootstrap::Step");
|
||||
@@ -37,6 +39,7 @@ sub Execute {
|
||||
timeout => 36000
|
||||
);
|
||||
|
||||
$this->StoreBuildID();
|
||||
}
|
||||
|
||||
sub Verify {
|
||||
@@ -94,11 +97,13 @@ sub Push {
|
||||
my $candidateDir = $config->GetFtpCandidateDir(bitsUnsigned => 1);
|
||||
|
||||
my $osFileMatch = $config->SystemInfo(var => 'osname');
|
||||
|
||||
# TODO - use a more generic function for this kind of remapping
|
||||
if ($osFileMatch eq 'win32') {
|
||||
$osFileMatch = 'win';
|
||||
} elsif ($osFileMatch eq 'macosx') {
|
||||
$osFileMatch = 'mac';
|
||||
}
|
||||
}
|
||||
|
||||
$this->Shell(
|
||||
cmd => 'ssh',
|
||||
@@ -151,5 +156,55 @@ sub Announce {
|
||||
);
|
||||
}
|
||||
|
||||
sub StoreBuildID() {
|
||||
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!;
|
||||
|
||||
# drop os-specific buildID file on FTP
|
||||
my $buildID = $logParser->GetBuildID();
|
||||
if (! defined($buildID)) {
|
||||
die("No buildID found in $buildLog");
|
||||
}
|
||||
if (! $buildID =~ /^\d+$/) {
|
||||
die("ASSERT: Build: build ID is not numerical: $buildID")
|
||||
}
|
||||
|
||||
|
||||
my $osFileMatch = $config->SystemInfo(var => 'osname');
|
||||
|
||||
my ($bh, $buildIDTempFile) = tempfile(DIR => '.');
|
||||
print $bh 'buildID=' . $buildID;
|
||||
$bh->close() ||
|
||||
die("Could not open buildID temp file $buildIDTempFile: $!");
|
||||
|
||||
my $buildIDFile = $osFileMatch . '_info.txt';
|
||||
$this->Shell(
|
||||
cmd => 'scp',
|
||||
cmdArgs => [$buildIDTempFile,
|
||||
$sshUser . '@' . $sshServer . ':' .
|
||||
$pushDir . '/' . $buildIDFile],
|
||||
logFile => $pushLog,
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package Bootstrap::Step::PatcherConfig;
|
||||
|
||||
use Config::General;
|
||||
use File::Temp qw(tempfile);
|
||||
|
||||
use MozBuild::Util qw(MkdirWithPath);
|
||||
|
||||
@@ -83,6 +84,9 @@ sub BumpPatcherConfig {
|
||||
my $oldRc = $config->Get(var => 'oldRc');
|
||||
my $localeInfo = $config->GetLocaleInfo();
|
||||
my $patcherConfig = $config->Get(var => 'patcherConfig');
|
||||
my $sshUser = $config->Get(var => 'sshUser');
|
||||
my $sshServer = $config->Get(var => 'sshServer');
|
||||
my $logDir = $config->Get(var => 'logDir');
|
||||
|
||||
# First, parse the file.
|
||||
my $checkedOutPatcherConfig = catfile($configBumpDir, 'patcher',
|
||||
@@ -196,11 +200,50 @@ sub BumpPatcherConfig {
|
||||
$releaseObj->{'schema'} = '1';
|
||||
$releaseObj->{'version'} = $releaseObj->{'extension-version'} = $version;
|
||||
|
||||
## XXX - Dummy data for now...
|
||||
my $linBuildId = '1234567890';
|
||||
my $winBuildId = '1234567891';
|
||||
my $macBuildId = '1234567892';
|
||||
|
||||
my $linBuildId;
|
||||
my $winBuildId;
|
||||
my $macBuildId;
|
||||
|
||||
# grab os-specific buildID file on FTP
|
||||
my $candidateDir = $config->GetFtpCandidateDir(bitsUnsigned => 0);
|
||||
foreach my $os ('linux', 'macosx', 'win32') {
|
||||
my ($bh, $buildIDTempFile) = tempfile(DIR => '.');
|
||||
$bh->close();
|
||||
$this->Shell(
|
||||
cmd => 'scp',
|
||||
cmdArgs => [$sshUser . '@' . $sshServer . ':' .
|
||||
$candidateDir .'/' . $os . '_info.txt',
|
||||
$buildIDTempFile],
|
||||
);
|
||||
my $buildID;
|
||||
open(FILE, "< $buildIDTempFile") ||
|
||||
die("Could not open buildID temp file $buildIDTempFile: $!");
|
||||
while (<FILE>) {
|
||||
my ($var, $value) = split(/\s*=\s*/, $_, 2);
|
||||
if ($var eq 'buildID') {
|
||||
$buildID = $value;
|
||||
}
|
||||
}
|
||||
close(FILE) ||
|
||||
die("Could not close buildID temp file $buildIDTempFile: $!");
|
||||
if (! defined($buildID)) {
|
||||
die("Could not read buildID from temp file $buildIDTempFile: $!");
|
||||
}
|
||||
if (! $buildID =~ /^\d+$/) {
|
||||
die("ASSERT: BumpPatcherConfig: $buildID is non-numerical");
|
||||
}
|
||||
chomp($buildID);
|
||||
if ($os eq 'linux') {
|
||||
$linBuildId = "$buildID";
|
||||
} elsif ($os eq 'macosx') {
|
||||
$macBuildId = "$buildID";
|
||||
} elsif ($os eq 'win32') {
|
||||
$winBuildId = "$buildID";
|
||||
} else {
|
||||
die("ASSERT: BumpPatcherConfig(): unknown OS $os");
|
||||
}
|
||||
}
|
||||
|
||||
$releaseObj->{'platforms'} = { 'linux-i686' => $linBuildId,
|
||||
'win32' => $winBuildId,
|
||||
'mac' => $macBuildId };
|
||||
|
||||
@@ -45,13 +45,21 @@ sub GetBuildID {
|
||||
$buildID =~ s/$searchString//;
|
||||
|
||||
# remove trailing slash
|
||||
$buildID =~ s/^\.//;
|
||||
$buildID =~ s/\.$//;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
close FILE or die("Cannot close file $log: $!");
|
||||
|
||||
if (! defined($buildID)) {
|
||||
return undef;
|
||||
}
|
||||
if (! $buildID =~ /^\d+$/) {
|
||||
die("ASSERT: Build: build ID is not numerical: $buildID")
|
||||
}
|
||||
|
||||
chomp($buildID);
|
||||
return $buildID;
|
||||
}
|
||||
|
||||
@@ -86,8 +94,14 @@ sub GetPushDir {
|
||||
}
|
||||
|
||||
close FILE or die("Cannot close file $log: $!");
|
||||
|
||||
if (! defined($pushDir)) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
chomp($pushDir);
|
||||
# remove empty space at end of URL
|
||||
$pushDir =~ s/\s+$//;
|
||||
|
||||
return $pushDir;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user