Improve create-release.sh, add scripts/lang-cleanup.sh for removing languages
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -5,6 +5,16 @@ phpMyAdmin - ChangeLog
|
|||||||
$Id$
|
$Id$
|
||||||
$Source$
|
$Source$
|
||||||
|
|
||||||
|
2006-10-06 Michal Čihař <michal@cihar.com>
|
||||||
|
* scripts/lang-cleanup.sh: Script for removing not installed languages
|
||||||
|
from libraries/select_lang.lib.php.
|
||||||
|
* scripts/create-release.sh: Make it better :-):
|
||||||
|
- Create 7z archives
|
||||||
|
- Make compression list configurable
|
||||||
|
- Allow to define which kits to build
|
||||||
|
- Call scripts/lang-cleanup.sh to remove not wanted languages
|
||||||
|
- Do not login to cvs if already logged in
|
||||||
|
|
||||||
2006-10-05 Marc Delisle <lem9@users.sourceforge.net>
|
2006-10-05 Marc Delisle <lem9@users.sourceforge.net>
|
||||||
* scripts/create-release.sh: starting changes for new kits
|
* scripts/create-release.sh: starting changes for new kits
|
||||||
TODO: - trimming of libraries/select_lang.lib.php in the kit
|
TODO: - trimming of libraries/select_lang.lib.php in the kit
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
|
# vim: expandtab sw=4 ts=4 sts=4:
|
||||||
#
|
#
|
||||||
# 2005-09-13, lem9@users.sourceforge.net
|
# 2005-09-13, lem9@users.sourceforge.net
|
||||||
# - no longer create a config.default.php from config.inc.php
|
# - no longer create a config.default.php from config.inc.php
|
||||||
@@ -67,7 +68,9 @@
|
|||||||
# - added release todo list
|
# - added release todo list
|
||||||
#
|
#
|
||||||
|
|
||||||
cvsserver=${cvsserver:-phpmyadmin.cvs}
|
cvsserver=${cvsserver:-phpmyadmin.cvs.sourceforge.net}
|
||||||
|
KITS="all-languages-utf-8-only all-languages english"
|
||||||
|
COMPRESSIONS="zip-7z tbz tgz 7z"
|
||||||
|
|
||||||
if [ $# = 0 ]
|
if [ $# = 0 ]
|
||||||
then
|
then
|
||||||
@@ -153,14 +156,17 @@ fi
|
|||||||
mkdir cvs
|
mkdir cvs
|
||||||
cd cvs
|
cd cvs
|
||||||
|
|
||||||
if [ "$mode" != "snapshot" ]
|
if [ "$mode" != "snapshot" ] ; then
|
||||||
then
|
if grep -Fq ':pserver:anonymous@phpmyadmin.cvs.sourceforge.net:2401/cvsroot/phpmyadmin' ~/.cvspass ; then
|
||||||
echo "Press [ENTER]!"
|
echo "You seem to be already logged into phpMyAdmin CVS, skipping that"
|
||||||
cvs -q -d:pserver:anonymous@$cvsserver:/cvsroot/phpmyadmin login
|
else
|
||||||
if [ $? -ne 0 ] ; then
|
echo "Press [ENTER]!"
|
||||||
echo "CVS login failed, bailing out"
|
cvs -q -d:pserver:anonymous@$cvsserver:/cvsroot/phpmyadmin login
|
||||||
exit 1
|
if [ $? -ne 0 ] ; then
|
||||||
fi
|
echo "CVS login failed, bailing out"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cvs -q -z3 -d:pserver:anonymous@$cvsserver:/cvsroot/phpmyadmin co -P $branch phpMyAdmin
|
cvs -q -z3 -d:pserver:anonymous@$cvsserver:/cvsroot/phpmyadmin co -P $branch phpMyAdmin
|
||||||
@@ -190,41 +196,55 @@ LC_ALL=C w3m -dump phpMyAdmin/Documentation.html > phpMyAdmin/Documentation.txt
|
|||||||
# Renaming directory
|
# Renaming directory
|
||||||
mv phpMyAdmin phpMyAdmin-$target
|
mv phpMyAdmin phpMyAdmin-$target
|
||||||
|
|
||||||
# Building distribution kits
|
# Prepare all kits
|
||||||
|
for kit in $KITS ; do
|
||||||
|
# Copy all files
|
||||||
|
name=phpMyAdmin-$target-$kit
|
||||||
|
cp -r phpMyAdmin-$target $name
|
||||||
|
|
||||||
suffix="-all-languages"
|
# Cleanup translations
|
||||||
zip -9 -r phpMyAdmin-${target}${suffix}.zip phpMyAdmin-${target}
|
cd phpMyAdmin-$target-$kit
|
||||||
tar cvf phpMyAdmin-${target}${suffix}.tar phpMyAdmin-${target}
|
# FIXME: maybe this is wrong path, use script from kit?
|
||||||
bzip2 -9kv phpMyAdmin-${target}${suffix}.tar
|
../../scripts/lang-cleanup.sh $kit
|
||||||
gzip -9v phpMyAdmin-${target}${suffix}.tar
|
cd ..
|
||||||
|
|
||||||
cd phpMyAdmin-${target}/lang
|
# Prepare distributions
|
||||||
mkdir tmp
|
for comp in $COMPRESSIONS ; do
|
||||||
mv *utf-8.inc.php tmp
|
case $comp in
|
||||||
rm *.inc.php
|
tbz|tgz)
|
||||||
mv tmp/* .
|
echo "Creating $name.tar"
|
||||||
rmdir tmp
|
tar cf $name.tar $name
|
||||||
|
if [ $comp = tbz ] ; then
|
||||||
|
echo "Creating $name.tar.bz2"
|
||||||
|
bzip2 -9k $name.tar
|
||||||
|
fi
|
||||||
|
if [ $comp = tgz ] ; then
|
||||||
|
echo "Creating $name.tar.gz"
|
||||||
|
gzip -9c $name.tar > $name.tar.gz
|
||||||
|
fi
|
||||||
|
rm $name.tar
|
||||||
|
;;
|
||||||
|
zip)
|
||||||
|
echo "Creating $name.zip"
|
||||||
|
zip -q -9 -r $name.zip $name
|
||||||
|
;;
|
||||||
|
zip-7z)
|
||||||
|
echo "Creating $name.zip"
|
||||||
|
7za a -bd -tzip $name.zip $name > /dev/null
|
||||||
|
;;
|
||||||
|
7z)
|
||||||
|
echo "Creating $name.7z"
|
||||||
|
7za a -bd $name.7z $name > /dev/null
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "WARNING: ignoring compression '$comp', not known!"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
cd ../..
|
# Remove directory with current dist set
|
||||||
suffix="-all-languages-utf-8-only"
|
rm -rf $name
|
||||||
zip -9 -r phpMyAdmin-${target}${suffix}.zip phpMyAdmin-${target}
|
done
|
||||||
tar cvf phpMyAdmin-${target}${suffix}.tar phpMyAdmin-${target}
|
|
||||||
bzip2 -9kv phpMyAdmin-${target}${suffix}.tar
|
|
||||||
gzip -9v phpMyAdmin-${target}${suffix}.tar
|
|
||||||
|
|
||||||
cd phpMyAdmin-${target}/lang
|
|
||||||
mkdir tmp
|
|
||||||
mv english-utf-8.inc.php tmp
|
|
||||||
rm *.inc.php
|
|
||||||
mv tmp/* .
|
|
||||||
rmdir tmp
|
|
||||||
|
|
||||||
cd ../..
|
|
||||||
suffix="-english"
|
|
||||||
zip -9 -r phpMyAdmin-${target}${suffix}.zip phpMyAdmin-${target}
|
|
||||||
tar cvf phpMyAdmin-${target}${suffix}.tar phpMyAdmin-${target}
|
|
||||||
bzip2 -9kv phpMyAdmin-${target}${suffix}.tar
|
|
||||||
gzip -9v phpMyAdmin-${target}${suffix}.tar
|
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -rf phpMyAdmin-${target}
|
rm -rf phpMyAdmin-${target}
|
||||||
@@ -245,13 +265,13 @@ echo
|
|||||||
echo "MD5 sums:"
|
echo "MD5 sums:"
|
||||||
echo "--------"
|
echo "--------"
|
||||||
|
|
||||||
md5sum *.{gz,zip,bz2} | sed "s/\([^ ]*\)[ ]*\([^ ]*\)/\$md5sum['\2'] = '\1';/"
|
md5sum *.{gz,zip,bz2,7z} | sed "s/\([^ ]*\)[ ]*\([^ ]*\)/\$md5sum['\2'] = '\1';/"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Sizes:"
|
echo "Sizes:"
|
||||||
echo "------"
|
echo "------"
|
||||||
|
|
||||||
ls -l --block-size=k *.{gz,zip,bz2} | sed -r "s/[a-z-]+[[:space:]]+[0-9]+[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+([0-9]*)K.*[[:space:]]([^[:space:]]+)\$/\$size['\2'] = \1;/"
|
ls -l --block-size=k *.{gz,zip,bz2,7z} | sed -r "s/[a-z-]+[[:space:]]+[0-9]+[[:space:]]+[^[:space:]]+[[:space:]]+[^[:space:]]+[[:space:]]+([0-9]*)K.*[[:space:]]([^[:space:]]+)\$/\$size['\2'] = \1;/"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "Add these to /home/groups/p/ph/phpmyadmin/htdocs/home_page/files.inc.php on sf"
|
echo "Add these to /home/groups/p/ph/phpmyadmin/htdocs/home_page/files.inc.php on sf"
|
||||||
|
81
scripts/lang-cleanup.sh
Executable file
81
scripts/lang-cleanup.sh
Executable file
@@ -0,0 +1,81 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
# vim: expandtab sw=4 ts=4 sts=4:
|
||||||
|
#
|
||||||
|
# Script for removing language selection from phpMyAdmin
|
||||||
|
|
||||||
|
TYPES=<<EOT
|
||||||
|
all-languages:-false
|
||||||
|
all-languages-utf-8-only:-not -name '*-utf-8.inc.php'
|
||||||
|
EOT
|
||||||
|
|
||||||
|
if [ $# -lt 1 ] ; then
|
||||||
|
echo "Usage: lang-cleanup.sh type ..."
|
||||||
|
echo "Type can be one of:"
|
||||||
|
echo " all-languages - nothing will be done"
|
||||||
|
echo " all-languages-utf-8-only - non utf-8 languages will be deleted"
|
||||||
|
echo " language - keeps utf-8 version of language"
|
||||||
|
echo " language-charset - keeps this exact language"
|
||||||
|
echo
|
||||||
|
echo "Types can be entered multiple times, all matched languages will be kept"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Construct expressions for find
|
||||||
|
match=""
|
||||||
|
for type in "$@" ; do
|
||||||
|
case $type in
|
||||||
|
all-languages)
|
||||||
|
match="$match -and -false"
|
||||||
|
;;
|
||||||
|
all-languages-utf-8-only)
|
||||||
|
match="$match -and -not -name *-utf-8.inc.php"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if [ -f lang/$type-utf-8.inc.php ] ; then
|
||||||
|
match="$match -and -not -name $type-utf-8.inc.php"
|
||||||
|
elif [ -f lang/$type.inc.php ] ; then
|
||||||
|
match="$match -and -not -name $type.inc.php"
|
||||||
|
else
|
||||||
|
echo "ERROR: $type seems to be wrong!"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Delete unvanted languages
|
||||||
|
find lang -name \*.inc.php $match -print0 | xargs -0r rm
|
||||||
|
|
||||||
|
# Cleanup libraries/select_lang.lib.php
|
||||||
|
|
||||||
|
# Find languages we have
|
||||||
|
langmatch="$(awk -F, \
|
||||||
|
'BEGIN { pr = 1 } ;
|
||||||
|
/^\);/ { pr = 1 } ;
|
||||||
|
{if(!pr) print $2;};
|
||||||
|
/^\$available_languages/ { pr = 0 };' \
|
||||||
|
libraries/select_lang.lib.php \
|
||||||
|
| tr -d \' \
|
||||||
|
| while read lng ; do if [ -f lang/$lng.inc.php ] ; then echo $lng ; fi ; done \
|
||||||
|
| tr '\n' '|' \
|
||||||
|
| sed 's/|$//' \
|
||||||
|
)"
|
||||||
|
|
||||||
|
# Prepare working copy
|
||||||
|
tmp=`mktemp libraries/select_lang.lib.php.XXXX`
|
||||||
|
cat libraries/select_lang.lib.php > $tmp
|
||||||
|
|
||||||
|
# Remove languages we don't have
|
||||||
|
awk -F, \
|
||||||
|
'BEGIN { pr = 1 } ;
|
||||||
|
/^\);/ { pr = 1 } ;
|
||||||
|
{if(pr) print $0;};
|
||||||
|
/'$langmatch'/ {if (!pr) print $0;};
|
||||||
|
/^\$available_languages/ { pr = 0 };' \
|
||||||
|
$tmp > libraries/select_lang.lib.php
|
||||||
|
|
||||||
|
# Final cleanup
|
||||||
|
rm -f $tmp
|
||||||
|
|
Reference in New Issue
Block a user