Add support for hard links in pack and cleanup statistics.

This commit is contained in:
Andrius Štikonas 2009-09-24 17:19:05 +03:00
parent 091981a30c
commit 6b364b1604
2 changed files with 9 additions and 15 deletions

2
pack
View File

@ -38,7 +38,7 @@ for BRANCH in $TRUNK $BRANCHES; do
echo -e "Branch: $BLUE$BRANCH"$ENDCOLOR echo -e "Branch: $BLUE$BRANCH"$ENDCOLOR
DIR="$PREFIX-$BRANCH" DIR="$PREFIX-$BRANCH"
mkdir "$LCODE-temp" mkdir "$LCODE-temp"
for file in `find $DIR -name "*.$LCODE.po"`; do for file in `find $DIR -follow -name "*.$LCODE.po"`; do
bfile=`basename $file` bfile=`basename $file`
echo -n "Processing catalog $bfile... "; echo -n "Processing catalog $bfile... ";
d=`echo "$bfile" | sed "s/.$LCODE.po//"` d=`echo "$bfile" | sed "s/.$LCODE.po//"`

View File

@ -93,21 +93,15 @@ for BRANCH in $TRUNK $BRANCHES; do
<td class=\"title\">graph</td> <td class=\"title\">graph</td>
</tr>" >> $STATSFILE </tr>" >> $STATSFILE
for dir in `ls $BRANCH/wesnoth* -d`; do for file in `ls "$DIR"`; do
file=$DIR"/"`basename $dir`"."$LCODE".po"; filename=`echo $file | sed s/.po//`
if [ ! -f $file ]; then
file=$BRANCH"/"`basename $dir`"/"$LCODE".po"
filename=$BRANCH`basename $dir`"/"$dir"."$LCODE
else
filename=`echo $file | sed s/.po//`
fi
npo=$(($npo + 1)); has_errors="no"; has_warnings="no"; npo=$(($npo + 1)); has_errors="no"; has_warnings="no";
# Extract the declared charset, may be we use this in future. # Extract the declared charset, may be we use this in future.
charset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' $file` charset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' "$DIR/$file"`
echo -n "Checking $file for UTF-8 inconsistencies... " echo -n "Checking $file for UTF-8 inconsistencies... "
if $ISUTF8 <$file >/dev/null 2>&1; then if $ISUTF8 < "$DIR/$file" > /dev/null 2>&1; then
if ! echo $charset | grep -qi "UTF-8"; then if ! echo $charset | grep -qi "UTF-8"; then
has_errors="yes" has_errors="yes"
echo -e $RED"FAILED; non UTF-8 charset declaration for UTF-8 content"$ENDCOLOR echo -e $RED"FAILED; non UTF-8 charset declaration for UTF-8 content"$ENDCOLOR
@ -126,7 +120,7 @@ for BRANCH in $TRUNK $BRANCHES; do
fi fi
echo -n "Checking $file for odd characters... " echo -n "Checking $file for odd characters... "
if grep -nH $ODD_CHARS $file >> $ERRORS; then if grep -nH $ODD_CHARS "$DIR/$file" >> $ERRORS; then
has_warnings="yes" has_warnings="yes"
echo -e $RED"FAILED; odd characters found"$ENDCOLOR echo -e $RED"FAILED; odd characters found"$ENDCOLOR
echo "$file: one or more odd character from the '$ODD_CHARS' set found." >> $ERRORS echo "$file: one or more odd character from the '$ODD_CHARS' set found." >> $ERRORS
@ -137,7 +131,7 @@ for BRANCH in $TRUNK $BRANCHES; do
# Makes sense only if the file passed the UTF-8 check. # Makes sense only if the file passed the UTF-8 check.
if [ "$has_errors" = "no" ]; then if [ "$has_errors" = "no" ]; then
echo -n "Checking $file with msgfmt... " echo -n "Checking $file with msgfmt... "
if ! LC_MESSAGES=C $MSGFMT --check -o /dev/null $file >> $ERRORS; then if ! LC_MESSAGES=C $MSGFMT --check -o /dev/null "$DIR/$file" >> $ERRORS; then
has_errors="yes" has_errors="yes"
echo -e $RED"FAILED"$ENDCOLOR echo -e $RED"FAILED"$ENDCOLOR
else else
@ -156,7 +150,7 @@ for BRANCH in $TRUNK $BRANCHES; do
STATUS="Error" STATUS="Error"
fi fi
else else
stat=`LC_MESSAGES=C $MSGFMT --statistics -o /dev/null $file 2>&1` stat=`LC_MESSAGES=C $MSGFMT --statistics -o /dev/null "$DIR/$file" 2>&1`
t=`echo "$stat" | sed -ne 's/\([0-9]\+\) translated .*/\1/p'`; t=${t:-0} 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} 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} f=`echo "$stat" | sed -ne 's/.* \([0-9]\+\) fuzzy translation.*/\1/p'`; f=${f:-0}
@ -188,7 +182,7 @@ for BRANCH in $TRUNK $BRANCHES; do
echo "<tr class=\"row-$CL\">" >> $STATSFILE echo "<tr class=\"row-$CL\">" >> $STATSFILE
CL=$(( ($CL+1)%2 )) CL=$(( ($CL+1)%2 ))
echo " <td align=\"left\"><strong><a href=\"$filename".po"\">`basename $filename`</a></strong></td> echo " <td align=\"left\"><strong><a href=\""$DIR/$filename.po"\">`basename $filename`</a></strong></td>
<td class=\"percentage-$CL\" align=\"center\">$st</td> <td class=\"percentage-$CL\" align=\"center\">$st</td>
<td class=\"row-$CL\" align=\"right\">$t</td>" >> $STATSFILE <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 printf '%s%d%s%.2f%s\n' " <td class=\"percentage-" $CL "\" align=\"right\">" $rt "</td>" >> $STATSFILE