1 |
#!/bin/bash |
2 |
|
3 |
# Functions |
4 |
. /etc/pootle/bin/functions |
5 |
|
6 |
# Clean up tmp dir |
7 |
rm -rf /etc/pootle/tmp |
8 |
mkdir -p /etc/pootle/tmp /var/www/html/{patches,errors,anaconda} |
9 |
|
10 |
#========================================================== |
11 |
|
12 |
cd /etc/pootle/tmp |
13 |
|
14 |
# Build diffs for languages |
15 |
for lang in $(ls /etc/pootle/po/sme7bp -I templates) |
16 |
do |
17 |
# Build anaconda files |
18 |
mkdir -p /var/www/html/anaconda/sme7/$lang/LC_MESSAGES |
19 |
anacondagen sme7 $lang > /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo |
20 |
[ -s /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme7/$lang |
21 |
|
22 |
mkdir -p /var/www/html/anaconda/sme8/$lang/LC_MESSAGES |
23 |
anacondagen sme8 $lang > /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo |
24 |
[ -s /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme8/$lang |
25 |
|
26 |
# Build console files |
27 |
pkgname=$(ls -d /etc/pootle/cvs/smeserver/smeserver-locale/*7/*/root | cut -d/ -f8) |
28 |
mkdir -p ${pkgname}.update/po/$lang |
29 |
for pkg in $(ls /etc/pootle/po/sme7bc/templates/ -I anaconda.pot | sed -n 's@\.pot@\.po@p') |
30 |
do |
31 |
msgcat -F --no-wrap /etc/pootle/po/sme7bc/$lang/$pkg \ |
32 |
| grep -v 'Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \ |
33 |
| sed '0,/msgid ""/{/^#/d};/^#,/d' \ |
34 |
> ${pkgname}.update/po/$lang/$pkg |
35 |
done |
36 |
|
37 |
# Build sme7admin file |
38 |
pkgname=$(ls -d /etc/pootle/cvs/smecontribs/smeserver-sme7admin/*7/*/root | cut -d/ -f8) |
39 |
mkdir -p ${pkgname}.update/po/$lang |
40 |
msgcat -F --no-wrap /etc/pootle/po/sme7cp/$lang/sme7admin.po \ |
41 |
| grep -v 'Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \ |
42 |
| sed '0,/msgid ""/{/^#/d};/^#,/d' \ |
43 |
> ${pkgname}.update/po/$lang/sme7admin.po |
44 |
done |
45 |
|
46 |
# Build translated xml files |
47 |
for pkg in $(ls /etc/pootle/po/sme7*p/templates/ -I sme7admin.pot | sed -n 's@\.pot@@p') |
48 |
do |
49 |
pkgname=$(find /etc/pootle/cvs/smecontribs/*/*7/*/root/etc/e-smith/locale/en-us -name $pkg | cut -d/ -f8) |
50 |
if [ -z "$pkgname" ] |
51 |
then |
52 |
if [ -z "$(find /etc/pootle/cvs/smeserver/*/*7/*/root/etc/e-smith/locale/en-us -name $pkg)" ] |
53 |
then |
54 |
echo -e "\n *** Can't find package for $pkg ***\n" |
55 |
continue |
56 |
fi |
57 |
pkgname=$(ls -d /etc/pootle/cvs/smeserver/smeserver-locale/*7/*/root | cut -d/ -f8) |
58 |
else |
59 |
mkdir -p ${pkgname}.update/$(localedir en-us $pkg) |
60 |
cat /etc/pootle/templates/$pkg.orig \ |
61 |
| perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \ |
62 |
> ${pkgname}.update/$(localedir en-us $pkg)/$pkg |
63 |
fi |
64 |
for lang in $(ls /etc/pootle/po/sme7bp -I templates) |
65 |
do |
66 |
mkdir -p ${pkgname}.update/$(localedir $lang $pkg) |
67 |
xmlgen /etc/pootle/po/sme7*p/$lang/${pkg}.po \ |
68 |
> ${pkgname}.update/$(localedir $lang $pkg)/$pkg |
69 |
done |
70 |
done |
71 |
|
72 |
# Build xml diffs |
73 |
for pkg in $(ls -d *.update | sed 's@.update$@@') |
74 |
do |
75 |
rm -f /var/www/html/patches/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch |
76 |
[ -d $pkg.update/root/etc/e-smith/locale ] || continue |
77 |
orig=/etc/pootle/cvs/sme*/*/*7/$pkg/root/etc/e-smith/locale |
78 |
diff -ruN $orig $pkg.update/root/etc/e-smith/locale \ |
79 |
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/root/.*\)@\1 \2@;/^diff -ruN/d' \ |
80 |
> /var/www/html/patches/$pkg-locale-$(date +%F).patch |
81 |
done |
82 |
|
83 |
# Build console diffs |
84 |
pkg=$(ls -d smeserver-locale-* | sed 's@.update$@@') |
85 |
orig=/etc/pootle/cvs/smeserver/smeserver-locale/*7/$pkg/po |
86 |
diff -ruN $orig $pkg.update/po \ |
87 |
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/po/.*\)@\1 \2@;/^diff -ruN/d' \ |
88 |
>> /var/www/html/patches/$pkg-locale-$(date +%F).patch |
89 |
|
90 |
# Build sme7admin diff |
91 |
pkg=$(ls -d smeserver-sme7admin-* | sed 's@.update$@@') |
92 |
orig=/etc/pootle/cvs/smecontribs/smeserver-sme7admin/*7/$pkg/po |
93 |
diff -ruN $orig $pkg.update/po \ |
94 |
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/po/.*\)@\1 \2@;/^diff -ruN/d' \ |
95 |
>> /var/www/html/patches/$pkg-locale-$(date +%F).patch |
96 |
|