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