Port to git.

This commit is contained in:
Andrius Štikonas 2013-03-28 13:23:11 +02:00
부모 9e689681f5
커밋 d4e87aff33
6개의 변경된 파일35개의 추가작업 그리고 131개의 파일을 삭제

12
compile
파일 보기

@ -17,20 +17,14 @@
source "`dirname $0`/variables"
if [ ! $MSGFMT ]; then
echo -e $RED"This program needs the msgfmt utility."$ENDCOLOR
exit 1
fi
for BRANCH in $TRUNK $BRANCHES; do
for BRANCH in $BRANCHES; do
echo -e "Repository: $BLUE$BRANCH"$ENDCOLOR
DIR="$PREFIX-$BRANCH"
if [ ! -e "$MDIR/$BRANCH" ]; then
mkdir -p "$MDIR/$BRANCH"
fi
for file in `ls $DIR`; do
for file in `ls $BRANCH`; do
echo "Compiling $file";
$MSGFMT "$DIR/$file" -o "$MDIR/$BRANCH/`echo wesnoth-$file | sed "s/."$LCODE".po/.mo/" | sed "s/wesnoth-wesnoth/wesnoth/"`"
$MSGFMT "$BRANCH/$file" -o "$MDIR/$BRANCH/`echo wesnoth-$file | sed "s/."$LCODE".po/.mo/" | sed "s/wesnoth-wesnoth/wesnoth/"`"
done
rm "$MDIR/$BRANCH/wesnoth-manpages.mo" "$MDIR/$BRANCH/wesnoth-manual.mo"
done

31
pack
파일 보기

@ -16,35 +16,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
source "`dirname $0`/variables"
if [ ! $DIFF ]; then
echo -e $RED"This program needs the diff utility."$ENDCOLOR
exit 1
fi
if [ ! $TAR ]; then
echo -e $RED"This program needs the tar utility."$ENDCOLOR
exit 1
fi
if [ ! $BZIP2 ]; then
echo -e $RED"This program needs the bzip2 utility."$ENDCOLOR
exit 1
fi
counter=0
for BRANCH in $TRUNK $BRANCHES; do
echo -e "Branch: $BLUE$BRANCH"$ENDCOLOR
DIR="$PREFIX-$BRANCH"
for BRANCH in $BRANCHES; do
echo -e "Checking out files from $BLUE$BRANCH"$ENDCOLOR
$GIT archive --remote $REPO --prefix=$BRANCH-temp/ --format=tar $BRANCH:po | tar x
mkdir "$LCODE-temp"
for file in `find $DIR -follow -name "*.$LCODE.po"`; do
counter=0
for file in `find $BRANCH -follow -name "*.$LCODE.po"`; do
bfile=`basename $file`
echo -n "Processing catalog $bfile... ";
d=`echo "$bfile" | sed "s/.$LCODE.po//"`
dirdomain=`echo wesnoth-$d | sed "s/wesnoth-wesnoth/wesnoth/"`
if [ -f "$BRANCH/$dirdomain/$LCODE.po" ]; then
if ! $DIFF -q "$file" "$BRANCH/$dirdomain/$LCODE.po" > /dev/null ; then
if [ -f "$BRANCH-temp/$dirdomain/$LCODE.po" ]; then
if ! $DIFF -q "$file" "$BRANCH-temp/$dirdomain/$LCODE.po" > /dev/null ; then
mkdir "$LCODE-temp/$dirdomain"
cp "$file" "$LCODE-temp/$dirdomain/$LCODE.po"
echo -e $GREEN"OK"$ENDCOLOR
@ -72,6 +56,7 @@ for BRANCH in $TRUNK $BRANCHES; do
$BZIP2 --best $LCODE-$BRANCH.tar
echo "New archive created."
fi
rm -rf $BRANCH-temp
rmdir $LCODE-temp
done

파일 보기

@ -18,24 +18,13 @@
source "`dirname $0`/variables"
LC_NUMERIC="en_US.UTF-8"
LC_ALL=C
ODD_CHARS='<27>'
CL=0 # counter for css style
STATUS="OK" # Total status of translations
if [ ! $MSGFMT ]; then
echo -e $RED"This program needs the msgfmt utility."$ENDCOLOR
exit 1
fi
if [ ! $ISUTF8 ]; then
echo -e $RED"This program needs the isutf8 utility."$ENDCOLOR
exit 1
fi
for BRANCH in $TRUNK $BRANCHES; do
for BRANCH in $BRANCHES; do
echo -e "Repository: $BLUE$BRANCH"$ENDCOLOR
DIR="$PREFIX-$BRANCH"
STATSFILE="statistics-$BRANCH.html"
ERRORS="translation-errors-$BRANCH"
nerror=0; nwarn=0; npo=0; nt=0; nu=0; nf=0
@ -93,15 +82,15 @@ for BRANCH in $TRUNK $BRANCHES; do
<td class=\"title\">graph</td>
</tr>" >> $STATSFILE
for file in `ls "$DIR"`; do
for file in `ls "$BRANCH"`; do
filename=`echo $file | sed s/.po//`
npo=$(($npo + 1)); has_errors="no"; has_warnings="no";
# Extract the declared charset, may be we use this in future.
charset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' "$DIR/$file"`
charset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' "$BRANCH/$file"`
echo -n "Checking $file for UTF-8 inconsistencies... "
if $ISUTF8 < "$DIR/$file" > /dev/null 2>&1; then
if $ISUTF8 < "$BRANCH/$file" > /dev/null 2>&1; then
if ! echo $charset | grep -qi "UTF-8"; then
has_errors="yes"
echo -e $RED"FAILED; non UTF-8 charset declaration for UTF-8 content"$ENDCOLOR
@ -120,7 +109,7 @@ for BRANCH in $TRUNK $BRANCHES; do
fi
echo -n "Checking $file for odd characters... "
if grep -nH $ODD_CHARS "$DIR/$file" >> $ERRORS; then
if grep -nH $ODD_CHARS "$BRANCH/$file" >> $ERRORS; then
has_warnings="yes"
echo -e $RED"FAILED; odd characters found"$ENDCOLOR
echo "$file: one or more odd character from the '$ODD_CHARS' set found." >> $ERRORS
@ -131,7 +120,7 @@ for BRANCH in $TRUNK $BRANCHES; do
# Makes sense only if the file passed the UTF-8 check.
if [ "$has_errors" = "no" ]; then
echo -n "Checking $file with msgfmt... "
if ! LC_MESSAGES=C $MSGFMT --check -o /dev/null "$DIR/$file" >> $ERRORS; then
if ! LC_MESSAGES=C $MSGFMT --check -o /dev/null "$BRANCH/$file" >> $ERRORS; then
has_errors="yes"
echo -e $RED"FAILED"$ENDCOLOR
else
@ -150,7 +139,7 @@ for BRANCH in $TRUNK $BRANCHES; do
STATUS="Error"
fi
else
stat=`LC_MESSAGES=C $MSGFMT --statistics -o /dev/null "$DIR/$file" 2>&1`
stat=`LC_MESSAGES=C $MSGFMT --statistics -o /dev/null "$BRANCH/$file" 2>&1`
t=`echo "$stat" | sed -ne 's/\([0-9]\+\) translated .*/\1/p'`; t=${t:-0}
u=`echo "$stat" | sed -ne 's/.* \([0-9]\+\) untranslated .*/\1/p'`; u=${u:-0}
f=`echo "$stat" | sed -ne 's/.* \([0-9]\+\) fuzzy translation.*/\1/p'`; f=${f:-0}
@ -182,7 +171,7 @@ for BRANCH in $TRUNK $BRANCHES; do
echo "<tr class=\"row-$CL\">" >> $STATSFILE
CL=$(( ($CL+1)%2 ))
echo " <td align=\"left\"><strong><a href=\""$DIR/$filename.po"\">`basename $filename`</a></strong></td>
echo " <td align=\"left\"><strong><a href=\""$BRANCH/$filename.po"\">`basename $filename`</a></strong></td>
<td class=\"percentage-$CL\" align=\"center\">$st</td>
<td class=\"row-$CL\" align=\"right\">$t</td>" >> $STATSFILE
printf '%s%d%s%.2f%s\n' " <td class=\"percentage-" $CL "\" align=\"right\">" $rt "</td>" >> $STATSFILE
@ -199,7 +188,7 @@ for BRANCH in $TRUNK $BRANCHES; do
done
if [ "$npo" -eq 0 ]; then
echo -e $RED"No '${PO}.po' file under '$DIR'."$ENDCOLOR
echo -e $RED"No '${PO}.po' file under '$BRANCH'."$ENDCOLOR
exit 0
fi

65
update
파일 보기

@ -17,68 +17,16 @@
source "`dirname $0`/variables"
if [ ! $SVN ]; then
echo -e $RED"This program needs the svn utility."$ENDCOLOR
exit 1
fi
if [ ! $MSGFMT ]; then
echo -e $RED"This program needs the msgfmt utility."$ENDCOLOR
exit 1
fi
if [ ! $MSGMERGE ]; then
echo -e $RED"This program needs the msgmerge utility."$ENDCOLOR
exit 1
fi
if [ ! $MSGINIT ]; then
echo -e $RED"This program needs the msginit utility."$ENDCOLOR
exit 1
fi
echo -e "Language: $RED$LCODE"$ENDCOLOR
echo ""
if [ ! -z $TRUNK ]; then
if [ -e $TRUNK/.svn ]; then
echo -e "Updating repository: "$BLUE"trunk"
cd $TRUNK
$SVN update
cd ..
else
echo -e "Checking out repository: "$BLUE"trunk"
$SVN checkout "$REPO/$TRUNK/po" $TRUNK
fi
echo -e $ENDCOLOR
if [ ! -e "$PREFIX-$TRUNK" ]; then
mkdir "$PREFIX-$TRUNK"
fi
fi
for BRANCH in $BRANCHES; do
if [ -e $BRANCH/.svn ]; then
echo -e "Updating repository: $BLUE$BRANCH"
cd $BRANCH
$SVN update
cd ..
else
echo -e "Checking out repository: $BLUE$BRANCH"
$SVN checkout "$REPO/branches/$BRANCH/po" $BRANCH
echo -e "Checking out files from $BLUE$BRANCH"$ENDCOLOR
if [ ! -e "$BRANCH" ]; then
mkdir "$BRANCH"
fi
echo -e $ENDCOLOR
if [ ! -e "$PREFIX-$BRANCH" ]; then
mkdir "$PREFIX-$BRANCH"
fi
done
for BRANCH in $TRUNK $BRANCHES; do
SVNDIR=$BRANCH
DIR="$PREFIX-$BRANCH"
echo -e "Merging: $BLUE$BRANCH"$ENDCOLOR
for dir in `ls $SVNDIR/wesnoth* -d`; do
$GIT archive --remote $REPO --prefix="$BRANCH-temp/" --format=tar "$BRANCH:po" | tar x
for dir in `ls "$BRANCH-temp/wesnoth"* -d`; do
echo "Processing `basename $dir | sed s/wesnoth-//`.$LCODE.po"
file="$DIR/`basename $dir | sed s/wesnoth-//`.$LCODE.po"
file="$BRANCH/`basename $dir | sed s/wesnoth-//`.$LCODE.po"
if [ -f $dir"/"$LCODE".po" ]; then
if [ -f "$file" ]; then
echo -e $BLUE"Merging:"$ENDCOLOR
@ -99,5 +47,6 @@ for BRANCH in $TRUNK $BRANCHES; do
fi
echo ""
done
rm -rf "$BRANCH-temp"
done
echo -e $GREEN"Finished."$ENDCOLOR

파일 보기

@ -16,19 +16,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Repositories
REPO="http://svn.gna.org/svn/wesnoth"
BRANCHES="1.6" # one or multiple branches separated by space. Can be blank.
TRUNK="" # "trunk" or ""
REPO="~/repositories/wesnoth" # preferably local clone but remote should work as well
BRANCHES="master 1.10" # one or multiple branches separated by space.
# Options
LCODE="lt" # Language code. Only 1 language is supported.
#Paths
# Paths
MDIR="mo"
PREFIX="workspace"
#Binaries
SVN=`which svn 2> /dev/null`
# Binaries. Don't forget to install them before usign these scripts.
GIT=`which git 2> /dev/null`
MSGFMT=`which msgfmt 2> /dev/null`
MSGMERGE=`which msgmerge 2> /dev/null`
MSGINIT=`which msginit 2> /dev/null`
@ -37,8 +35,8 @@ TAR=`which tar 2> /dev/null`
BZIP2=`which bzip2 2> /dev/null`
DIFF=`which diff 2> /dev/null`
#Colors
# Colors
RED="\033[1;31m"
GREEN="\033[1;32m"
BLUE="\033[1;34m"
ENDCOLOR="\033[0m"
ENDCOLOR="\033[0m"

11
wrap
파일 보기

@ -1,11 +0,0 @@
#!/bin/bash
# Wrap po files.
# This file is in public domain.
for file in `git ls-files -m *.po`; do
msgattrib $file > $file.temp && mv $file.temp $file &
done
while ls | grep ".temp" > /dev/null; do
continue
done