1818
1919version=' TESTBUILD'
2020sourcedir=~ /cloudstack/
21- outputdir=~ /cs-asf -build/
21+ outputdir=/tmp/cloudstack -build/
2222branch=' master'
2323tag=' no'
2424certid=' X'
25+ committosvn=' X'
2526
2627usage (){
27- echo " usage: $0 -v version [-b branch] [-s source dir] [-o output dir] [-t [-u]] [-h]"
28+ echo " usage: $0 -v version [-b branch] [-s source dir] [-o output dir] [-t] [-u] [-c ] [-h]"
2829 echo " -v sets the version"
2930 echo " -b sets the branch (defaults to 'master')"
3031 echo " -s sets the source directory (defaults to $sourcedir )"
3132 echo " -o sets the output directory (defaults to $outputdir )"
3233 echo " -t tags the git repo with the version"
33- echo " -u sets the certificate ID to sign the tag with (if not provided, the default key is attempted)"
34- echo " -k sets the key to sign the tarball with "
34+ echo " -u sets the certificate ID to sign with (if not provided, the default key is attempted)"
35+ echo " -c commits build artifacts to cloudstack dev dist dir in svn "
3536 echo " -h"
3637}
3738
38- while getopts v:s:o:b:tu:k:h opt
39+ while getopts v:s:o:b:u:tch opt
3940do
4041 case " $opt " in
4142 v) version=" $OPTARG " ;;
4243 s) sourcedir=" $OPTARG " ;;
4344 o) outputdir=" $OPTARG " ;;
4445 b) branch=" $OPTARG " ;;
45- t) tag=' yes' ;;
46+ t) tag=" yes" ;;
4647 u) certid=" $OPTARG " ;;
47- k ) keyid= " --default-key $OPTARG " ;;
48+ c ) committosvn= " yes " ;;
4849 h) usage
4950 exit 0;;
5051 /? ) # unknown flag
5455done
5556shift ` expr $OPTIND - 1`
5657
57- if [ $version == ' TESTBUILD' ]; then
58+ if [ $version == " TESTBUILD" ]; then
5859 echo >&2 " A version must be specified with the -v option: build_asf.sh -v 4.0.0.RC1"
5960 exit 1
6061fi
@@ -63,8 +64,8 @@ echo "Using version: $version"
6364echo " Using source directory: $sourcedir "
6465echo " Using output directory: $outputdir "
6566echo " Using branch: $branch "
66- if [ $tag == ' yes' ]; then
67- if [ $certid == ' X ' ]; then
67+ if [ " $tag " == " yes" ]; then
68+ if [ " $certid " == " X " ]; then
6869 echo " Tagging the branch with the version number, and signing the branch with your default certificate."
6970 else
7071 echo " Tagging the branch with the version number, and signing the branch with certificate ID $certid ."
8081fi
8182
8283cd $sourcedir
84+
85+ echo ' checking out correct branch'
86+ git checkout $branch
87+
88+ echo ' determining current mvn version'
89+ export currentversion=` mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -v ' \[' `
90+ echo " found $currentversion "
91+
92+ echo ' setting version numbers'
93+ mvn versions:set -DnewVersion=$version -P vmware -P developer -P systemvm -P simulator -P baremetal -P ucs -Dnonoss
94+ mv deps/XenServerJava/pom.xml.versionsBackup deps/XenServerJava/pom.xml
95+ perl -pi -e ' s/$ENV{' currentversion' }/$ENV{' version' }/' deps/XenServerJava/pom.xml
96+ perl -pi -e ' s/$ENV{' currentversion' }/$ENV{' version' }/' tools/apidoc/pom.xml
97+ git clean -f
98+
99+ echo ' commit changes'
100+ git commit -a -s -m " Updating pom.xml version numbers for release $version "
101+ export commitsh=` git show HEAD | head -n 1 | cut -d ' ' -f 2`
102+
103+ echo " committed as $commitsh "
104+
83105echo ' archiving'
84106git archive --format=tar --prefix=apache-cloudstack-$version -src/ $branch > $outputdir /apache-cloudstack-$version -src.tar
85107bzip2 $outputdir /apache-cloudstack-$version -src.tar
86108
87109cd $outputdir
88110echo ' armor'
89- gpg -v $keyid --armor --output apache-cloudstack-$version -src.tar.bz2.asc --detach-sig apache-cloudstack-$version -src.tar.bz2
111+ if [ " $certid " == " X" ]; then
112+ gpg -v --armor --output apache-cloudstack-$version -src.tar.bz2.asc --detach-sig apache-cloudstack-$version -src.tar.bz2
113+ else
114+ gpg -v --default-key $certid --armor --output apache-cloudstack-$version -src.tar.bz2.asc --detach-sig apache-cloudstack-$version -src.tar.bz2
115+ fi
90116
91117echo ' md5'
92118gpg -v --print-md MD5 apache-cloudstack-$version -src.tar.bz2 > apache-cloudstack-$version -src.tar.bz2.md5
@@ -97,12 +123,39 @@ gpg -v --print-md SHA512 apache-cloudstack-$version-src.tar.bz2 > apache-cloudst
97123echo ' verify'
98124gpg -v --verify apache-cloudstack-$version -src.tar.bz2.asc apache-cloudstack-$version -src.tar.bz2
99125
100- if [ $tag == ' yes' ]; then
126+ if [ " $tag " == " yes" ]; then
101127 echo ' tag'
102128 cd $sourcedir
103- if [ $certid == ' X ' ]; then
129+ if [ " $certid " == " X " ]; then
104130 git tag -s $version -m " Tagging release $version on branch $branch ."
105131 else
106132 git tag -u $certid -s $version -m " Tagging release $version on branch $branch ."
107133 fi
108134fi
135+
136+ if [ " $committosvn " == " yes" ]; then
137+ echo ' committing artifacts to svn'
138+ rm -Rf /tmp/cloudstack-dev-dist
139+ cd /tmp
140+ svn co https://dist.apache.org/repos/dist/dev/cloudstack/ cloudstack-dev-dist
141+ cd cloudstack-dev-dist
142+ if [ -d " $version " ]; then
143+ cd $version
144+ svn rm *
145+ else
146+ mkdir $version
147+ svn add $version
148+ cd $version
149+ fi
150+ cp $outputdir /apache-cloudstack-$version -src.tar.bz2 .
151+ cp $outputdir /apache-cloudstack-$version -src.tar.bz2.asc .
152+ cp $outputdir /apache-cloudstack-$version -src.tar.bz2.md5 .
153+ cp $outputdir /apache-cloudstack-$version -src.tar.bz2.sha .
154+ svn add apache-cloudstack-$version -src.tar.bz2
155+ svn add apache-cloudstack-$version -src.tar.bz2.asc
156+ svn add apache-cloudstack-$version -src.tar.bz2.md5
157+ svn add apache-cloudstack-$version -src.tar.bz2.sha
158+ svn commit -m " Committing release candidate artifacts for $version to dist/dev/cloudstack in preparation for release vote"
159+ fi
160+
161+ echo " completed. use commit-sh of $commitsh when starting the VOTE thread"
0 commit comments