From b21a3698103fc3623385c2c5dfd50b160628a38a Mon Sep 17 00:00:00 2001 From: "rhelmer@mozilla.com" Date: Mon, 1 Oct 2007 20:00:18 -0700 Subject: [PATCH] automatically sync with stage p=joduinn r=rhelmer --- tools/release/Bootstrap/Config.pm | 5 +- tools/release/Bootstrap/Step/Build.pm | 5 +- tools/release/Bootstrap/Step/PatcherConfig.pm | 20 ++++---- tools/release/Bootstrap/Step/Repack.pm | 4 +- tools/release/Bootstrap/Step/Source.pm | 3 ++ tools/release/Bootstrap/Step/Updates.pm | 4 +- tools/release/Bootstrap/Util.pm | 47 +++++++++++++++++-- tools/release/bootstrap.cfg.example | 2 + 8 files changed, 70 insertions(+), 20 deletions(-) diff --git a/tools/release/Bootstrap/Config.pm b/tools/release/Bootstrap/Config.pm index a7f41c22eb4..905ab93f1dd 100644 --- a/tools/release/Bootstrap/Config.pm +++ b/tools/release/Bootstrap/Config.pm @@ -10,6 +10,7 @@ use POSIX "uname"; use File::Copy qw(move); use Bootstrap::Util qw(GetLocaleManifest CvsCatfile); +use Bootstrap::Util qw(GetFtpNightlyDir); # shared static config my %config; @@ -150,12 +151,10 @@ sub GetFtpCandidateDir { } my $bitsUnsigned = $args{'bitsUnsigned'}; - my $product = $this->Get(var => 'product'); my $version = $this->Get(var => 'version'); my $rc = $this->Get(var => 'rc'); - my $candidateDir = CvsCatfile('/home', 'ftp', 'pub', $product, 'nightly', - $version . '-candidates', 'rc' . $rc ) . '/'; + my $candidateDir = CvsCatfile(GetFtpNightlyDir(), $version . '-candidates', 'rc' . $rc ) . '/'; my $osFileMatch = $this->SystemInfo(var => 'osname'); diff --git a/tools/release/Bootstrap/Step/Build.pm b/tools/release/Bootstrap/Step/Build.pm index c2f89c7df13..87570bf58f0 100644 --- a/tools/release/Bootstrap/Step/Build.pm +++ b/tools/release/Bootstrap/Step/Build.pm @@ -6,7 +6,7 @@ package Bootstrap::Step::Build; use File::Temp qw(tempfile); use Bootstrap::Step; -use Bootstrap::Util qw(CvsCatfile); +use Bootstrap::Util qw(CvsCatfile SyncNightlyDirToStaging); @ISA = ("Bootstrap::Step"); @@ -155,6 +155,8 @@ sub Push { $candidateDir], logFile => $pushLog, ); + + SyncNightlyDirToStaging(); } sub Announce { @@ -241,4 +243,3 @@ sub StoreBuildID() { } 1; - diff --git a/tools/release/Bootstrap/Step/PatcherConfig.pm b/tools/release/Bootstrap/Step/PatcherConfig.pm index 2689f96fc20..173dfe7e2a0 100644 --- a/tools/release/Bootstrap/Step/PatcherConfig.pm +++ b/tools/release/Bootstrap/Step/PatcherConfig.pm @@ -30,7 +30,6 @@ sub Execute { my $oldVersion = $config->Get(var => 'oldVersion'); my $mofoCvsroot = $config->Get(var => 'mofoCvsroot'); my $patcherConfig = $config->Get(var => 'patcherConfig'); - my $stagingServer = $config->Get(var => 'stagingServer'); my $ftpServer = $config->Get(var => 'ftpServer'); my $bouncerServer = $config->Get(var => 'bouncerServer'); @@ -89,6 +88,7 @@ sub BumpPatcherConfig { my $patcherConfig = $config->Get(var => 'patcherConfig'); my $stagingUser = $config->Get(var => 'stagingUser'); my $stagingServer = $config->Get(var => 'stagingServer'); + my $externalStagingServer = $config->Get(var => 'externalStagingServer'); my $ftpServer = $config->Get(var => 'ftpServer'); my $bouncerServer = $config->Get(var => 'bouncerServer'); my $logDir = $config->Get(sysvar => 'logDir'); @@ -170,9 +170,9 @@ sub BumpPatcherConfig { '.%locale%.%platform%.partial.mar'); $partialUpdate->{'betatest-url'} = - 'http://' . $stagingServer. '/pub/mozilla.org/' . $product. '/nightly/' . - $version . '-candidates/' . $rcStr . '/' . $product . '-' . $oldVersion . - '-' . $version . '.%locale%.%platform%.partial.mar'; + 'http://' . $externalStagingServer. '/pub/mozilla.org/' . $product . + '/nightly/' . $version . '-candidates/' . $rcStr . '/' . $product . + '-' . $oldVersion . '-' . $version . '.%locale%.%platform%.partial.mar'; $partialUpdate->{'beta-url'} = 'http://' . $ftpServer . '/pub/mozilla.org/' . $product. '/nightly/' . @@ -192,9 +192,9 @@ sub BumpPatcherConfig { '.%locale%.%platform%.complete.mar'); $completeUpdate->{'betatest-url'} = - 'http://' . $stagingServer . '/pub/mozilla.org/' . $product. '/nightly/' . - $version . '-candidates/' . $rcStr . '/' . $product . '-' . $version . - '.%locale%.%platform%.complete.mar'; + 'http://' . $externalStagingServer . '/pub/mozilla.org/' . $product . + '/nightly/' . $version . '-candidates/' . $rcStr . '/' . $product . + '-' . $version . '.%locale%.%platform%.complete.mar'; $completeUpdate->{'beta-url'} = 'http://' . $ftpServer . '/pub/mozilla.org/' . $product. '/nightly/' . @@ -262,9 +262,9 @@ sub BumpPatcherConfig { $releaseObj->{'locales'} = join(' ', sort (keys(%{$localeInfo}))); $releaseObj->{'completemarurl'} = - 'http://' . $stagingServer . '/pub/mozilla.org/' . $product. '/nightly/' . - $version . '-candidates/' . $rcStr . '/' . $product . '-'. $version . - '.%locale%.%platform%.complete.mar', + 'http://' . $externalStagingServer . '/pub/mozilla.org/' . $product. + '/nightly/' . $version . '-candidates/' . $rcStr . '/' . $product . '-'. + $version . '.%locale%.%platform%.complete.mar', # Compute locale exceptions; # $localeInfo is hash ref of locales -> array of platforms the locale diff --git a/tools/release/Bootstrap/Step/Repack.pm b/tools/release/Bootstrap/Step/Repack.pm index 22255cecd10..4524c3f3e15 100644 --- a/tools/release/Bootstrap/Step/Repack.pm +++ b/tools/release/Bootstrap/Step/Repack.pm @@ -5,7 +5,7 @@ package Bootstrap::Step::Repack; use Bootstrap::Step; use Bootstrap::Config; -use Bootstrap::Util qw(CvsCatfile); +use Bootstrap::Util qw(CvsCatfile SyncNightlyDirToStaging); use MozBuild::Util qw(MkdirWithPath); @ISA = ("Bootstrap::Step"); @@ -232,6 +232,8 @@ sub Push { $pushDir, $candidateDir], logFile => $pushLog, ); + + SyncNightlyDirToStaging(); } sub Announce { diff --git a/tools/release/Bootstrap/Step/Source.pm b/tools/release/Bootstrap/Step/Source.pm index 8287d793081..2df7e150016 100644 --- a/tools/release/Bootstrap/Step/Source.pm +++ b/tools/release/Bootstrap/Step/Source.pm @@ -7,6 +7,7 @@ use Bootstrap::Step; use Bootstrap::Config; use File::Copy qw(move); use MozBuild::Util qw(MkdirWithPath); +use Bootstrap::Util qw(SyncNightlyDirToStaging); @ISA = ("Bootstrap::Step"); sub Execute { @@ -88,6 +89,8 @@ sub Push { logFile => catfile($logDir, 'source.log'), dir => catfile($stageDir), ); + + SyncNightlyDirToStaging(); } sub Announce { diff --git a/tools/release/Bootstrap/Step/Updates.pm b/tools/release/Bootstrap/Step/Updates.pm index f496d04f831..7e0360abd30 100644 --- a/tools/release/Bootstrap/Step/Updates.pm +++ b/tools/release/Bootstrap/Step/Updates.pm @@ -6,7 +6,7 @@ package Bootstrap::Step::Updates; use Bootstrap::Step; use Bootstrap::Config; -use Bootstrap::Util qw(CvsCatfile); +use Bootstrap::Util qw(CvsCatfile SyncNightlyDirToStaging); use File::Find qw(find); use POSIX qw(strftime); @@ -260,6 +260,8 @@ sub Push { logFile => $pushLog, ); } + + SyncNightlyDirToStaging(); } sub Announce { diff --git a/tools/release/Bootstrap/Util.pm b/tools/release/Bootstrap/Util.pm index 0a211f24866..e01a8286f24 100644 --- a/tools/release/Bootstrap/Util.pm +++ b/tools/release/Bootstrap/Util.pm @@ -5,16 +5,17 @@ package Bootstrap::Util; use File::Temp qw(tempfile tempdir); - +use File::Spec::Functions; use MozBuild::Util qw(RunShellCommand); - use base qw(Exporter); our @EXPORT_OK = qw(CvsCatfile CvsTag GetDiffFileList + GetFtpNightlyDir GetLocaleManifest GetBouncerPlatforms GetPatcherPlatforms - GetBouncerToPatcherPlatformMap); + GetBouncerToPatcherPlatformMap + SyncNightlyDirToStaging); our($DEFAULT_SHELL_TIMEOUT); @@ -61,6 +62,21 @@ sub GetBouncerPlatforms { return keys(%PLATFORM_MAP); } +## +# GetFtpNightlyDir - construct the FTP path for pushing builds & updates to +# returns scalar +# +# no mandatory arguments +## + +sub GetFtpNightlyDir { + my $config = new Bootstrap::Config(); + my $product = $config->Get(var => 'product'); + + my $nightlyDir = CvsCatfile('/home', 'ftp', 'pub', $product, 'nightly') . '/'; + return $nightlyDir; +} + sub GetPatcherPlatforms { return values(%PLATFORM_MAP); } @@ -270,4 +286,29 @@ sub GetDiffFileList { return \@differentFiles; } +sub SyncNightlyDirToStaging { + my $config = new Bootstrap::Config(); + my $productTag = $config->Get(var => 'productTag'); + my $rc = $config->Get(var => 'rc'); + my $logDir = $config->Get(sysvar => 'logDir'); + my $externalStagingUser = $config->Get(var => 'externalStagingUser'); + my $externalStagingServer = $config->Get(var => 'externalStagingServer'); + + my $rcTag = $productTag . '_RC' . $rc; + my $pushLog = catfile($logDir, 'build_' . $rcTag . '-push.log'); + my $nightlyDir = $config->GetFtpNightlyDir(); + + + my $command = 'rsync'; + my @cmdArgs = ('-av', $nightlyDir, $externalStagingUser.'@'.$externalStagingServer.':'.$nightlyDir); + print 'Bootstrap::Util::SyncNightlyDirToStaging() Running shell command: '.$command.' '.join(' ', @cmdArgs)."\n"; + my $rv = RunShellCommand(command => $command, + args => \@cmdArgs, + redirectStderr => 0, + logfile => $pushLog); + if ($rv->{'exitValue'} != 0) { + die "ASSERT: SyncNightlyDirToStaging(): rsync failed\n"; + } + +} 1; diff --git a/tools/release/bootstrap.cfg.example b/tools/release/bootstrap.cfg.example index 56543fd2759..c5110194e12 100644 --- a/tools/release/bootstrap.cfg.example +++ b/tools/release/bootstrap.cfg.example @@ -56,6 +56,8 @@ buildTree = MozillaTest # where QA updates/builds go stagingUser = cltbld stagingServer = stage.mozilla.org +externalStagingUser = cltbld +externalStagingServer = staging-build-console.build.mozilla.org # where beta updates/builds go ftpServer = ftp.mozilla.org # where release updates/builds go