From: Jani Laakso Date: Wed, 14 Mar 2007 08:30:38 +0000 (+0000) Subject: make-release.pl now tested and works correctly under Jani Laakso's environment. X-Git-Tag: 6.7.0.beta1~6524 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1291b0a6f1c5480eff2a3b49298fd93ccec29cfd;p=vaadin-framework.git make-release.pl now tested and works correctly under Jani Laakso's environment. svn changeset:893/svn branch:trunk --- diff --git a/build/make-release.pl b/build/make-release.pl index 4f74e16bec..cc81558eb6 100644 --- a/build/make-release.pl +++ b/build/make-release.pl @@ -2,17 +2,26 @@ use strict; +# +# NOTE: tested only with Jani Laakso's environment +# + +# working directory to make releases +my $WORKDIR = "/home/jani/crypt/tk"; + +# directory prefix where release package zip file is stored +my $SVN_ROOT = "https://svn.itmill.com/svn/itmill-toolkit"; +my $SVN_URL_BUILDS = $SVN_ROOT."/builds"; + my $usage = "Usage: make-release.sh \n". " is new major.minor version, e.g. 4.0\n". " is new version, e.g. 4.0.1-rc3\n". - " is dir to store release zip file, e.g. internal/4.0.1-rc/\n"; - -die ("This is not yet tested, do not use.\n"); + " 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 $DIR = shift(@ARGV) || die($usage); +my $TARGET = shift(@ARGV) || die($usage); my $t = ""; @@ -29,38 +38,83 @@ if ( "(0-999) and optional release candidate number {m}=(0-99).\n"); } if ( - (!$DIR =~ /release\/[4-9]{1}\.[0-9]{1,2}.[0-9]{1,3}/) && - (!$DIR =~ /internal\/[4-9]{1}\.[0-9]{1,2}.[0-9]{1,3}-rc[0-9]{1,2}/) + (!$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 (" 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"; + +&proceed("Initializing repositories"); # go to directory where repository working copies (WC) are -`cd ~/toolkit`; +chdir($WORKDIR); +# delete old repo +&execute("rm -rf $BRANCH"); +# checkout (if missing) build repository +&execute("svn co $SVN_ROOT/builds"); # it's safest to replace 4.0 from trunk (but you could use also merging) -`svn rm https://svn.itmill.com/svn/itmill-toolkit/branches/$BRANCH -m "Recreating $BRANCH branch from trunk. Removing old $BRANCH."`; -`svn copy https://svn.itmill.com/svn/itmill-toolkit/trunk https://svn.itmill.com/svn/itmill-toolkit/branches/$BRANCH -m "Recreating $BRANCH branch from trunk. Copying new $BRANCH."`; +&execute( + "svn rm $SVN_ROOT/branches/$BRANCH ". + "-m \"Recreating $BRANCH branch from trunk. Removing old $BRANCH.\"" +); +&execute( + "svn copy $SVN_ROOT/trunk $SVN_ROOT/branches/$BRANCH ". + "-m \"Recreating $BRANCH branch from trunk. Copying new $BRANCH.\"" +); # checkout $BRANCH -`svn co https://svn.itmill.com/svn/itmill-toolkit/branches/$BRANCH`; +&execute("svn co $SVN_ROOT/branches/$BRANCH"); +&proceed("Changing VERSION"); # go to $BRANCH directory -chdir("$BRANCH"); +chdir("$WORKDIR/$BRANCH"); # fix links as VERSION changes -`sed s/cat build/VERSION | cut -f2 -d'='/$VERSION/ index.html >index.html`; +&execute( + "sed s/`cat build/VERSION | cut -f2 -d'='`/$VERSION/ ". + "index.html >/tmp/index.html" +); +&execute("diff index.html /tmp/index.html"); +&execute("cp /tmp/index.html index.html"); # increment VERSION -`echo "version=$VERSION" >build/VERSION`; +&execute("echo \"version=$VERSION\" >build/VERSION"); +&proceed("Commit changes"); # commit changes -`svn ci -m "Building release."`; +&execute("svn ci -m \"Building $VERSION release.\""); +&proceed("Executing ant"); # execute build script, takes 5-40 minutes depending on hw -`ant`; +chdir("$WORKDIR/$BRANCH/build"); +&execute("ant"); +&proceed("Copying branch 4.0 under tags branch"); # copy branch 4.0 into tags directory (some may interpret this as tagging) -`svn copy https://svn.itmill.com/svn/itmill-toolkit/branches/4.0 https://svn.itmill.com/svn/itmill-toolkit/tags/ -m "Copying $VERSION into tags."`; +&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"); # commit release package zip to SVN -`cp result/itmill-toolkit-$VERSION.zip ~/toolkit/builds/$DIR`; -chdir("~/toolkit/builds/$DIR"); -`svn add itmill-toolkit-$VERSION.zip`; -`svn ci -m "Added $VERSION release."`; +&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.\""); + +print "Done.\n"; +exit; + +sub proceed() { + my $msg = shift; + $msg = "\n\n*** ".$msg.", press any key to continue ***"; + print $msg; + ; +} + +sub execute() { + my $cmd = shift; + print " $cmd\n"; + my $result = `$cmd`; + print $result."\n"; +}