Merge branch 'QA_3_4'
[phpmyadmin.git] / scripts / create-release.sh
blobd411a67e0ef625b83ba565413657b8a4a826f1e5
1 #!/bin/sh
3 # vim: expandtab sw=4 ts=4 sts=4:
6 # More documentation about making a release is available at:
7 # http://wiki.phpmyadmin.net/pma/Releasing
9 # Fail on undefined variables
10 set -u
11 # Fail on failure
12 set -e
14 KITS="all-languages english"
15 COMPRESSIONS="zip-7z tbz txz tgz 7z"
17 if [ $# -lt 2 ]
18 then
19 echo "Usages:"
20 echo " create-release.sh <version> <from_branch> [--tag]"
21 echo ""
22 echo "If --tag is specified, relase tag is automatically created"
23 echo ""
24 echo "Examples:"
25 echo " create-release.sh 2.9.0-rc1 QA_2_9"
26 echo " create-release.sh 2.9.0 MAINT_2_9_0 --tag"
27 exit 65
31 # Checks whether remote branch has local tracking branch
32 ensure_local_branch() {
33 if ! git branch | grep -q '^..'"$1"'$' ; then
34 git branch --track $1 origin/$1
38 # Marks current head of given branch as head of other branch
39 # Used for STABLE/TESTING tracking
40 mark_as_release() {
41 branch=$1
42 rel_branch=$2
43 echo "* Marking release as $rel_branch"
44 ensure_local_branch $rel_branch
45 git checkout $rel_branch
46 git merge -s recursive -X theirs $branch
49 # Read required parameters
50 version=$1
51 shift
52 branch=$1
53 shift
55 cat <<END
57 Please ensure you have incremented rc count or version in the repository :
58 - in libraries/Config.class.php PMA_Config::__constructor() the line
59 " \$this->set( 'PMA_VERSION', '$version' ); "
60 - in Documentation.html the 2 lines
61 " <title>phpMyAdmin $version - Documentation</title> "
62 " <h1>phpMyAdmin $version Documentation</h1> "
63 - in README
65 Continue (y/n)?
66 END
67 read do_release
69 if [ "$do_release" != 'y' ]; then
70 exit 100
73 # Ensure we have tracking branch
74 ensure_local_branch $branch
76 # Create working copy
77 mkdir -p release
78 workdir=release/phpMyAdmin-$version
79 if [ -d $workdir ] ; then
80 echo "Working directory '$workdir' already exists, please move it out of way"
81 exit 1
83 git clone --local . $workdir
84 cd $workdir
86 # Checkout branch
87 ensure_local_branch $branch
88 git checkout $branch
90 # Check release version
91 if ! grep -q "'PMA_VERSION', '$version'" libraries/Config.class.php ; then
92 echo "There seems to be wrong version in libraries/Config.class.php!"
93 exit 2
95 if ! grep -q "phpMyAdmin $version - Documentation" Documentation.html ; then
96 echo "There seems to be wrong version in Documentation.html"
97 exit 2
99 if ! grep -q "Version $version\$" README ; then
100 echo "There seems to be wrong version in README"
101 exit 2
104 # Cleanup release dir
105 LC_ALL=C date -u > RELEASE-DATE-${version}
107 # Building Documentation.txt
108 echo "* Generating Documentation.txt"
109 LC_ALL=C w3m -dump Documentation.html > Documentation.txt
111 # Check for gettext support
112 if [ -d po ] ; then
113 GETTEXT=1
114 else
115 GETTEXT=0
118 # Generate mo files
119 if [ $GETTEXT -eq 1 ] ; then
120 echo "* Generating mo files"
121 ./scripts/generate-mo
122 if [ -f ./scripts/remove-incomplete-mo ] ; then
123 echo "* Removing incomplete translations"
124 ./scripts/remove-incomplete-mo
126 echo "* Removing gettext source files"
127 rm -rf po
130 if [ -f ./scripts/compress-js ] ; then
131 echo "* Compressing javascript files"
132 ./scripts/compress-js
133 rm -rf sources
136 echo "* Removing unneeded files"
138 # Remove test directory from package to avoid Path disclosure messages
139 # if someone runs /test/wui.php and there are test failures
140 rm -rf test
142 # Remove javascript compiler, no need to ship it
143 rm -rf scripts/google-javascript-compiler/
145 # Remove scripts which are not useful for user
146 for s in compress-js create-release.sh generate-mo mergepo.py php2gettext.sh remove_control_m.sh update-po upload-release pending-po pendingpo.py ; do
147 rm -f scripts/$s
148 done
150 # Remove git metadata
151 rm -rf .git
152 find . -name .gitignore -print0 | xargs -0 -r rm -f
154 cd ..
156 # Prepare all kits
157 for kit in $KITS ; do
158 # Copy all files
159 name=phpMyAdmin-$version-$kit
160 cp -r phpMyAdmin-$version $name
162 # Cleanup translations
163 cd phpMyAdmin-$version-$kit
164 scripts/lang-cleanup.sh $kit
165 rm -f scripts/lang-cleanup.sh
166 cd ..
168 # Remove tar file possibly left from previous run
169 rm -f $name.tar
171 # Prepare distributions
172 for comp in $COMPRESSIONS ; do
173 case $comp in
174 tbz|tgz|txz)
175 if [ ! -f $name.tar ] ; then
176 echo "* Creating $name.tar"
177 tar cf $name.tar $name
179 if [ $comp = tbz ] ; then
180 echo "* Creating $name.tar.bz2"
181 bzip2 -9k $name.tar
183 if [ $comp = txz ] ; then
184 echo "* Creating $name.tar.xz"
185 xz -9k $name.tar
187 if [ $comp = tgz ] ; then
188 echo "* Creating $name.tar.gz"
189 gzip -9c $name.tar > $name.tar.gz
192 zip)
193 echo "* Creating $name.zip"
194 zip -q -9 -r $name.zip $name
196 zip-7z)
197 echo "* Creating $name.zip"
198 7za a -bd -tzip $name.zip $name > /dev/null
201 echo "* Creating $name.7z"
202 7za a -bd $name.7z $name > /dev/null
205 echo "WARNING: ignoring compression '$comp', not known!"
207 esac
209 # Cleanup
210 rm -f $name.tar
211 done
213 # Remove directory with current dist set
214 rm -rf $name
215 done
217 # Cleanup
218 rm -rf phpMyAdmin-${version}
221 echo ""
222 echo ""
223 echo ""
224 echo "Files:"
225 echo "------"
227 ls -la *.gz *.zip *.bz2 *.7z
229 cd ..
232 if [ $# -gt 0 ] ; then
233 echo
234 echo "Additional tasks:"
235 while [ $# -gt 0 ] ; do
236 param=$1
237 case $1 in
238 --tag)
239 tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
240 echo "* Tagging release as $tagname"
241 git tag -a -m "Released $version" $tagname $branch
242 if echo $version | grep -q '^2\.11\.' ; then
243 echo '* 2.11 branch, no STABLE/TESTING update'
244 elif echo $version | grep -q '^3\.3\.' ; then
245 echo '* 3.3 branch, no STABLE/TESTING update'
246 else
247 if echo $version | grep '[a-z_-]' ; then
248 mark_as_release $branch TESTING
249 else
250 # We update both branches here
251 # As it does not make sense to have older testing than stable
252 mark_as_release $branch TESTING
253 mark_as_release $branch STABLE
255 git checkout master
257 echo " Dont forget to push tags using: git push --tags"
260 echo "Unknown parameter: $1!"
261 exit 1
262 esac
263 shift
264 done
265 echo
268 cat <<END
271 Todo now:
272 ---------
274 1. If not already done, tag the repository with the new revision number
275 for a plain release or a release candidate:
276 version 2.7.0 gets two tags: RELEASE_2_7_0 and STABLE
277 version 2.7.1-rc1 gets RELEASE_2_7_1RC1 and TESTING
279 2. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
280 this release and paste into it the ChangeLog for this release
281 3. upload the files to SF, you can use scripts/upload-release, eg.:
283 ./scripts/upload-release \$USER $version release
284 4. add SF news item to phpMyAdmin project
285 5. announce release on freshmeat (http://freshmeat.net/projects/phpmyadmin/)
286 6. send a short mail (with list of major changes) to
287 phpmyadmin-devel@lists.sourceforge.net
288 phpmyadmin-news@lists.sourceforge.net
289 phpmyadmin-users@lists.sourceforge.net
291 Don't forget to update the Description section in the announcement,
292 based on Documentation.html.
294 7. increment rc count or version in the repository :
295 - in libraries/Config.class.php PMA_Config::__constructor() the line
296 " \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
297 - in Documentation.html the 2 lines
298 " <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
299 " <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
301 8. add a group for bug tracking this new version, at
302 https://sourceforge.net/tracker/admin/index.php?group_id=23067&atid=377408&add_group=1
304 9. the end :-)