Add multithreading to backport script.

This commit is contained in:
Andrius Štikonas 2010-09-08 20:36:08 +03:00
parent 997b2c7f25
commit 02f723f87f
2 changed files with 31 additions and 6 deletions

View File

@ -2,10 +2,30 @@
source "`dirname $0`/ths-variables"
./poupdate -NS trunk stable pot-stable
./poupdate -NS doc-trunk doc-stable doc-pot-stable
function jobidfromstring()
{
local STRING;
local RET;
echo -e $BLUE"Running sed script on all files..."$ENDCOLOR
STRING=$1;
RET="$(echo $STRING | sed 's/^[^0-9]*//' | sed 's/[^0-9].*$//')"
echo $RET;
}
echo -e $BLUE"Running poupdate..."$ENDCOLOR
./poupdate -NS --silent trunk stable pot-stable &
LASTJOB=`jobidfromstring $(jobs %%)`
JOBLIST="$LASTJOB"
./poupdate -NS --silent doc-trunk doc-stable doc-pot-stable &
LASTJOB=`jobidfromstring $(jobs %%)`
JOBLIST="$JOBLIST $LASTJOB"
for JOB in $JOBLIST ; do
wait %$JOB
done
echo -e $BLUE"Running sed script..."$ENDCOLOR
for po in `find stable doc-stable -follow -name "*.po"`; do
sed -ie 's/\"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : n%10==1 \&\& n%100!=11 ? 1 : n\"/\"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : n%10==1 \&\& n%100!=11 ? 1 : n%\"/

View File

@ -46,6 +46,7 @@ function usage() {
echo " as secondary (default - use the new files"
echo " as primary translations)"
echo " -v|--verbose - print msgmerge output"
echo " -s|--silent - print only summary"
exit 1
}
@ -61,6 +62,10 @@ do
option_verbose="Y"
shift
;;
-s|--silent)
option_silent="Y"
shift
;;
-*|--*)
usage
;;
@ -89,8 +94,8 @@ changed_files=0
if [ "$option_verbose" = "Y" ]; then
echo "Checking if updated files are in the specified directory ..."
else
echo -ne "\r$processed_files/$total_files merged"
elif [ ! "$option_silent" = "Y" ]; then
echo -ne "\r$processed_files/$total_files processed"
fi
if [ "$newtrans" == "" ]; then
echo -e $RED"\t\t... no updated files found in: $upd_dir"$ENDCOLOR
@ -187,7 +192,7 @@ fi
rm $tra_tree/${trafile}.old $tra_tree/${trafile}.new
processed_files=$(($processed_files+1))
if [ ! "$option_verbose" = "Y" ]; then
if [ ! "$option_verbose" = "Y" ] && [ ! "$option_silent" = "Y" ]; then
echo -ne "\r$processed_files/$total_files processed"
if [ $DIFF ] && [ ! $changed_files -eq 0 ]; then
echo -ne ", $changed_files changed"