]> source.dussan.org Git - vaadin-framework.git/commitdiff
Added two phased merging.
authorJani Laakso <jani.laakso@itmill.com>
Thu, 5 Apr 2007 07:12:24 +0000 (07:12 +0000)
committerJani Laakso <jani.laakso@itmill.com>
Thu, 5 Apr 2007 07:12:24 +0000 (07:12 +0000)
svn changeset:1160/svn branch:trunk

build/toolkit-release-make.pl

index df5cd8890d96ba4281a6c4e58c7023842500f908..041886672e7ef848db792d54a828f750ecf80fd5 100644 (file)
@@ -20,26 +20,58 @@ my $SVN_ROOT = "https://svn.itmill.com/svn/itmill-toolkit";
 my $SVN_URL_BUILDS = $SVN_ROOT."/builds";
 
 my $usage = 
-  "Usage: $0 <branch> <version> <dir>\n".
-  " <branch> is new major.minor version, e.g. 4.0\n".
-  " <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";
-
+  "Usage: toolkit-release-make.pl MERGE BRANCH VERSION TARGET [SOURCE]\n".
+  " MERGE is of value nomerge, merge or continue\n".
+  " BRANCH is new major.minor version, e.g. 4.0\n".
+  " 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".
+  " SOURCE is SVN URL used to create release, if omitted then trunk used\n".
+  "\n".
+  "Description of MERGE parameter\n".
+  " nomerge  : no merging is performed, build is fully based on SOURCE.\n".
+  " merge    : after BRANCH created, allows manual merging.\n".
+  " continue : called after manual merging completed.\n\n".
+  "Examples:\n\n".
+  "No merging example:\n".
+  "toolkit-release-make.pl nomerge 4.1 4.1.0 release\n".
+  "  Recreates 4.1 branch from trunk,\n".
+  "  continues automatically with build (no merging allowed),\n".
+  "  release is fully based on trunk.\n\n".
+  "Merging example (two phases required):\n".
+  "Phase 1\n".
+  " toolkit-release-make.pl merge 4.0 4.0.1-pre_mantis release tags/4.0.0\n".
+  "  Recreates 4.0 branch from tags/4.0.0,\n".
+  "  buildprocess is suspended,\n".
+  "  buildmaster performs merging manually,\n".
+  "  buildmaster executes script again (see below).\n".
+  "Phase 2\n".
+  " toolkit-release-make.pl continue 4.0 4.0.1-pre_mantis release tags/4.0.0\n".
+  "  Buildprocess continues (buildmaster has done merging).\n";
+
+my $MERGE = shift(@ARGV) || &failure($usage);
 my $BRANCH = shift(@ARGV) || &failure($usage);
 my $VERSION = shift(@ARGV) || &failure($usage);
 my $TARGET = shift(@ARGV) || &failure($usage);
+my $SOURCE = shift(@ARGV) || 'trunk';
   
 my $t = "";
 
+if (
+  ($MERGE ne "nomerge" ) &&
+  ($MERGE ne "merge" ) &&
+  ($MERGE ne "continue" )
+  ) {
+  &failure ("\nMERGE must be of value nomerge, merge or continue\n");
+}
 if (!$BRANCH =~ /([4-9]{1}\.[0-9]{1})/) {
-  &failure ("\n<branch> must be format {x}.{y} where {x}=major (4-9), ".
+  &failure ("\nBRANCH 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}/)
   ) {
-  &failure ("\n<version> must be format {x}.{y}.{z} or x.y.z-rc{m} ".
+  &failure ("\nVERSION 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");
 }
@@ -47,21 +79,36 @@ 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}/)
   ) {
-  &failure ("\n<target> must be e.g. internal/4.0.1-rc/ or release/4.0.\n");
+  &failure ("\nTARGET must be e.g. internal/4.0.1-rc/ or release/4.0.\n");
 }
 
 # Open log file
 open(LOG, ">>$WORKDIR/builds/$TARGET/itmill-toolkit-$VERSION.make.log");
 
-# BRAKEPOINT
-# goto STEP;
-  
+#
+# If MERGE=continue, buildmaster has performed merging and now asks
+# build script to continue making the release.
+#
+if ($MERGE eq "continue") {
+  &message(" Buildprocess continued. Buildmaster has performed merging. ");
+  goto CONTINUE;
+}
+
+
 # Make sure $WORKDIR directory exists
 &message(
-  "\n  BRANCH [$BRANCH]\n  VERSION [$VERSION]\n".
-  "  DIR [$SVN_URL_BUILDS/$TARGET]\n"
+  "\n  MERGE [$MERGE]\n  BRANCH [$BRANCH]\n  VERSION [$VERSION]\n".
+  "  DIR [$SVN_URL_BUILDS/$TARGET]\n".
+  "  SOURCE [$SOURCE]\n"
 );
 
+# collect data from host
+&message("Host information");
+&execute("date -R");
+&execute("uname -a");
+&execute("java -version");
+&execute("ant -version");
+
 &message(" Initializing repositories ");
 # go to directory where repository working copies (WC) are
 chdir($WORKDIR) || &failure("Could not chdir to $WORKDIR.\n");
@@ -69,14 +116,14 @@ chdir($WORKDIR) || &failure("Could not chdir to $WORKDIR.\n");
 &execute("rm -rf $BRANCH");
 # checkout (if missing) build repository
 &execute("svn co $SVN_ROOT/builds | grep \"Checked out\"");
-# it's safest to replace 4.0 from trunk (but you could use also merging)
+# it's safest to replace $BRANCH from $SOURCE (but you could use also merging)
 &execute(
   "svn rm $SVN_ROOT/branches/$BRANCH ".
-  "-m \"Recreating $BRANCH branch from trunk. Removing old $BRANCH.\""
+  "-m \"Recreating $BRANCH branch from $SOURCE. Removing old $BRANCH.\""
 );
 &execute(
-  "svn copy $SVN_ROOT/trunk $SVN_ROOT/branches/$BRANCH ".
-  "-m \"Recreating $BRANCH branch from trunk. Copying new $BRANCH.\""
+  "svn copy $SVN_ROOT/$SOURCE $SVN_ROOT/branches/$BRANCH ".
+  "-m \"Recreating $BRANCH branch from $SOURCE. Copying new $BRANCH.\""
 );
 # checkout $BRANCH
 &execute("svn co $SVN_ROOT/branches/$BRANCH | grep \"Checked out\"");
@@ -84,8 +131,25 @@ chdir($WORKDIR) || &failure("Could not chdir to $WORKDIR.\n");
 # Use brakepoint if you need to do additional merging or 
 # file based revision changes
 # BRAKEPOINT, disabled
-# exit;
-# STEP:
+
+#
+# Check if buildmaster wishes to do merging at this point
+# or continue directly with building?
+#
+if ($MERGE eq "merge") {
+  # Yes, merging required
+  &message(" Buildprocess suspended. Buildmaster now performs merging manually ");
+  print "".
+      "Please now perform merging manually and after that execute:\n".
+      "toolkit-release-make.pl continue $BRANCH $VERSION $TARGET $SOURCE\n".
+  close(LOG);
+  exit;
+} else {
+  # No, merging not required
+  # Either merging is complete and building is continued,
+  # OR merging not even performed, build is based on e.g. trunk
+}
+CONTINUE:
   
 &message(" Changing VERSION");
 # go to $BRANCH directory
@@ -109,10 +173,10 @@ chdir("$WORKDIR/$BRANCH");
 chdir("$WORKDIR/$BRANCH/build");
 &execute("ant");
 
-&message(" Copying branch 4.0 under tags branch");
-# copy branch 4.0 into tags directory (some may interpret this as tagging)
+&message(" Copying branch $BRANCH under tags branch");
+# copy branch $BRANCH into tags directory (some may interpret this as tagging)
 &execute(
-  "svn copy $SVN_ROOT/branches/4.0 $SVN_ROOT/tags/$VERSION ".
+  "svn copy $SVN_ROOT/branches/$BRANCH $SVN_ROOT/tags/$VERSION ".
   "-m \"Copying $VERSION release into tags.\""
 );