]> source.dussan.org Git - vaadin-framework.git/commitdiff
svn changeset:924/svn branch:trunk
authorJani Laakso <jani.laakso@itmill.com>
Wed, 14 Mar 2007 18:50:29 +0000 (18:50 +0000)
committerJani Laakso <jani.laakso@itmill.com>
Wed, 14 Mar 2007 18:50:29 +0000 (18:50 +0000)
build/toolkit-release-make.pl

index da1a8ee41459082dff3bc6eeedc35573e276285f..df75ed27c4faf9d479fa343ec132f30ee9c303f0 100644 (file)
@@ -19,21 +19,21 @@ my $usage =
   " <version> is new version, e.g. 4.0.1-rc3\n".
   " <target> is directory to store release zip file, e.g. internal/4.0.1-rc/\n";
 
-my $BRANCH = shift(@ARGV) || die($usage);
-my $VERSION = shift(@ARGV) || die($usage);
-my $TARGET = shift(@ARGV) || die($usage);
+my $BRANCH = shift(@ARGV) || &failure($usage);
+my $VERSION = shift(@ARGV) || &failure($usage);
+my $TARGET = shift(@ARGV) || &failure($usage);
   
 my $t = "";
 
 if (!$BRANCH =~ /([4-9]{1}\.[0-9]{1})/) {
-  die ("<branch> must be format {x}.{y} where {x}=major (4-9), ".
+  &failure ("\n<branch> must be format {x}.{y} where {x}=major (4-9), ".
       "{y}=minor (0-9).\n");
 }
 if ( 
   (!$VERSION =~ /[4-9]{1}\.[0-9]{1,2}.[0-9]{1,3}/) &&
   (!$VERSION =~ /[4-9]{1}\.[0-9]{1,2}.[0-9]{1,3}-rc[0-9]{1,2}/)
   ) {
-  die ("<version> must be format {x}.{y}.{z} or x.y.z-rc{m} ".
+  &failure ("\n<version> must be format {x}.{y}.{z} or x.y.z-rc{m} ".
       "where {x}=major (4-9), {y}=minor (0-99), {z}=revision ".
       "(0-999) and optional release candidate number {m}=(0-99).\n");
 }
@@ -41,19 +41,25 @@ if (
   (!$TARGET =~ /release\/[4-9]{1}\.[0-9]{1,2}.[0-9]{1,3}/) &&
   (!$TARGET =~ /internal\/[4-9]{1}\.[0-9]{1,2}.[0-9]{1,3}-rc[0-9]{1,2}/)
   ) {
-  die ("<dir> must be e.g. internal/4.0.1-rc/ or release/4.0.\n");
+  &failure ("\n<target> must be e.g. internal/4.0.1-rc/ or release/4.0.\n");
 }
 
-print "Make sure $WORKDIR directory\n";
-print "BRANCH [$BRANCH]\nVERSION [$VERSION]\nDIR [$SVN_URL_BUILDS$TARGET]\n";
+# Open log file
+open(LOG, "> $WORKDIR/builds/$TARGET/itmill-toolkit-$VERSION.make.log");
 
-&proceed("Initializing repositories");
+# Make sure $WORKDIR directory exists
+&message(
+  "\n  BRANCH [$BRANCH]\n  VERSION [$VERSION]\n".
+  "  DIR [$SVN_URL_BUILDS/$TARGET]\n"
+);
+
+&message(" Initializing repositories ");
 # go to directory where repository working copies (WC) are
-chdir($WORKDIR);
+chdir($WORKDIR) || &failure("Could not chdir to $WORKDIR.\n");
 # delete old repo
 &execute("rm -rf $BRANCH");
 # checkout (if missing) build repository
-&execute("svn co $SVN_ROOT/builds");
+&execute("svn co $SVN_ROOT/builds | grep \"Checked out\"");
 # it's safest to replace 4.0 from trunk (but you could use also merging)
 &execute(
   "svn rm $SVN_ROOT/branches/$BRANCH ".
@@ -64,9 +70,9 @@ chdir($WORKDIR);
   "-m \"Recreating $BRANCH branch from trunk. Copying new $BRANCH.\""
 );
 # checkout $BRANCH
-&execute("svn co $SVN_ROOT/branches/$BRANCH");
+&execute("svn co $SVN_ROOT/branches/$BRANCH | grep \"Checked out\"");
 
-&proceed("Changing VERSION");
+&message(" Changing VERSION");
 # go to $BRANCH directory
 chdir("$WORKDIR/$BRANCH");
 # fix links as VERSION changes
@@ -79,42 +85,58 @@ chdir("$WORKDIR/$BRANCH");
 # increment VERSION
 &execute("echo \"version=$VERSION\" >build/VERSION");
 
-&proceed("Commit changes");
+&message(" Commit changes ");
 # commit changes
 &execute("svn ci -m \"Building $VERSION release.\"");
 
-&proceed("Executing ant");
+&message(" Executing ant ");
 # execute build script, takes 5-40 minutes depending on hw
 chdir("$WORKDIR/$BRANCH/build");
 &execute("ant");
 
-&proceed("Copying branch 4.0 under tags branch");
+&message(" Copying branch 4.0 under tags branch");
 # copy branch 4.0 into tags directory (some may interpret this as tagging)
 &execute(
   "svn copy $SVN_ROOT/branches/4.0 $SVN_ROOT/tags/$VERSION ".
   "-m \"Copying $VERSION release into tags.\""
 );
 
-&proceed("Committing release package zip file to builds dir");
+&message(" Committing release package zip file to builds dir ");
 # commit release package zip to SVN
 &execute("cp result/itmill-toolkit-$VERSION.zip $WORKDIR/builds/$TARGET");
 chdir("$WORKDIR/builds/$TARGET");
 &execute("svn add itmill-toolkit-$VERSION.zip");
-&execute("svn ci -m \"Added $VERSION release package.\"");
+&execute(
+  "svn ci itmill-toolkit-$VERSION.zip ".
+  "-m \"Added $VERSION release package.\""
+);
+&message(" Done ");
+
+# store log to SVN
+close(LOG);
+`svn add $WORKDIR/builds/$TARGET/itmill-toolkit-$VERSION.make.log`;
+`svn ci $WORKDIR/builds/$TARGET/itmill-toolkit-$VERSION.make.log -m \"Added $VERSION toolkit-release-make log file.\"`;
 
-print "Done.\n";
 exit;
 
-sub proceed() {
+sub message() {
   my $msg = shift;
-  $msg = "\n\n*** ".$msg.", press any key to continue ***";
+  $msg = "\n***".$msg."***\n";
   print $msg;
-  <STDIN>;
+  print LOG $msg;
 }
 
 sub execute() {
     my $cmd = shift;   
     print "  $cmd\n";
+    print LOG "  $cmd\n";
     my $result = `$cmd`;
     print $result."\n";
+    print LOG $result."\n";
 }
+
+sub failure() {
+    my $msg = shift;
+    print $msg."\n";
+    exit;
+}
\ No newline at end of file