bug 409395: factor out Bootstrap's 'useTarGz' logic to a helper function
authorbhearsum@mozilla.com
Fri, 28 Dec 2007 06:36:18 -0800
changeset 9704 3e1daf1c9e20ed2314b13fa5dc859997853dab2d
parent 9703 34e67a2cbe1491e8919824d93e322301d826d832
child 9705 d1b21ff51425ebdf496ace7dfb418eb3717c20a6
push idunknown
push userunknown
push dateunknown
bugs409395
milestone1.9b3pre
bug 409395: factor out Bootstrap's 'useTarGz' logic to a helper function
tools/release/Bootstrap/Config.pm
tools/release/Bootstrap/Step/Repack.pm
tools/release/Bootstrap/Step/Stage.pm
tools/release/Bootstrap/Step/Updates.pm
--- a/tools/release/Bootstrap/Config.pm
+++ b/tools/release/Bootstrap/Config.pm
@@ -160,16 +160,27 @@ sub GetFtpCandidateDir {
 
     if ($bitsUnsigned && ($osFileMatch eq 'win32')  && ($version ge '2.0')) {
         $candidateDir .= 'unsigned/';
     }
 
     return $candidateDir;  
 }
 
+sub GetLinuxExtension {
+    my $this = shift;
+
+    # We are assuming tar.bz2 to help minimize bootstrap.cfg variables in
+    # the future. tar.gz support can probably be removed once we stop
+    # building/releasing products that use it.
+    my $useTarGz = $this->Exists(var => 'useTarGz') ?
+     $this->Get(var => 'useTarGz') : 0;
+    return ($useTarGz) ? 'gz' : 'bz2';
+}
+
 ##
 # Exists checks to see if a config variable exists.
 # Returns boolean (1 or 0)
 #
 # This method supports system-specific overrides, or "sysvar"s.
 #  For example, if a caller is on win32 and does 
 #  Exists(sysvar => "win32_buildDir") and only buildDir exists, a 0
 #  will be returned. There is no "fallback" as in the case of Get.
--- a/tools/release/Bootstrap/Step/Repack.pm
+++ b/tools/release/Bootstrap/Step/Repack.pm
@@ -67,21 +67,19 @@ sub Verify {
     my $rc = $config->Get(var => 'rc');
     my $oldRc = $config->Get(var => 'oldRc');
     my $logDir = $config->Get(sysvar => 'logDir');
     my $version = $config->Get(var => 'version');
     my $oldVersion = $config->Get(var => 'oldVersion');
     my $mozillaCvsroot = $config->Get(var => 'mozillaCvsroot');
     my $verifyDir = $config->Get(var => 'verifyDir');
     my $stagingServer = $config->Get(var => 'stagingServer');
-    my $useTarGz = $config->Exists(var => 'useTarGz') ?
-     $config->Get(var => 'useTarGz') : 0;
+    my $linuxExtension = $config->GetLinuxExtension();
     my $rcTag = $productTag.'_RC'.$rc;
 
-    my $linuxExtension = ($useTarGz) ? '.gz' : '.bz2';
     # l10n metadiff test
 
     my $verifyDirVersion = catfile($verifyDir, $product . '-' . $version);
 
     MkdirWithPath(dir => $verifyDirVersion)
       or die("Cannot mkdir $verifyDirVersion: $!");
 
     # check out l10n verification scripts
@@ -98,17 +96,17 @@ sub Verify {
 
     # Download current release
     $this->Shell(
       cmd => 'rsync',
       cmdArgs => ['-Lav', 
                   '-e', 'ssh', 
                   '--include=*.dmg',
                   '--include=*.exe',
-                  '--include=*.tar'.$linuxExtension,
+                  '--include=*.tar.'.$linuxExtension,
                   '--exclude=*',
                   $stagingServer . ':/home/ftp/pub/' . $product
                   . '/nightly/' . $version . '-candidates/rc' . $rc . '/*',
                   $product . '-' . $version . '-rc' . $rc . '/',
                  ],
       dir => catfile($verifyDirVersion, 'l10n'),
       logFile => 
         catfile($logDir, 'repack_verify-download_' . $version . '.log'),
@@ -117,17 +115,17 @@ sub Verify {
 
     # Download previous release
     $this->Shell(
       cmd => 'rsync',
       cmdArgs => ['-Lav', 
                   '-e', 'ssh', 
                   '--include=*.dmg',
                   '--include=*.exe',
-                  '--include=*.tar'.$linuxExtension,
+                  '--include=*.tar.'.$linuxExtension,
                   '--exclude=*',
                   $stagingServer . ':/home/ftp/pub/' . $product
                   . '/nightly/' . $oldVersion . '-candidates/rc' 
                   . $oldRc . '/*',
                   $product . '-' . $oldVersion . '-rc' . $oldRc . '/',
                  ],
       dir => catfile($verifyDirVersion, 'l10n'),
       logFile => 
--- a/tools/release/Bootstrap/Step/Stage.pm
+++ b/tools/release/Bootstrap/Step/Stage.pm
@@ -430,19 +430,17 @@ sub Verify {
     my $product = $config->Get(var => 'product');
     my $appName = $config->Get(var => 'appName');
     my $logDir = $config->Get(sysvar => 'logDir');
     my $version = $config->Get(var => 'version');
     my $rc = $config->Get(var => 'rc');
     my $stageHome = $config->Get(var => 'stageHome');
     my $productTag = $config->Get(var => 'productTag');
     my $mozillaCvsroot = $config->Get(var => 'mozillaCvsroot');
-    my $useTarGz = $config->Exists(var => 'useTarGz') ?
-     $config->Get(var => 'useTarGz') : 0;
-    my $linuxExtension = ($useTarGz) ? 'gz' : 'bz2';
+    my $linuxExtension = $config->GetLinuxExtension();
  
     ## Prepare the staging directory for the release.
     # Create the staging directory.
 
     my $stageDir = $this->GetStageDir();
 
     # check out locales manifest (shipped-locales)
     $this->Shell(
@@ -619,19 +617,17 @@ sub TrimCallback {
 }
 
 sub IsValidLocaleDeliverable {
     my $this = shift;
     my %args = @_;
 
     my $config = new Bootstrap::Config();
 
-    my $useTarGz = $config->Exists(var => 'useTarGz') ?
-     $config->Get(var => 'useTarGz') : 0;
-    my $linuxExtension = ($useTarGz) ? 'gz' : 'bz2';
+    my $linuxExtension = $config->GetLinuxExtension();
 
     my $dirent = $File::Find::name;
 
     my ($locale, $platform);
     my @parts = split(/\./, basename($dirent));
     my $partsCount = scalar(@parts);
 
     if ($dirent =~ /\.tar\.$linuxExtension/) {
--- a/tools/release/Bootstrap/Step/Updates.pm
+++ b/tools/release/Bootstrap/Step/Updates.pm
@@ -227,23 +227,17 @@ sub BumpVerifyConfig {
     my $oldRc = $config->Get(var => 'oldRc');
     my $appName = $config->Get(var => 'appName');
     my $mozillaCvsroot = $config->Get(var => 'mozillaCvsroot');
     my $verifyDir = $config->Get(var => 'verifyDir');
     my $ausServerUrl = $config->Get(var => 'ausServerUrl');
     my $externalStagingServer = $config->Get(var => 'externalStagingServer');
     my $verifyConfig = $config->Get(sysvar => 'verifyConfig');
     my $logDir = $config->Get(sysvar => 'logDir');
-    # We are assuming tar.bz2 to help minimize bootstrap.cfg variables in
-    # the future. tar.gz support can probably be removed once we stop
-    # building/releasing products that use it.
-    my $useTarGz = $config->Exists(var => 'useTarGz') ?
-     $config->Get(var => 'useTarGz') : 0;
-    my $linuxExtension = ($useTarGz) ? '.gz' : '.bz2';
-
+    my $linuxExtension = $config->GetLinuxExtension();
 
     my $verifyDirVersion = catfile($verifyDir, $product . '-' . $version);
     my $configFile = catfile($verifyDirVersion, 'updates', $verifyConfig);
 
     # NOTE - channel is hardcoded to betatest
     my $channel = 'betatest';
 
     # grab os-specific buildID file on FTP
@@ -255,18 +249,18 @@ sub BumpVerifyConfig {
     my $releaseFile = undef;
     my $nightlyFile = undef;
     my $ftpOsname = undef;
 
     if ($osname eq 'linux') {
         $buildTarget = 'Linux_x86-gcc3';
         $platform = 'linux';
         $ftpOsname = 'linux-i686';
-        $releaseFile = $product.'-'.$oldVersion.'.tar'.$linuxExtension;
-        $nightlyFile = $product.'-'.$version.'.%locale%.linux-i686.tar'.
+        $releaseFile = $product.'-'.$oldVersion.'.tar.'.$linuxExtension;
+        $nightlyFile = $product.'-'.$version.'.%locale%.linux-i686.tar.'.
          $linuxExtension;
     } elsif ($osname eq 'macosx') {
         $buildTarget = 'Darwin_Universal-gcc3';
         $platform = 'osx';
         $ftpOsname = 'mac';
         $releaseFile = ucfirst($product).' '.$oldVersion.'.dmg';
         $nightlyFile = $product.'-'.$version.'.%locale%.mac.dmg';
     } elsif ($osname eq 'win32') {