5 |
|
|
6 |
# Clean up tmp dir |
# Clean up tmp dir |
7 |
rm -rf /var/lib/pootle/tmp |
rm -rf /var/lib/pootle/tmp |
8 |
mkdir -p /var/lib/pootle/tmp/ /var/www/html/{patches,errors,anaconda} |
mkdir -p /var/lib/pootle/tmp/ /var/www/html/pootle/{patches,errors,anaconda} |
9 |
|
|
10 |
#========================================================== |
#========================================================== |
11 |
|
# to help debugging set to 1 and it will help to follow where errors occurs |
12 |
|
debug=0 |
13 |
|
|
14 |
export CVS_RSH=ssh |
export CVS_RSH=ssh |
15 |
|
|
16 |
|
(($debug)) && builtin echo "Update/expand smeserver cvs" |
17 |
# Update/expand smeserver cvs |
# Update/expand smeserver cvs |
18 |
cd /var/lib/pootle/cvs/smeserver |
cd /var/lib/pootle/cvs/smeserver |
19 |
for pkg in *e-smith*/sme* *sme*/sme* anaconda/sme* booty/sme* |
for pkg in *e-smith*/sme* *sme*/sme* anaconda/sme* booty/sme* |
26 |
make -C $pkg prep &> /dev/null |
make -C $pkg prep &> /dev/null |
27 |
done |
done |
28 |
|
|
29 |
|
(($debug)) && builtin echo "Update/expand smecontribs cvs" |
30 |
# Update/expand smecontribs cvs |
# Update/expand smecontribs cvs |
31 |
cd /var/lib/pootle/cvs/smecontribs |
cd /var/lib/pootle/cvs/smecontribs |
32 |
for pkg in *e-smith*/contribs* *sme*/contribs* |
for pkg in *e-smith*/contribs* *sme*/contribs* |
43 |
|
|
44 |
cd /var/lib/pootle/tmp |
cd /var/lib/pootle/tmp |
45 |
|
|
46 |
for ver in sme7 sme8 |
# Sync database stores to filesystem |
47 |
|
django-admin sync_stores --settings=pootle.settings &> /dev/null |
48 |
|
|
49 |
|
for ver in sme9 sme10 |
50 |
do |
do |
51 |
|
(($debug)) && echo&& echo builtin echo "anaconda $ver" # debug jpp |
52 |
# Update anaconda template |
# Update anaconda template |
53 |
anacondatmpl $ver > anaconda.pot |
anacondatmpl $ver > anaconda.pot |
54 |
diffmv anaconda.pot /var/lib/pootle/po/$ver/templates/anaconda.pot |
diffmv anaconda.pot /var/lib/pootle/po/$ver/templates/anaconda.pot |
55 |
|
|
56 |
|
(($debug)) && echo&& echo builtin echo "console template $ver " |
57 |
# Update console templates |
# Update console templates |
58 |
potempl $(find /var/lib/pootle/cvs/smeserver/e-smith-quota/$ver/ -type f -name adminQuotaSummary.tmpl) > adminQuotaSummary.tmpl.pot |
potempl $(find /var/lib/pootle/cvs/smeserver/e-smith-quota/$ver/ -type f -name adminQuotaSummary.tmpl) > adminQuotaSummary.tmpl.pot |
59 |
diffmv adminQuotaSummary.tmpl.pot /var/lib/pootle/po/$ver/templates/adminQuotaSummary.tmpl.pot |
diffmv adminQuotaSummary.tmpl.pot /var/lib/pootle/po/$ver/templates/adminQuotaSummary.tmpl.pot |
66 |
potempl $(find /var/lib/pootle/cvs/smeserver/e-smith-quota/$ver/ -type f -name userOverQuota.tmpl) > userOverQuota.tmpl.pot |
potempl $(find /var/lib/pootle/cvs/smeserver/e-smith-quota/$ver/ -type f -name userOverQuota.tmpl) > userOverQuota.tmpl.pot |
67 |
diffmv userOverQuota.tmpl.pot /var/lib/pootle/po/$ver/templates/userOverQuota.tmpl.pot |
diffmv userOverQuota.tmpl.pot /var/lib/pootle/po/$ver/templates/userOverQuota.tmpl.pot |
68 |
|
|
69 |
|
(($debug)) && echo&& echo builtin echo "panel template $ver " |
70 |
# Update panel templates |
# Update panel templates |
71 |
for pkg in $(find /var/lib/pootle/cvs/smeserver/*/$ver/*/root/etc/e-smith/locale/en-us/ -type f -not -regex '.*\+ldap/.*' 2> /dev/null) |
for pkg in $(find /var/lib/pootle/cvs/smeserver/*/$ver/*/root/etc/e-smith/locale/en-us/ -type f -not -regex '.*\+ldap/.*' 2> /dev/null) |
72 |
do |
do |
75 |
done |
done |
76 |
done |
done |
77 |
|
|
78 |
for ver in contribs7 contribs8 |
for ver in contribs9 |
79 |
do |
do |
80 |
if [ "$ver" == "contribs7" ] |
nver=$(echo $ver| tr -dc '0-9') |
81 |
|
if [ "$nver" -ge "9" ] |
82 |
then |
then |
83 |
# Update sme7admin template |
(($debug)) && echo&& echo builtin echo "sme*admin template $ver " |
84 |
potempl /var/lib/pootle/cvs/smecontribs/smeserver-sme7admin/$ver/*/root/{etc/e-smith/web/functions/sme7admin,usr/bin/sme7admind} > sme7admin.pot |
# Update sme*admin template |
85 |
diffmv sme7admin.pot /var/lib/pootle/po/$ver/templates/sme7admin.pot |
#echo "smeserver-sme${nver}admin" |
86 |
|
potempl /var/lib/pootle/cvs/smecontribs/smeserver-sme${nver}admin/$ver/*/root/{etc/e-smith/web/functions/sme${nver}admin,usr/bin/sme${nver}admind} > sme${nver}admin.pot |
87 |
|
diffmv sme${nver}admin.pot /var/lib/pootle/po/$ver/templates/sme${nver}admin.pot |
88 |
fi |
fi |
89 |
|
|
90 |
|
(($debug)) && echo&& echo builtin echo "contribs others template $ver" |
91 |
# Update contrib panel templates |
# Update contrib panel templates |
92 |
for pkg in $(find /var/lib/pootle/cvs/smecontribs/*/$ver/*/root/etc/e-smith/locale/en-us/ -type f 2> /dev/null) |
for pkg in $(find /var/lib/pootle/cvs/smecontribs/*/$ver/*/root/etc/e-smith/locale/en-us/ -type f 2> /dev/null) |
93 |
do |
do |
102 |
rsync -amR --include '*/' --include '*.po' --exclude '*' /var/lib/pootle/po/./{sme,contribs}[0-9]/ /var/lib/pootle/tmp/errors/ |
rsync -amR --include '*/' --include '*.po' --exclude '*' /var/lib/pootle/po/./{sme,contribs}[0-9]/ /var/lib/pootle/tmp/errors/ |
103 |
find /var/lib/pootle/tmp/errors/ -type f -exec sed -i '/^#~/d' {} \+ |
find /var/lib/pootle/tmp/errors/ -type f -exec sed -i '/^#~/d' {} \+ |
104 |
|
|
105 |
|
(($debug)) && echo&& echo builtin echo "Apply templates to languages" |
106 |
# Apply templates to languages |
# Apply templates to languages |
107 |
for lang in $(ls -I templates /var/lib/pootle/po/{sme,contribs}[0-9] 2> /dev/null | grep '[[:alpha:]]$' | sort -u) |
for lang in $(ls -I templates /var/lib/pootle/po/{sme,contribs}[0-9] 2> /dev/null | grep '[[:alpha:]]$' | sort -u) |
108 |
do |
do |
135 |
done |
done |
136 |
done |
done |
137 |
|
|
138 |
|
(($debug)) && echo&& echo builtin echo "Copy po files so we can create error reports" |
139 |
# Copy po files so we can create error reports |
# Copy po files so we can create error reports |
140 |
rsync -amR --include '*/' --include '*.po' --exclude '*' /var/lib/pootle/po/./{sme,contribs}[0-9]/ /var/lib/pootle/tmp/errors/ |
rsync -amR --include '*/' --include '*.po' --exclude '*' /var/lib/pootle/po/./{sme,contribs}[0-9]/ /var/lib/pootle/tmp/errors/ |
141 |
|
|
142 |
#========================================================== |
#========================================================== |
143 |
|
|
144 |
|
(($debug)) && echo&& echo builtin echo "Sync filesystem to database stores" |
145 |
|
# Sync filesystem to database stores |
146 |
|
django-admin update_stores --settings=pootle.settings &> /dev/null |
147 |
|
|
148 |
|
(($debug)) && echo&& echo builtin echo "Recalculate stats and restart server" |
149 |
# Recalculate stats and restart server |
# Recalculate stats and restart server |
150 |
/usr/sbin/PootleServer --refreshstats &> /dev/null |
django-admin refresh_stats --settings=pootle.settings &> /dev/null |
151 |
|
|
152 |
#========================================================== |
#========================================================== |
153 |
|
|
154 |
|
(($debug)) && echo&& echo builtin echo "Create error compendium to assist translators" |
155 |
# Create error compendium to assist translators |
# Create error compendium to assist translators |
156 |
find /var/lib/pootle/tmp/errors/ -type f -exec sed -i '/^#~/d' {} \+ |
find /var/lib/pootle/tmp/errors/ -type f -exec sed -i '/^#~/d' {} \+ |
157 |
for lang in $(ls -I templates /var/lib/pootle/po/{sme,contribs}[0-9] 2> /dev/null | grep '[[:alpha:]]$' | sort -u) |
for lang in $(ls -I templates /var/lib/pootle/po/{sme,contribs}[0-9] 2> /dev/null | grep '[[:alpha:]]$' | sort -u) |
160 |
| msgattrib --only-fuzzy \ |
| msgattrib --only-fuzzy \ |
161 |
| sed '0,/^$/d;/^#~/d' \ |
| sed '0,/^$/d;/^#~/d' \ |
162 |
| sed ':a;/^\n*$/{$d;N;ba;}' \ |
| sed ':a;/^\n*$/{$d;N;ba;}' \ |
163 |
> errors-$lang.po |
> errors-$lang.err |
164 |
chmod 644 errors-$lang.po |
chmod 644 errors-$lang.err |
165 |
diffmv errors-$lang.po /var/www/html/errors/errors-$lang.po |
diffmv errors-$lang.err /var/www/html/pootle/errors/errors-$lang.err |
166 |
done |
done |
167 |
|
|
168 |
|
(($debug)) && echo&& echo builtin echo "Build diffs for languages" |
169 |
# Build diffs for languages |
# Build diffs for languages |
170 |
for pkg in $(ls /var/lib/pootle/po/{sme,contribs}[0-9]/templates/ | sed -n 's@\.pot@@p' | sort -u) |
for pkg in $(ls /var/lib/pootle/po/{sme,contribs}[0-9]/templates/ | sed -n 's@\.pot@@p' | sort -u) |
171 |
do |
do |
176 |
then |
then |
177 |
ls /var/lib/pootle/po/*/*/$pkg.po | cut -d/ --output-delimiter " " -f6,7 | while read ver lang |
ls /var/lib/pootle/po/*/*/$pkg.po | cut -d/ --output-delimiter " " -f6,7 | while read ver lang |
178 |
do |
do |
179 |
mkdir -p /var/www/html/anaconda/$ver/$lang/LC_MESSAGES |
[[ $ver == *7 ]] && continue |
180 |
anacondagen $ver $lang > /var/www/html/anaconda/$ver/$lang/LC_MESSAGES/anaconda.mo |
[[ $ver == *8 ]] && continue |
181 |
[ -s /var/www/html/anaconda/$ver/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/$ver/$lang |
|
182 |
|
(($debug)) && echo&& echo builtin echo "anaconda $ver $lang " |
183 |
|
mkdir -p /var/www/html/pootle/anaconda/$ver/$lang/LC_MESSAGES |
184 |
|
anacondagen $ver $lang > /var/www/html/pootle/anaconda/$ver/$lang/LC_MESSAGES/anaconda.mo |
185 |
|
[ -s /var/www/html/pootle/anaconda/$ver/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/pootle/anaconda/$ver/$lang |
186 |
done |
done |
187 |
else |
else |
188 |
pkgs=$(ls -d /var/lib/pootle/cvs/*/smeserver-$pkg/*/*/root 2> /dev/null) |
pkgs=$(ls -d /var/lib/pootle/cvs/*/smeserver-$pkg/*/*/root 2> /dev/null) |
190 |
|
|
191 |
echo "$pkgs" | cut -d/ --output-delimiter " " -f8,9 | while read ver pkgname |
echo "$pkgs" | cut -d/ --output-delimiter " " -f8,9 | while read ver pkgname |
192 |
do |
do |
193 |
|
[[ $ver == *7 ]] && continue |
194 |
|
[[ $ver == *8 ]] && continue |
195 |
|
|
196 |
|
(($debug)) && echo&& echo builtin echo "$pkg $ver" |
197 |
for lang in $(ls -I templates /var/lib/pootle/po/$ver/ 2> /dev/null | grep '[[:alpha:]]$' | sort -u) |
for lang in $(ls -I templates /var/lib/pootle/po/$ver/ 2> /dev/null | grep '[[:alpha:]]$' | sort -u) |
198 |
do |
do |
199 |
mkdir -p diff/$ver/${pkgname}.update/po/$lang |
(($debug)) && echo&& echo builtin echo "* $pkg $lang " |
200 |
msgcat -F --no-wrap /var/lib/pootle/po/$ver/$lang/${pkg}.po \ |
if [ -f "/var/lib/pootle/po/$ver/$lang/${pkg}.po" ] |
201 |
| grep -v 'Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \ |
then |
202 |
| sed '0,/msgid ""/{/^#/d};/^#,/d;s@^\(#: \)[^/]\+/root@\1root@' \ |
mkdir -p diff/$ver/${pkgname}.update/po/$lang |
203 |
> diff/$ver/${pkgname}.update/po/$lang/${pkg/backup-console/backup}.po |
msgcat -F --no-wrap /var/lib/pootle/po/$ver/$lang/${pkg}.po \ |
204 |
|
| grep -v 'Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \ |
205 |
|
| sed '0,/msgid ""/{/^#/d};/^#,/d;s@^\(#: \)[^/]\+/root@\1root@' \ |
206 |
|
> diff/$ver/${pkgname}.update/po/$lang/${pkg/backup-console/backup}.po |
207 |
|
fi |
208 |
done |
done |
209 |
done |
done |
210 |
fi |
fi |
212 |
echo "$pkgs" | grep -qv '/contribs[0-9]/' && pkgs=$(echo "$pkgs" | grep '/contribs[0-9]/'; ls -d /var/lib/pootle/cvs/*/smeserver-locale/*/*/root) |
echo "$pkgs" | grep -qv '/contribs[0-9]/' && pkgs=$(echo "$pkgs" | grep '/contribs[0-9]/'; ls -d /var/lib/pootle/cvs/*/smeserver-locale/*/*/root) |
213 |
echo "$pkgs" | cut -d/ --output-delimiter " " -f8,9 | while read ver pkgname |
echo "$pkgs" | cut -d/ --output-delimiter " " -f8,9 | while read ver pkgname |
214 |
do |
do |
215 |
if echo $ver | grep -q contribs |
[[ $ver == *7 ]] && continue |
216 |
|
[[ $ver == *8 ]] && continue |
217 |
|
|
218 |
|
if [[ $ver == contribs* ]] |
219 |
then |
then |
220 |
mkdir -p diff/$ver/${pkgname}.update/$(localedir en-us $pkg) |
if [ -f /var/lib/pootle/templates/$ver/$pkg.orig ] |
221 |
cat /var/lib/pootle/templates/$ver/$pkg.orig \ |
then |
222 |
| perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \ |
(($debug)) && echo&& echo builtin echo "$pkg update $ver" |
223 |
> diff/$ver/${pkgname}.update/$(localedir en-us $pkg)/$pkg |
mkdir -p diff/$ver/${pkgname}.update/$(localedir en-us $pkg) |
224 |
|
cat /var/lib/pootle/templates/$ver/$pkg.orig \ |
225 |
|
| perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \ |
226 |
|
> diff/$ver/${pkgname}.update/$(localedir en-us $pkg)/$pkg |
227 |
|
fi |
228 |
fi |
fi |
229 |
for lang in $(ls -I templates /var/lib/pootle/po/$ver/ 2> /dev/null | grep '[[:alpha:]]$' | sort -u) |
for lang in $(ls -I templates /var/lib/pootle/po/$ver/ 2> /dev/null | grep '[[:alpha:]]$' | sort -u) |
230 |
do |
do |
231 |
|
(($debug)) && echo&& echo builtin echo "* $pkg $lang " |
232 |
mkdir -p diff/$ver/${pkgname}.update/$(localedir $lang $pkg) |
mkdir -p diff/$ver/${pkgname}.update/$(localedir $lang $pkg) |
233 |
xmlgen $ver /var/lib/pootle/po/$ver/$lang/${pkg}.po \ |
xmlgen $ver /var/lib/pootle/po/$ver/$lang/${pkg}.po \ |
234 |
> diff/$ver/${pkgname}.update/$(localedir $lang $pkg)/$pkg |
> diff/$ver/${pkgname}.update/$(localedir $lang $pkg)/$pkg |
237 |
fi |
fi |
238 |
done |
done |
239 |
|
|
240 |
|
(($debug)) && echo&& echo builtin echo "Build patches" |
241 |
# Build diffs |
# Build diffs |
242 |
ls -d diff/*/* | sed 's@.update$@@' | cut -d/ --output-delimiter " " -f2,3 | while read ver pkg |
ls -d diff/*/* | sed 's@.update$@@' | cut -d/ --output-delimiter " " -f2,3 | while read ver pkg |
243 |
do |
do |
244 |
mkdir -p /var/www/html/patches/$ver |
mkdir -p /var/www/html/pootle/patches/$ver |
245 |
rm -f /var/www/html/patches/$ver/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch |
rm -f /var/www/html/pootle/patches/$ver/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch |
246 |
if [ -d "diff/$ver/$pkg.update/root" ] |
if [ -d "diff/$ver/$pkg.update/root" ] |
247 |
then |
then |
248 |
diff -ruN {/var/lib/pootle/cvs/*/*/$ver/$pkg,diff/$ver/$pkg.update}/root/etc/e-smith/locale \ |
diff -ruN {/var/lib/pootle/cvs/*/*/$ver/$pkg,diff/$ver/$pkg.update}/root/etc/e-smith/locale \ |
249 |
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/root/.*\)@\1 \2@;/^diff -ruN/d' \ |
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/root/.*\)@\1 \2@;/^diff -ruN/d' \ |
250 |
>> /var/www/html/patches/$ver/$pkg-locale-$(date +%F).patch |
>> /var/www/html/pootle/patches/$ver/$pkg-locale-$(date +%F).patch |
251 |
fi |
fi |
252 |
if [ -d "diff/$ver/$pkg.update/po" ] |
if [ -d "diff/$ver/$pkg.update/po" ] |
253 |
then |
then |
254 |
diff -ruN {/var/lib/pootle/cvs/*/*/$ver/$pkg,diff/$ver/$pkg.update}/po \ |
diff -ruN {/var/lib/pootle/cvs/*/*/$ver/$pkg,diff/$ver/$pkg.update}/po \ |
255 |
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/po/.*\)@\1 \2@;/^diff -ruN/d' \ |
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/po/.*\)@\1 \2@;/^diff -ruN/d' \ |
256 |
>> /var/www/html/patches/$ver/$pkg-locale-$(date +%F).patch |
>> /var/www/html/pootle/patches/$ver/$pkg-locale-$(date +%F).patch |
257 |
fi |
fi |
258 |
done |
done |
259 |
|
|