1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
|
#!/bin/sh
#
# vim: expandtab sw=4 ts=4 sts=4:
#
# Do not run as CGI
if [ -n "$GATEWAY_INTERFACE" ] ; then
echo 'Can not invoke as CGI!'
exit 1
fi
# More documentation about making a release is available at:
# https://wiki.phpmyadmin.net/pma/Releasing
# Fail on undefined variables
set -u
# Fail on failure
set -e
KITS="all-languages english source"
COMPRESSIONS="zip-7z txz tgz"
# Process parameters
version=""
branch=""
do_tag=0
do_stable=0
do_test=0
do_ci=0
do_sign=1
do_pull=0
do_daily=0
while [ $# -gt 0 ] ; do
case "$1" in
--tag)
do_tag=1
;;
--stable)
do_stable=1
;;
--test)
do_test=1
;;
--daily)
do_sign=0
do_pull=1
do_daily=1
do_test=1
;;
--ci)
do_test=1
do_ci=1
if [ -z "$branch" ] ; then
git branch ci
branch="ci"
fi
version="ci"
;;
--help)
echo "Usages:"
echo " create-release.sh <version> <from_branch> [--tag] [--stable] [--test] [--ci]"
echo ""
echo "If --tag is specified, release tag is automatically created (use this for all releases including pre-releases)"
echo "If --stable is specified, the STABLE branch is updated with this release"
echo "If --test is specified, the testsuite is executed before creating the release"
echo "If --ci is specified, the testsuite is executed and no actual release is crated"
echo ""
echo "Examples:"
echo " create-release.sh 2.9.0-rc1 QA_2_9"
echo " create-release.sh 2.9.0 MAINT_2_9_0 --tag --stable"
exit 65
;;
*)
if [ -z "$version" ] ; then
version=`echo $1 | tr -d -c '0-9a-z.+-'`
if [ "x$version" != "x$1" ] ; then
echo "Invalid version: $1"
exit 1
fi
elif [ -z "$branch" ] ; then
branch=`echo $1 | tr -d -c '0-9A-Za-z_-'`
if [ "x$branch" != "x$1" ] ; then
echo "Invalid branch: $1"
exit 1
fi
else
echo "Unknown parameter: $1!"
exit 1
fi
esac
shift
done
if [ -z "$version" -o -z "$branch" ] ; then
echo "Branch and version have to be specified!"
exit 1
fi
# Checks whether remote branch has local tracking branch
ensure_local_branch() {
if ! git branch | grep -q '^..'"$1"'$' ; then
git branch --track $1 origin/$1
fi
}
# Marks current head of given branch as head of other branch
# Used for STABLE tracking
mark_as_release() {
branch=$1
rel_branch=$2
echo "* Marking release as $rel_branch"
ensure_local_branch $rel_branch
git checkout $rel_branch
git merge -s recursive -X theirs $branch
git checkout master
}
# Ensure we have tracking branch
ensure_local_branch $branch
# Check if we're releasing older
if git cat-file -e $branch:libraries/classes/Config.php 2> /dev/null ; then
CONFIG_LIB=libraries/classes/Config.php
elif git cat-file -e $branch:libraries/Config.php 2> /dev/null ; then
CONFIG_LIB=libraries/Config.php
else
CONFIG_LIB=libraries/Config.class.php
fi
if [ $do_ci -eq 0 -a -$do_daily -eq 0 ] ; then
cat <<END
Please ensure you have incremented rc count or version in the repository :
- in $CONFIG_LIB Config::__constructor() the line
" \$this->set( 'PMA_VERSION', '$version' ); "
- in doc/conf.py the line
" version = '$version' "
- in README
- set release date in ChangeLog
Continue (y/n)?
END
read do_release
if [ "$do_release" != 'y' ]; then
exit 100
fi
fi
# Create working copy
mkdir -p release
git worktree prune
workdir=release/phpMyAdmin-$version
if [ -d $workdir ] ; then
echo "Working directory '$workdir' already exists, please move it out of way"
exit 1
fi
# Add worktree with chosen branch
git worktree add --force $workdir $branch
cd $workdir
if [ $do_pull -eq 1 ] ; then
git pull -q
fi
if [ $do_daily -eq 1 ] ; then
git_head=`git log -n 1 --format=%H`
fi
# Check release version
if [ $do_ci -eq 0 -a -$do_daily -eq 0 ] ; then
if ! grep -q "'PMA_VERSION', '$version'" $CONFIG_LIB ; then
echo "There seems to be wrong version in $CONFIG_LIB!"
exit 2
fi
if ! grep -q "version = '$version'" doc/conf.py ; then
echo "There seems to be wrong version in doc/conf.py"
exit 2
fi
if ! grep -q "Version $version\$" README ; then
echo "There seems to be wrong version in README"
exit 2
fi
fi
# Cleanup release dir
LC_ALL=C date -u > RELEASE-DATE-${version}
# Building documentation
echo "* Generating documentation"
LC_ALL=C make -C doc html
find doc -name '*.pyc' -print0 | xargs -0 -r rm -f
# Check for gettext support
if [ -d po ] ; then
echo "* Generating mo files"
./scripts/generate-mo
if [ -f ./scripts/remove-incomplete-mo ] ; then
echo "* Removing incomplete translations"
./scripts/remove-incomplete-mo
fi
fi
if [ -f ./scripts/line-counts.sh ] ; then
echo "* Generating line counts"
./scripts/line-counts.sh
fi
echo "* Removing unneeded files"
# Remove developer information
rm -rf .github
# Remove phpcs coding standard definition
rm -rf PMAStandard
# Testsuite setup
rm -f .travis.yml .coveralls.yml .scrutinizer.yml .jshintrc .weblate codecov.yml
# Remove readme for github
rm -f README.rst
if [ ! -d libraries/tcpdf ] ; then
echo "* Running composer"
composer update --no-dev
# Okay, there is no way to tell composer to install
# suggested package. Let's require it and then revert
# composer.json to original state.
cp composer.json composer.json.backup
composer require --update-no-dev tecnickcom/tcpdf pragmarx/google2fa bacon/bacon-qr-code
mv composer.json.backup composer.json
echo "* Cleanup of composer packages"
rm -rf \
vendor/phpmyadmin/sql-parser/tests/ \
vendor/phpmyadmin/sql-parser/tools/ \
vendor/phpmyadmin/sql-parser/locale/*/LC_MESSAGES/sqlparser.po \
vendor/phpmyadmin/motranslator/tests/ \
vendor/phpmyadmin/shapefile/tests/ \
vendor/phpmyadmin/shapefile/examples/ \
vendor/phpmyadmin/shapefile/data/ \
vendor/phpseclib/phpseclib/phpseclib/File/ \
vendor/phpseclib/phpseclib/phpseclib/Math/ \
vendor/phpseclib/phpseclib/phpseclib/Net/ \
vendor/phpseclib/phpseclib/phpseclib/System/ \
vendor/symfony/cache/Tests/ \
vendor/symfony/expression-language/Tests/ \
vendor/symfony/expression-language/Resources/ \
vendor/tecnickcom/tcpdf/examples/ \
vendor/tecnickcom/tcpdf/tools/ \
vendor/tecnickcom/tcpdf/fonts/ae_fonts_*/ \
vendor/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-2.33/ \
vendor/tecnickcom/tcpdf/fonts/freefont-*/ \
vendor/tecnickcom/tcpdf/include/sRGB.icc \
vendor/twig/extensions/doc \
vendor/twig/extensions/test \
vendor/twig/twig/doc \
vendor/twig/twig/test \
vendor/google/recaptcha/examples/ \
vendor/google/recaptcha/tests/
find vendor/phpseclib/phpseclib/phpseclib/Crypt/ -maxdepth 1 -type f -not -name AES.php -not -name Base.php -not -name Random.php -not -name Rijndael.php -print0 | xargs -0 rm
find vendor/tecnickcom/tcpdf/fonts/ -maxdepth 1 -type f -not -name 'dejavusans.*' -not -name 'dejavusansb.*' -not -name 'helvetica.php' -print0 | xargs -0 rm
if [ $do_tag -eq 1 ] ; then
echo "* Commiting composer.lock"
git add --force composer.lock
git commit -s -m "Adding composer lock for $version"
fi
fi
# Remove git metadata
rm .git
find . -name .gitignore -print0 | xargs -0 -r rm -f
find . -name .gitattributes -print0 | xargs -0 -r rm -f
if [ $do_test -eq 1 ] ; then
composer update
./vendor/bin/phpunit --configuration phpunit.xml.nocoverage --exclude-group selenium
test_ret=$?
if [ $do_ci -eq 1 ] ; then
cd ../..
rm -rf $workdir
git worktree prune
if [ "$branch" = "ci" ] ; then
git branch -D ci
fi
exit $test_ret
fi
if [ $test_ret -ne 0 ] ; then
exit $test_ret
fi
# Remove libs installed for testing
rm -rf build
composer update --no-dev
fi
cd ..
# Prepare all kits
for kit in $KITS ; do
# Copy all files
name=phpMyAdmin-$version-$kit
cp -r phpMyAdmin-$version $name
# Cleanup translations
cd phpMyAdmin-$version-$kit
./scripts/lang-cleanup.sh $kit
# Remove tests, source code,...
if [ $kit != source ] ; then
echo "* Removing source files"
# Testsuite
rm -rf test/
rm phpunit.xml.* build.xml
# Gettext po files
rm -rf po/
# Documentation source code
mv doc/html htmldoc
rm -rf doc
mkdir doc
mv htmldoc doc/html
rm doc/html/.buildinfo doc/html/objects.inv
# Javascript sources
rm -rf js/vendor/jquery/src/ js/vendor/openlayers/src/
fi
# Remove developer scripts
rm -rf scripts
cd ..
# Remove tar file possibly left from previous run
rm -f $name.tar
# Prepare distributions
for comp in $COMPRESSIONS ; do
case $comp in
tbz|tgz|txz)
if [ ! -f $name.tar ] ; then
echo "* Creating $name.tar"
tar --owner=root --group=root --numeric-owner --sort=name -cf $name.tar $name
fi
if [ $comp = txz ] ; then
echo "* Creating $name.tar.xz"
xz -9k $name.tar
fi
if [ $comp = tgz ] ; then
echo "* Creating $name.tar.gz"
gzip -9c $name.tar > $name.tar.gz
fi
;;
zip-7z)
echo "* Creating $name.zip"
7za a -bd -tzip $name.zip $name > /dev/null
;;
*)
echo "WARNING: ignoring compression '$comp', not known!"
;;
esac
done
# Cleanup
rm -f $name.tar
# Remove directory with current dist set
rm -rf $name
done
# Cleanup
rm -rf phpMyAdmin-${version}
git worktree prune
# Signing of files with default GPG key
echo "* Signing files"
for file in *.gz *.zip *.xz ; do
if [ $do_sign -eq 1 ] ; then
gpg --detach-sign --armor $file
fi
sha1sum $file > $file.sha1
sha256sum $file > $file.sha256
done
if [ $do_daily -eq 1 ] ; then
cat > phpMyAdmin-${version}.json << EOT
{
"date": "`date --iso-8601=seconds`",
"commit": "$git_head"
}
EOT
exit 0
fi
echo ""
echo ""
echo ""
echo "Files:"
echo "------"
ls -la *.gz *.zip *.xz
cd ..
# Tag as release
if [ $do_tag -eq 1 ] ; then
echo
echo "Additional tasks:"
tagname=RELEASE_`echo $version | tr . _ | tr '[:lower:]' '[:upper:]' | tr -d -`
echo "* Tagging release as $tagname"
git tag -s -a -m "Released $version" $tagname $branch
echo " Dont forget to push tags using: git push --tags"
git rm --force composer.lock
git commit -s -m "Removing composer.lock"
fi
# Mark as stable release
if [ $do_stable -eq 1 ] ; then
mark_as_release $branch STABLE
fi
cat <<END
Todo now:
---------
1. If not already done, tag the repository with the new revision number
for a plain release or a release candidate:
version 2.7.0 gets RELEASE_2_7_0
version 2.7.1-rc1 gets RELEASE_2_7_1RC1
2. prepare a release/phpMyAdmin-$version-notes.html explaining in short the goal of
this release and paste into it the ChangeLog for this release, followed
by the notes of all previous incremental versions (i.e. 4.4.9 through 4.4.0)
3. upload the files to our file server, use scripts/upload-release, eg.:
./scripts/upload-release $version release
4. add a news item to our website; a good idea is to include a link to the release notes such as https://www.phpmyadmin.net/files/4.4.10/
5. send a short mail (with list of major changes) to
developers@phpmyadmin.net
news@phpmyadmin.net
Don't forget to update the Description section in the announcement,
based on documentation.
6. increment rc count or version in the repository :
- in $CONFIG_LIB Config::__constructor() the line
" \$this->set( 'PMA_VERSION', '2.7.1-dev' ); "
- in Documentation.html (if it exists) the 2 lines
" <title>phpMyAdmin 2.2.2-rc1 - Documentation</title> "
" <h1>phpMyAdmin 2.2.2-rc1 Documentation</h1> "
- in doc/conf.py (if it exists) the line
" version = '2.7.1-dev' "
7. on https://github.com/phpmyadmin/phpmyadmin/milestones close the milestone corresponding to the released version (if this is a stable release) and open a new one for the next minor release
8. for a stable version, update demo/php/versions.ini in the scripts repository so that the demo server shows current versions
9. in case of a new major release ('y' in x.y.0), update the pmaweb/settings.py in website repository to include the new major releases
10. update the Dockerfile in the docker repository to reflect the new version
END
|