1 |
#!/usr/bash |
#!/usr/bash |
2 |
|
|
3 |
|
strippo() { |
4 |
|
msgcat --sort-by-file --width 80 --to-code UTF-8 $1 \ |
5 |
|
| sed '/^"\(Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language\|Language-Team\|X-Generator\):/d;0,/^msgid/{/^#/d}' |
6 |
|
} |
7 |
|
|
8 |
|
podiff() { |
9 |
|
src=$1 |
10 |
|
dst=${2:-$(echo $1 | sed 's,/tmp/,/po/,')} |
11 |
|
|
12 |
|
if [ "${src%%.pot}" != "$src" -o "${src%%.po}" != "$src" ] |
13 |
|
then |
14 |
|
diff --unified --label "$src" <(strippo $src) --label "$dst" <(strippo $dst) |
15 |
|
elif [ "${src%%.tm}" != "$src" ] |
16 |
|
then |
17 |
|
diff --brief $src $dst > /dev/null |
18 |
|
else |
19 |
|
diff --unified $src $dst |
20 |
|
fi |
21 |
|
} |
22 |
|
|
23 |
diffmv() { |
diffmv() { |
24 |
if [ ! -z "$1" -a ! -z "$2" ] |
if [ ! -z "$1" -a ! -z "$2" ] |
25 |
then |
then |
26 |
if [ -f "$2" ] |
if [ -f "$2" ] |
27 |
then |
then |
28 |
if [ "${1%%.tm}" == "$1" ] |
if podiff "$2" "$1" |
29 |
then |
then |
30 |
if diff -u "$2" "$1" |
/bin/rm -f "$1" |
|
then |
|
|
/bin/rm -f "$1" |
|
|
else |
|
|
/bin/mv -f "$1" "$2" |
|
|
fi |
|
31 |
else |
else |
32 |
if diff -q "$2" "$1" > /dev/null |
/bin/mv -f "$1" "$2" |
|
then |
|
|
/bin/rm -f "$1" |
|
|
else |
|
|
/bin/mv -f "$1" "$2" |
|
|
fi |
|
33 |
fi |
fi |
34 |
else |
else |
35 |
/bin/mv -f "$1" "$2" |
/bin/mv -f "$1" "$2" |
42 |
then |
then |
43 |
if [ -f "$2" ] |
if [ -f "$2" ] |
44 |
then |
then |
45 |
if [ "${1%%.tm}" == "$1" ] |
if ! podiff "$2" "$1" |
46 |
then |
then |
47 |
if ! diff -u "$2" "$1" |
/bin/cp -a "$1" "$2" |
|
then |
|
|
/bin/cp -a "$1" "$2" |
|
|
fi |
|
|
else |
|
|
if ! diff -q "$2" "$1" > /dev/null |
|
|
then |
|
|
/bin/cp -a "$1" "$2" |
|
|
fi |
|
48 |
fi |
fi |
49 |
else |
else |
50 |
/bin/cp -a "$1" "$2" |
/bin/cp -a "$1" "$2" |
83 |
} |
} |
84 |
|
|
85 |
anacondatmpl() { |
anacondatmpl() { |
86 |
|
content="" |
87 |
|
if [[ "$1" == "sme8" ]];then |
88 |
|
content="/var/lib/pootle/cvs/smeserver/cdrom.image/$1/updates/*.py /var/lib/pootle/cvs/smeserver/cdrom.image/$1/*/installclasses/*.py" |
89 |
|
fi |
90 |
xgettext -L python \ |
xgettext -L python \ |
91 |
-k=_ \ |
-k=_ \ |
92 |
-k=N_ \ |
-k=N_ \ |
93 |
-o - \ |
-o - \ |
94 |
$(sed -n "/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/var/lib/pootle/cvs/smeserver/\2/$1/\2-*\3/\1@p" \ |
$(sed -n "/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/var/lib/pootle/cvs/smeserver/\2/$1/\2-*\3/\1@p" \ |
95 |
/var/lib/pootle/cvs/smeserver/cdrom.image/$1/updates/README.txt) \ |
/var/lib/pootle/cvs/smeserver/cdrom.image/$1/updates/README.txt) \ |
96 |
/var/lib/pootle/cvs/smeserver/cdrom.image/$1/updates/*.py \ |
$content \ |
97 |
/var/lib/pootle/cvs/smeserver/cdrom.image/$1/*/installclasses/*.py \ |
2> /dev/null \ |
98 |
| sed 's@charset=CHARSET@charset=UTF-8@;s@Id-Version.*\\n@Id-Version: SME Template\\n@' \ |
| sed 's@charset=CHARSET@charset=UTF-8@;s@Id-Version.*\\n@Id-Version: SME Template\\n@' \ |
99 |
| sed 's@/var/lib/pootle/cvs/smeserver/[^/]\+/@@' \ |
| sed 's@/var/lib/pootle/cvs/smeserver/[^/]\+/@@' \ |
100 |
| msgcat -u \ |
| msgcat -u \ |