move tarball creation into bootstrap b=394034 r=joduinn
authorrhelmer@mozilla.com
Wed, 03 Oct 2007 12:45:43 -0700
changeset 6607 ece4d75b0ff69ab8e30db7c762925205a7946ccc
parent 6606 61c9c1393df005c838a3a8c538526b105b674ac7
child 6608 80335b4ed462447259bbb2cfeb0590f339ac6ad2
push idunknown
push userunknown
push dateunknown
reviewersjoduinn
bugs394034
milestone1.9a9pre
move tarball creation into bootstrap b=394034 r=joduinn
tools/release/Bootstrap/Step/Source.pm
tools/release/bootstrap.cfg.example
--- a/tools/release/Bootstrap/Step/Source.pm
+++ b/tools/release/Bootstrap/Step/Source.pm
@@ -1,50 +1,76 @@
 #
 # Source step. Creates a source tarball equivalent to what was used to 
 # build the binary release, in the Build step.
 # 
 package Bootstrap::Step::Source;
 use Bootstrap::Step;
 use Bootstrap::Config;
 use File::Copy qw(move);
+use File::Find qw(find);
 use MozBuild::Util qw(MkdirWithPath);
 use Bootstrap::Util qw(SyncNightlyDirToStaging);
 @ISA = ("Bootstrap::Step");
 
 sub Execute {
     my $this = shift;
 
     my $config = new Bootstrap::Config();
     my $product = $config->Get(var => 'product');
+    my $appName = $config->Get(var => 'appName');
     my $productTag = $config->Get(var => 'productTag');
     my $version = $config->Get(var => 'version');
     my $rc = $config->Get(var => 'rc');
     my $logDir = $config->Get(sysvar => 'logDir');
     my $stageHome = $config->Get(var => 'stageHome');
+    my $mozillaCvsroot = $config->Get(var => 'mozillaCvsroot');
 
     # create staging area
     my $stageDir = catfile($stageHome, $product . '-' . $version, 
                            'batch-source', 'rc' . $rc);
 
     if (not -d $stageDir) {
         MkdirWithPath(dir => $stageDir) 
           or die("Cannot create $stageDir: $!");
     }
 
-    my $srcScript = $product . '-src-tarball-nobuild';
+    $this->Shell(
+      cmd => 'cvs',
+      cmdArgs => ['-d', $mozillaCvsroot, 
+                  'co', '-r', $productTag . '_RELEASE',
+                  'mozilla/client.mk', catfile('mozilla', $appName, 'config')],
+      dir => $stageDir,
+      logFile => catfile($logDir, 'source_checkout.log'),
+    );
+
     $this->Shell(
-      cmd => catfile($stageHome, 'bin', $srcScript),
-      cmdArgs => ['-r', $productTag . '_RELEASE', '-m', $version],
-      dir => $stageDir,
-      logFile => catfile($logDir, 'source.log'),
+      cmd => 'make',
+      cmdArgs => ['-f', 'client.mk', 'checkout',
+                  'MOZ_CO_PROJECT=' . $appName],
+      dir => catfile($stageDir, 'mozilla'),
+      logFile => catfile($logDir, 'source_make.log'),
+    );
+
+    # change all CVS/Root files to anonymous CVSROOT
+    File::Find::find(\&CvsChrootCallback, catfile($stageDir, 'mozilla'));
+
+    # remove leftover mozconfig files
+    unlink(glob(catfile($stageDir, 'mozilla', '.mozconfig*')));
+
+    my $tarFile = $product . '-' . $version . '-' . 'source' . '.tar.bz2';
+
+    $this->Shell(
+      cmd => 'tar',
+      cmdArgs => ['-cjf', $tarFile, 'mozilla'],
+      dir => catfile($stageDir),
+      logFile => catfile($logDir, 'source_tar.log'),
     );
               
-    move("$stageDir/../*.bz2", $stageDir);
-    chmod(0644, glob("$stageDir/*.bz2"));
+    chmod(0644, glob("$stageDir/$tarFile"));
 }
 
 sub Verify {
     my $this = shift;
 
     my $config = new Bootstrap::Config();
     my $logDir = $config->Get(sysvar => 'logDir');
 
@@ -101,9 +127,22 @@ sub Announce {
     my $version = $config->Get(var => 'version');
 
     $this->SendAnnouncement(
       subject => "$product $version source step finished",
       message => "$product $version source archive was copied to the candidates dir.",
     );
 }
 
+# Change the CVS/Root file to be the anonymous CVS Root
+sub CvsChrootCallback {
+    my $config = new Bootstrap::Config();
+    my $anonCvsroot = $config->Get(var => 'anonCvsroot');
+
+    my $dirent = $File::Find::name;
+    if ((-f $dirent) and ($dirent =~ /.*CVS\/Root$/)) {
+        open(FILE, "> $dirent");
+        print FILE "$anonCvsroot\n";
+        close(FILE);
+    }
+}
+
 1;
--- a/tools/release/bootstrap.cfg.example
+++ b/tools/release/bootstrap.cfg.example
@@ -19,16 +19,17 @@ win32_buildDir  = /cygdrive/c/builds/tin
 linux_l10n_buildDir  = /builds/tinderbox/Fx-Mozilla1.8-l10n-Release
 mac_l10n_buildDir    = /builds/tinderbox/Fx-Mozilla1.8-l10n-Release
 win32_l10n_buildDir  = /cygdrive/c/builds/tinderbox/Fx-Mozilla1.8-l10n-Release
 # Absolute path to store bootstrap's logs
 logDir          = /builds/logs
 mozillaCvsroot  = /builds/cvsmirror/cvsroot
 l10nCvsroot     = /builds/cvsmirror/l10n
 mofoCvsroot     = /builds/cvsmirror/mofo
+anonCvsroot	= :pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
 # private staging area 
 stageHome       = /data/cltbld
 updateDir       = /builds/updates
 verifyDir       = /builds/verify
 tagDir          = /builds/tags
 configBumpDir   = /builds/config
 # Build platform, as specified by tinderbox
 linux_buildPlatform   = Linux_2.6.9-42.ELsmp_Depend