1 |
slords |
1.1 |
#!/bin/bash |
2 |
|
|
|
3 |
|
|
# Functions |
4 |
slords |
1.8 |
. /var/lib/pootle/bin/functions |
5 |
slords |
1.1 |
|
6 |
slords |
1.3 |
# Clean up tmp dir |
7 |
slords |
1.8 |
rm -rf /var/lib/pootle/tmp |
8 |
jpp |
1.10 |
mkdir -p /var/lib/pootle/tmp/ /var/www/html/{patches,errors,anaconda} |
9 |
slords |
1.3 |
|
10 |
slords |
1.1 |
#========================================================== |
11 |
|
|
|
12 |
slords |
1.8 |
cd /var/lib/pootle/tmp |
13 |
slords |
1.1 |
|
14 |
|
|
# Build diffs for languages |
15 |
slords |
1.8 |
for pkg in $(ls /var/lib/pootle/po/{sme,contribs}[0-9]/templates/ | sed -n 's@\.pot@@p' | sort -u) |
16 |
slords |
1.1 |
do |
17 |
slords |
1.8 |
pkgs=$(find /var/lib/pootle/cvs/*/*/*/*/root/etc/e-smith/locale/en-us -name $pkg -not -regex '.*\+ldap/.*') |
18 |
|
|
if [ -z "$pkgs" ] |
19 |
slords |
1.1 |
then |
20 |
slords |
1.8 |
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 |
jpp |
1.10 |
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 |
slords |
1.8 |
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 |
slords |
1.1 |
else |
45 |
slords |
1.8 |
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 |
slords |
1.1 |
fi |
63 |
|
|
done |
64 |
|
|
|
65 |
slords |
1.8 |
# Build diffs |
66 |
|
|
ls -d diff/*/* | sed 's@.update$@@' | cut -d/ --output-delimiter " " -f2,3 | while read ver pkg |
67 |
slords |
1.1 |
do |
68 |
jpp |
1.10 |
mkdir -p /var/www/html/patches/$ver |
69 |
|
|
rm -f /var/www/html/patches/$ver/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch |
70 |
slords |
1.8 |
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 |
jpp |
1.10 |
>> /var/www/html/patches/$ver/$pkg-locale-$(date +%F).patch |
75 |
slords |
1.8 |
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 |
jpp |
1.10 |
>> /var/www/html/patches/$ver/$pkg-locale-$(date +%F).patch |
81 |
slords |
1.8 |
fi |
82 |
slords |
1.1 |
done |
83 |
|
|
|