From 6b364b16044c0b2e68e4b15efb0aaca932706489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Thu, 24 Sep 2009 17:19:05 +0300 Subject: [PATCH] Add support for hard links in pack and cleanup statistics. --- pack | 2 +- statistics | 22 ++++++++-------------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/pack b/pack index 2329d47..e797dae 100755 --- a/pack +++ b/pack @@ -38,7 +38,7 @@ for BRANCH in $TRUNK $BRANCHES; do echo -e "Branch: $BLUE$BRANCH"$ENDCOLOR DIR="$PREFIX-$BRANCH" 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` echo -n "Processing catalog $bfile... "; d=`echo "$bfile" | sed "s/.$LCODE.po//"` diff --git a/statistics b/statistics index 017c1b0..be763db 100755 --- a/statistics +++ b/statistics @@ -93,21 +93,15 @@ for BRANCH in $TRUNK $BRANCHES; do graph " >> $STATSFILE - for dir in `ls $BRANCH/wesnoth* -d`; do - file=$DIR"/"`basename $dir`"."$LCODE".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 + for file in `ls "$DIR"`; 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' $file` + charset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' "$DIR/$file"` 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 has_errors="yes" 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 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" echo -e $RED"FAILED; odd characters found"$ENDCOLOR 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. if [ "$has_errors" = "no" ]; then 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" echo -e $RED"FAILED"$ENDCOLOR else @@ -156,7 +150,7 @@ for BRANCH in $TRUNK $BRANCHES; do STATUS="Error" fi 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} 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} @@ -188,7 +182,7 @@ for BRANCH in $TRUNK $BRANCHES; do echo "" >> $STATSFILE CL=$(( ($CL+1)%2 )) - echo " `basename $filename` + echo " `basename $filename` $st $t" >> $STATSFILE printf '%s%d%s%.2f%s\n' " " $rt "" >> $STATSFILE