Browse Source

Port to git.

master
Andrius Štikonas 6 years ago
parent
commit
d4e87aff33
6 changed files with 35 additions and 131 deletions
  1. 3
    9
      compile
  2. 8
    23
      pack
  3. 10
    21
      statistics
  4. 7
    58
      update
  5. 7
    9
      variables
  6. 0
    11
      wrap

+ 3
- 9
compile View File

@@ -17,20 +17,14 @@
17 17
 
18 18
 source "`dirname $0`/variables"
19 19
 
20
-if [ ! $MSGFMT ]; then
21
-	echo -e $RED"This program needs the msgfmt utility."$ENDCOLOR
22
-	exit 1
23
-fi
24
-
25
-for BRANCH in $TRUNK $BRANCHES; do
20
+for BRANCH in $BRANCHES; do
26 21
 	echo -e "Repository: $BLUE$BRANCH"$ENDCOLOR
27
-	DIR="$PREFIX-$BRANCH"
28 22
 	if [ ! -e "$MDIR/$BRANCH" ]; then
29 23
 		mkdir -p "$MDIR/$BRANCH"
30 24
 	fi
31
-	for file in `ls $DIR`; do
25
+	for file in `ls $BRANCH`; do
32 26
 		echo "Compiling $file";
33
-		$MSGFMT "$DIR/$file" -o "$MDIR/$BRANCH/`echo wesnoth-$file | sed "s/."$LCODE".po/.mo/" | sed "s/wesnoth-wesnoth/wesnoth/"`"
27
+		$MSGFMT "$BRANCH/$file" -o "$MDIR/$BRANCH/`echo wesnoth-$file | sed "s/."$LCODE".po/.mo/" | sed "s/wesnoth-wesnoth/wesnoth/"`"
34 28
 	done
35 29
 	rm "$MDIR/$BRANCH/wesnoth-manpages.mo" "$MDIR/$BRANCH/wesnoth-manual.mo"
36 30
 done

+ 8
- 23
pack View File

@@ -16,35 +16,19 @@
16 16
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 17
 
18 18
 source "`dirname $0`/variables"
19
-
20
-if [ ! $DIFF ]; then
21
-    echo -e $RED"This program needs the diff utility."$ENDCOLOR
22
-    exit 1
23
-fi
24
-
25
-if [ ! $TAR ]; then
26
-    echo -e $RED"This program needs the tar utility."$ENDCOLOR
27
-    exit 1
28
-fi
29
-
30
-if [ ! $BZIP2 ]; then
31
-    echo -e $RED"This program needs the bzip2 utility."$ENDCOLOR
32
-    exit 1
33
-fi
34
-
35 19
 counter=0
36
-
37
-for BRANCH in $TRUNK $BRANCHES; do
38
-	echo -e "Branch: $BLUE$BRANCH"$ENDCOLOR
39
-	DIR="$PREFIX-$BRANCH"
20
+for BRANCH in $BRANCHES; do
21
+	echo -e "Checking out files from $BLUE$BRANCH"$ENDCOLOR
22
+	$GIT archive --remote $REPO --prefix=$BRANCH-temp/ --format=tar $BRANCH:po | tar x
40 23
 	mkdir "$LCODE-temp"
41
-	for file in `find $DIR -follow -name "*.$LCODE.po"`; do
24
+	counter=0
25
+	for file in `find $BRANCH -follow -name "*.$LCODE.po"`; do
42 26
 		bfile=`basename $file`
43 27
 		echo -n "Processing catalog $bfile... ";
44 28
 		d=`echo "$bfile" | sed "s/.$LCODE.po//"`
45 29
 		dirdomain=`echo wesnoth-$d | sed "s/wesnoth-wesnoth/wesnoth/"`
46
-		if [ -f "$BRANCH/$dirdomain/$LCODE.po" ]; then
47
-			if ! $DIFF -q "$file" "$BRANCH/$dirdomain/$LCODE.po" > /dev/null ; then
30
+		if [ -f "$BRANCH-temp/$dirdomain/$LCODE.po" ]; then
31
+			if ! $DIFF -q "$file" "$BRANCH-temp/$dirdomain/$LCODE.po" > /dev/null ; then
48 32
 				mkdir "$LCODE-temp/$dirdomain"
49 33
 				cp "$file" "$LCODE-temp/$dirdomain/$LCODE.po"
50 34
 				echo -e $GREEN"OK"$ENDCOLOR
@@ -72,6 +56,7 @@ for BRANCH in $TRUNK $BRANCHES; do
72 56
 		$BZIP2 --best $LCODE-$BRANCH.tar
73 57
 		echo "New archive created."
74 58
 	fi
59
+	rm -rf $BRANCH-temp
75 60
 	rmdir $LCODE-temp
76 61
 done
77 62
 

+ 10
- 21
statistics View File

@@ -18,24 +18,13 @@
18 18
 
19 19
 source "`dirname $0`/variables"
20 20
 
21
-LC_NUMERIC="en_US.UTF-8"
21
+LC_ALL=C
22 22
 ODD_CHARS='�'
23 23
 CL=0 # counter for css style
24 24
 STATUS="OK" # Total status of translations
25 25
 
26
-if [ ! $MSGFMT ]; then
27
-	echo -e $RED"This program needs the msgfmt utility."$ENDCOLOR
28
-	exit 1
29
-fi
30
-
31
-if [ ! $ISUTF8 ]; then
32
-	echo -e $RED"This program needs the isutf8 utility."$ENDCOLOR
33
-	exit 1
34
-fi
35
-
36
-for BRANCH in $TRUNK $BRANCHES; do
26
+for BRANCH in $BRANCHES; do
37 27
 	echo -e "Repository: $BLUE$BRANCH"$ENDCOLOR
38
-	DIR="$PREFIX-$BRANCH"
39 28
 	STATSFILE="statistics-$BRANCH.html"
40 29
 	ERRORS="translation-errors-$BRANCH"
41 30
 	nerror=0; nwarn=0; npo=0; nt=0; nu=0; nf=0
@@ -93,15 +82,15 @@ for BRANCH in $TRUNK $BRANCHES; do
93 82
 <td class=\"title\">graph</td>
94 83
 </tr>" >> $STATSFILE
95 84
 
96
-	for file in `ls "$DIR"`; do
85
+	for file in `ls "$BRANCH"`; do
97 86
 		filename=`echo $file | sed s/.po//`
98 87
 		npo=$(($npo + 1)); has_errors="no"; has_warnings="no";
99 88
 	
100 89
 		# Extract the declared charset, may be we use this in future.
101
-		charset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' "$DIR/$file"`
90
+		charset=`sed -n '/^"Content-Type:/ s/.*charset=\([a-zA-Z0-9_-]*\).*/\1/p' "$BRANCH/$file"`
102 91
 	
103 92
 		echo -n "Checking $file for UTF-8 inconsistencies... "
104
-		if $ISUTF8 < "$DIR/$file" > /dev/null 2>&1; then
93
+		if $ISUTF8 < "$BRANCH/$file" > /dev/null 2>&1; then
105 94
 			if ! echo $charset | grep -qi "UTF-8"; then
106 95
 				has_errors="yes"
107 96
 				echo -e $RED"FAILED; non UTF-8 charset declaration for UTF-8 content"$ENDCOLOR
@@ -120,7 +109,7 @@ for BRANCH in $TRUNK $BRANCHES; do
120 109
 		fi
121 110
 	
122 111
 		echo -n "Checking $file for odd characters... "
123
-		if grep -nH $ODD_CHARS "$DIR/$file" >> $ERRORS; then
112
+		if grep -nH $ODD_CHARS "$BRANCH/$file" >> $ERRORS; then
124 113
 			has_warnings="yes"
125 114
 			echo -e $RED"FAILED; odd characters found"$ENDCOLOR
126 115
 			echo "$file: one or more odd character from the '$ODD_CHARS' set found." >> $ERRORS
@@ -131,7 +120,7 @@ for BRANCH in $TRUNK $BRANCHES; do
131 120
 		# Makes sense only if the file passed the UTF-8 check.
132 121
 		if [ "$has_errors" = "no" ]; then
133 122
 			echo -n "Checking $file with msgfmt... "
134
-			if ! LC_MESSAGES=C $MSGFMT --check -o /dev/null "$DIR/$file" >> $ERRORS; then
123
+			if ! LC_MESSAGES=C $MSGFMT --check -o /dev/null "$BRANCH/$file" >> $ERRORS; then
135 124
 				has_errors="yes"
136 125
 				echo -e $RED"FAILED"$ENDCOLOR
137 126
 			else
@@ -150,7 +139,7 @@ for BRANCH in $TRUNK $BRANCHES; do
150 139
 				STATUS="Error"
151 140
 			fi
152 141
 		else
153
-			stat=`LC_MESSAGES=C $MSGFMT --statistics -o /dev/null "$DIR/$file" 2>&1`
142
+			stat=`LC_MESSAGES=C $MSGFMT --statistics -o /dev/null "$BRANCH/$file" 2>&1`
154 143
 			t=`echo "$stat" | sed -ne 's/\([0-9]\+\) translated .*/\1/p'`; t=${t:-0}
155 144
 			u=`echo "$stat" | sed -ne 's/.* \([0-9]\+\) untranslated .*/\1/p'`; u=${u:-0}
156 145
 			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
182 171
 
183 172
 		echo "<tr class=\"row-$CL\">" >> $STATSFILE
184 173
 		CL=$(( ($CL+1)%2 ))
185
-		echo "	<td align=\"left\"><strong><a href=\""$DIR/$filename.po"\">`basename $filename`</a></strong></td>
174
+		echo "	<td align=\"left\"><strong><a href=\""$BRANCH/$filename.po"\">`basename $filename`</a></strong></td>
186 175
 	<td class=\"percentage-$CL\" align=\"center\">$st</td>
187 176
 	<td class=\"row-$CL\" align=\"right\">$t</td>" >> $STATSFILE
188 177
 		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
199 188
 	done
200 189
 	
201 190
 	if [ "$npo" -eq 0 ]; then
202
-		echo -e $RED"No '${PO}.po' file under '$DIR'."$ENDCOLOR
191
+		echo -e $RED"No '${PO}.po' file under '$BRANCH'."$ENDCOLOR
203 192
 		exit 0
204 193
 	fi
205 194
 	

+ 7
- 58
update View File

@@ -17,68 +17,16 @@
17 17
 
18 18
 source "`dirname $0`/variables"
19 19
 
20
-if [ ! $SVN ]; then
21
-	echo -e $RED"This program needs the svn utility."$ENDCOLOR
22
-	exit 1
23
-fi
24
-
25
-if [ ! $MSGFMT ]; then
26
-	echo -e $RED"This program needs the msgfmt utility."$ENDCOLOR
27
-	exit 1
28
-fi
29
-
30
-if [ ! $MSGMERGE ]; then
31
-	echo -e $RED"This program needs the msgmerge utility."$ENDCOLOR
32
-	exit 1
33
-fi
34
-
35
-if [ ! $MSGINIT ]; then
36
-	echo -e $RED"This program needs the msginit utility."$ENDCOLOR
37
-	exit 1
38
-fi
39
-
40 20
 echo -e "Language: $RED$LCODE"$ENDCOLOR
41
-echo ""
42
-
43
-if [ ! -z $TRUNK ]; then
44
-	if [ -e $TRUNK/.svn ]; then
45
-		echo -e "Updating repository: "$BLUE"trunk"
46
-		cd $TRUNK
47
-		$SVN update
48
-		cd ..
49
-	else
50
-		echo -e "Checking out repository: "$BLUE"trunk"
51
-		$SVN checkout "$REPO/$TRUNK/po" $TRUNK
52
-	fi
53
-	echo -e $ENDCOLOR
54
-	if [ ! -e "$PREFIX-$TRUNK" ]; then
55
-		mkdir "$PREFIX-$TRUNK"
56
-	fi
57
-fi
58
-
59 21
 for BRANCH in $BRANCHES; do
60
-  	if [ -e $BRANCH/.svn ]; then
61
-		echo -e "Updating repository: $BLUE$BRANCH"
62
-		cd $BRANCH
63
-		$SVN update
64
-		cd ..
65
-	else
66
-		echo -e "Checking out repository: $BLUE$BRANCH"
67
-		$SVN checkout "$REPO/branches/$BRANCH/po" $BRANCH
68
-	fi
69
-	echo -e $ENDCOLOR
70
-	if [ ! -e "$PREFIX-$BRANCH" ]; then
71
-		mkdir "$PREFIX-$BRANCH"
22
+	echo -e "Checking out files from $BLUE$BRANCH"$ENDCOLOR
23
+	if [ ! -e "$BRANCH" ]; then
24
+		mkdir "$BRANCH"
72 25
 	fi
73
-done
74
-
75
-for BRANCH in $TRUNK $BRANCHES; do
76
-	SVNDIR=$BRANCH
77
-	DIR="$PREFIX-$BRANCH"
78
-	echo -e "Merging: $BLUE$BRANCH"$ENDCOLOR
79
-	for dir in `ls $SVNDIR/wesnoth* -d`; do
26
+	$GIT archive --remote $REPO --prefix="$BRANCH-temp/" --format=tar "$BRANCH:po" | tar x
27
+	for dir in `ls "$BRANCH-temp/wesnoth"* -d`; do
80 28
 		echo "Processing `basename $dir | sed s/wesnoth-//`.$LCODE.po"
81
-		file="$DIR/`basename $dir | sed s/wesnoth-//`.$LCODE.po"
29
+		file="$BRANCH/`basename $dir | sed s/wesnoth-//`.$LCODE.po"
82 30
 		if [ -f $dir"/"$LCODE".po" ]; then
83 31
 			if [ -f "$file" ]; then
84 32
 				echo -e $BLUE"Merging:"$ENDCOLOR
@@ -99,5 +47,6 @@ for BRANCH in $TRUNK $BRANCHES; do
99 47
 		fi
100 48
 		echo ""
101 49
 	done
50
+	rm -rf "$BRANCH-temp"
102 51
 done
103 52
 echo -e $GREEN"Finished."$ENDCOLOR

+ 7
- 9
variables View File

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

+ 0
- 11
wrap View File

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

Loading…
Cancel
Save