Improve message
[phpmyadmin/madhuracj.git] / scripts / create-release.sh
blobf0056d79be3fae26e8890ee56a35dc6dbe6281d7
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/Devel: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 translators.html
64 - in README
66 Continue (y/n)?
67 END
68 read do_release
70 if [ "$do_release" != 'y' ]; then
71 exit 100
74 # Ensure we have tracking branch
75 ensure_local_branch $branch
77 # Create working copy
78 mkdir -p release
79 workdir=release/phpMyAdmin-$version
80 if [ -d $workdir ] ; then
81 echo "Working directory '$workdir' already exists, please move it out of way"
82 exit 1
84 git clone --local . $workdir
85 cd $workdir
87 # Checkout branch
88 ensure_local_branch $branch
89 git checkout $branch
91 # Check release version
92 if ! grep -q "'PMA_VERSION', '$version'" libraries/Config.class.php ; then
93 echo "There seems to be wrong version in libraries/Config.class.php!"
94 exit 2
96 if ! grep -q "phpMyAdmin $version - Documentation" Documentation.html ; then
97 echo "There seems to be wrong version in Documentation.html"
98 exit 2
100 if ! grep -q "phpMyAdmin $version - Official translators" translators.html ; then
101 echo "There seems to be wrong version in translators.html"
102 exit 2
104 if ! grep -q "Version $version\$" README ; then
105 echo "There seems to be wrong version in README"
106 exit 2
109 # Cleanup release dir
110 LC_ALL=C date -u > RELEASE-DATE-${version}
112 # Building Documentation.txt
113 echo "* Generating Documentation.txt"
114 LC_ALL=C w3m -dump Documentation.html > Documentation.txt
116 # Check for gettext support
117 if [ -d po ] ; then
118 GETTEXT=1
119 else
120 GETTEXT=0
123 # Generate mo files
124 if [ $GETTEXT -eq 1 ] ; then
125 echo "* Generating mo files"
126 ./scripts/generate-mo
127 echo "* Removing gettext source files"
128 rm -rf po
131 if [ -f ./scripts/compress-js ] ; then
132 echo "* Compressing javascript files"
133 ./scripts/compress-js
134 rm -rf sources
137 echo "* Removing unneeded files"
139 # Remove test directory from package to avoid Path disclosure messages
140 # if someone runs /test/wui.php and there are test failures
141 rm -rf test
143 # Remove javascript compiler, no need to ship it
144 rm -rf scripts/google-javascript-compiler/
146 # Remove scripts which are not useful for user
147 for s in compress-js create-release.sh generate-mo mergepo.py php2gettext.sh remove_control_m.sh update-po upload-release ; do
148 rm -f scripts/$s
149 done
151 # Remove git metadata
152 rm -rf .git
153 find . -name .gitignore -print0 | xargs -0 -r rm -f
155 cd ..
157 # Prepare all kits
158 for kit in $KITS ; do
159 # Copy all files
160 name=phpMyAdmin-$version-$kit
161 cp -r phpMyAdmin-$version $name
163 # Cleanup translations
164 cd phpMyAdmin-$version-$kit
165 scripts/lang-cleanup.sh $kit
166 rm -f scripts/lang-cleanup.sh
167 cd ..
169 # Remove tar file possibly left from previous run
170 rm -f $name.tar
172 # Prepare distributions
173 for comp in $COMPRESSIONS ; do
174 case $comp in
175 tbz|tgz|txz)
176 if [ ! -f $name.tar ] ; then
177 echo "* Creating $name.tar"
178 tar cf $name.tar $name
180 if [ $comp = tbz ] ; then
181 echo "* Creating $name.tar.bz2"
182 bzip2 -9k $name.tar
184 if [ $comp = txz ] ; then
185 echo "* Creating $name.tar.xz"
186 xz -9k $name.tar
188 if [ $comp = tgz ] ; then
189 echo "* Creating $name.tar.gz"
190 gzip -9c $name.tar > $name.tar.gz
193 zip)
194 echo "* Creating $name.zip"
195 zip -q -9 -r $name.zip $name
197 zip-7z)
198 echo "* Creating $name.zip"
199 7za a -bd -tzip $name.zip $name > /dev/null
202 echo "* Creating $name.7z"
203 7za a -bd $name.7z $name > /dev/null
206 echo "WARNING: ignoring compression '$comp', not known!"
208 esac
210 # Cleanup
211 rm -f $name.tar
212 done
214 # Remove directory with current dist set
215 rm -rf $name
216 done
218 # Cleanup
219 rm -rf phpMyAdmin-${version}
222 echo ""
223 echo ""
224 echo ""
225 echo "Files:"
226 echo "------"
228 ls -la *.gz *.zip *.bz2 *.7z
230 cd ..
233 if [ $# -gt 0 ] ; then
234 echo
235 echo "Additional tasks:"
236 while [ $# -gt 0 ] ; do
237 param=$1
238 case $1 in
239 --tag)
240 tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
241 echo "* Tagging release as $tagname"
242 git tag -a -m "Released $version" $tagname $branch
243 if echo $version | grep -q '^2\.11\.' ; then
244 echo '* 2.11 branch, no STABLE/TESTING update'
245 else
246 if echo $version | grep '[a-z_-]' ; then
247 mark_as_release $branch TESTING
248 else
249 # We update both branches here
250 # As it does not make sense to have older testing than stable
251 mark_as_release $branch TESTING
252 mark_as_release $branch STABLE
254 git checkout master
256 echo " Dont forget to push tags using: git push --tags"
259 echo "Unknown parameter: $1!"
260 exit 1
261 esac
262 shift
263 done
264 echo
267 cat <<END
270 Todo now:
271 ---------
273 1. If not already done, tag the repository with the new revision number
274 for a plain release or a release candidate:
275 version 2.7.0 gets two tags: RELEASE_2_7_0 and STABLE
276 version 2.7.1-rc1 gets RELEASE_2_7_1RC1 and TESTING
278 2. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
279 this release and paste into it the ChangeLog for this release
280 3. upload the files to SF, you can use scripts/upload-release, eg.:
282 ./scripts/upload-release \$USER $version release
283 4. add SF news item to phpMyAdmin project
284 5. announce release on freshmeat (http://freshmeat.net/projects/phpmyadmin/)
285 6. send a short mail (with list of major changes) to
286 phpmyadmin-devel@lists.sourceforge.net
287 phpmyadmin-news@lists.sourceforge.net
288 phpmyadmin-users@lists.sourceforge.net
290 Don't forget to update the Description section in the announcement,
291 based on Documentation.html.
293 7. increment rc count or version in the repository :
294 - in libraries/Config.class.php PMA_Config::__constructor() the line
295 " \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
296 - in Documentation.html the 2 lines
297 " <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
298 " <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
299 - in translators.html
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 :-)