Translation update done using Pootle.
[phpmyadmin/dkf.git] / scripts / create-release.sh
blob4f327f682926177125907bc6d35eaf14e1be1945
1 #!/bin/sh
3 # $Id$
4 # vim: expandtab sw=4 ts=4 sts=4:
7 # More documentation about making a release is available at:
8 # http://wiki.phpmyadmin.net/pma/Devel:Releasing
10 # Fail on undefined variables
11 set -u
12 # Fail on failure
13 set -e
15 KITS="all-languages english"
16 COMPRESSIONS="zip-7z tbz tgz 7z"
18 if [ $# -lt 2 ]
19 then
20 echo "Usages:"
21 echo " create-release.sh <version> <from_branch> [--tag]"
22 echo ""
23 echo "If --tag is specified, relase tag is automatically created"
24 echo ""
25 echo "Examples:"
26 echo " create-release.sh 2.9.0-rc1 QA_2_9"
27 echo " create-release.sh 2.9.0 MAINT_2_9_0 --tag"
28 exit 65
32 # Checks whether remote branch has local tracking branch
33 ensure_local_branch() {
34 if ! git branch | grep -q '^..'"$1"'$' ; then
35 git branch --track $1 origin/$1
39 # Marks current head of given branch as head of other branch
40 # Used for STABLE/TESTING tracking
41 mark_as_release() {
42 branch=$1
43 rel_branch=$2
44 echo "* Marking release as $rel_branch"
45 ensure_local_branch $rel_branch
46 git checkout $rel_branch
47 git merge -s recursive -X theirs $branch
50 # Read required parameters
51 version=$1
52 shift
53 branch=$1
54 shift
56 cat <<END
58 Please ensure you have:
59 1. incremented rc count or version in the repository :
60 - in libraries/Config.class.php PMA_Config::__constructor() the line
61 " \$this->set( 'PMA_VERSION', '$version' ); "
62 - in Documentation.html the 2 lines
63 " <title>phpMyAdmin $version - Documentation</title> "
64 " <h1>phpMyAdmin $version Documentation</h1> "
65 - in translators.html
66 - in README
67 2. checked that all language files are valid (use
68 the "./scripts/check_lang.php" script to do it).
70 Continue (y/n)?
71 END
72 read do_release
74 if [ "$do_release" != 'y' ]; then
75 exit 100
78 # Ensure we have tracking branch
79 ensure_local_branch $branch
81 # Create working copy
82 mkdir -p release
83 workdir=release/phpMyAdmin-$version
84 if [ -d $workdir ] ; then
85 echo "Working directory '$workdir' already exists, please move it out of way"
86 exit 1
88 git clone --local . $workdir
89 cd $workdir
91 # Checkout branch
92 ensure_local_branch $branch
93 git checkout $branch
95 # Check release version
96 if ! grep -q "'PMA_VERSION', '$version'" libraries/Config.class.php ; then
97 echo "There seems to be wrong version in libraries/Config.class.php!"
98 exit 2
100 if ! grep -q "phpMyAdmin $version - Documentation" Documentation.html ; then
101 echo "There seems to be wrong version in Documentation.html"
102 exit 2
104 if ! grep -q "phpMyAdmin $version - Official translators" translators.html ; then
105 echo "There seems to be wrong version in translators.html"
106 exit 2
108 if ! grep -q "Version $version\$" README ; then
109 echo "There seems to be wrong version in README"
110 exit 2
113 # Cleanup release dir
114 LC_ALL=C date -u > RELEASE-DATE-${version}
116 # Building Documentation.txt
117 echo "* Generating Documentation.txt"
118 LC_ALL=C w3m -dump Documentation.html > Documentation.txt
120 # Check for gettext support
121 if [ -d po ] ; then
122 GETTEXT=1
123 else
124 GETTEXT=0
127 # Generate mo files
128 if [ $GETTEXT -eq 1 ] ; then
129 echo "* Generating mo files"
130 ./scripts/generate-mo
133 if [ -f ./scripts/compress-js ] ; then
134 echo "* Compressing javascript files"
135 ./scripts/compress-js
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 git metadata
146 rm -rf .git
147 find . -name .gitignore -print0 | xargs -0 -r rm -f
149 cd ..
151 # Prepare all kits
152 for kit in $KITS ; do
153 # Copy all files
154 name=phpMyAdmin-$version-$kit
155 cp -r phpMyAdmin-$version $name
157 # Cleanup translations
158 cd phpMyAdmin-$version-$kit
159 scripts/lang-cleanup.sh $kit
160 cd ..
162 # Prepare distributions
163 for comp in $COMPRESSIONS ; do
164 case $comp in
165 tbz|tgz)
166 echo "* Creating $name.tar"
167 tar cf $name.tar $name
168 if [ $comp = tbz ] ; then
169 echo "* Creating $name.tar.bz2"
170 bzip2 -9k $name.tar
172 if [ $comp = tgz ] ; then
173 echo "* Creating $name.tar.gz"
174 gzip -9c $name.tar > $name.tar.gz
176 rm $name.tar
178 zip)
179 echo "* Creating $name.zip"
180 zip -q -9 -r $name.zip $name
182 zip-7z)
183 echo "* Creating $name.zip"
184 7za a -bd -tzip $name.zip $name > /dev/null
187 echo "* Creating $name.7z"
188 7za a -bd $name.7z $name > /dev/null
191 echo "WARNING: ignoring compression '$comp', not known!"
193 esac
194 done
196 # Remove directory with current dist set
197 rm -rf $name
198 done
200 # Cleanup
201 rm -rf phpMyAdmin-${version}
204 echo ""
205 echo ""
206 echo ""
207 echo "Files:"
208 echo "------"
210 ls -la *.gz *.zip *.bz2 *.7z
212 cd ..
215 if [ $# -gt 0 ] ; then
216 echo
217 echo "Additional tasks:"
218 while [ $# -gt 0 ] ; do
219 param=$1
220 case $1 in
221 --tag)
222 tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
223 echo "* Tagging release as $tagname"
224 git tag -a -m "Released $version" $tagname $branch
225 if echo $version | grep -q '^2\.11\.' ; then
226 echo '* 2.11 branch, no STABLE/TESTING update'
227 else
228 if echo $version | grep '[a-z_-]' ; then
229 mark_as_release $branch TESTING
230 else
231 # We update both branches here
232 # As it does not make sense to have older testing than stable
233 mark_as_release $branch TESTING
234 mark_as_release $branch STABLE
236 git checkout master
238 echo " Dont forget to push tags using: git push --tags"
241 echo "Unknown parameter: $1!"
242 exit 1
243 esac
244 shift
245 done
246 echo
249 cat <<END
252 Todo now:
253 ---------
255 1. If not already done, tag the repository with the new revision number
256 for a plain release or a release candidate:
257 version 2.7.0 gets two tags: RELEASE_2_7_0 and STABLE
258 version 2.7.1-rc1 gets RELEASE_2_7_1RC1 and TESTING
260 2. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
261 this release and paste into it the ChangeLog for this release
262 3. upload the files to SF, you can use scripts/upload-release, eg.:
264 ./scripts/upload-release \$USER $version release
265 4. add SF news item to phpMyAdmin project
266 5. announce release on freshmeat (http://freshmeat.net/projects/phpmyadmin/)
267 6. send a short mail (with list of major changes) to
268 phpmyadmin-devel@lists.sourceforge.net
269 phpmyadmin-news@lists.sourceforge.net
270 phpmyadmin-users@lists.sourceforge.net
272 Don't forget to update the Description section in the announcement,
273 based on Documentation.html.
275 7. increment rc count or version in the repository :
276 - in libraries/Config.class.php PMA_Config::__constructor() the line
277 " \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
278 - in Documentation.html the 2 lines
279 " <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
280 " <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
281 - in translators.html
283 8. add a group for bug tracking this new version, at
284 https://sourceforge.net/tracker/admin/index.php?group_id=23067&atid=377408&add_group=1
286 9. the end :-)