/[smeserver]/builds_bin/update_templates
ViewVC logotype

Annotation of /builds_bin/update_templates

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Tue Jul 8 13:58:19 2008 UTC (16 years, 4 months ago) by slords
Branch: MAIN
Updates

1 slords 1.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     export CVS_RSH=ssh
13    
14     # Update/expand smeserver cvs
15     cd /etc/pootle/cvs/smeserver
16     for pkg in */sme7 anaconda/sme8
17     do
18     make -C $pkg clean &> /dev/null
19     done
20     cvs update -dPA > /dev/null
21     for pkg in */sme7 anaconda/sme8
22     do
23     make -C $pkg prep &> /dev/null
24     done
25    
26     # Update/expand smecontribs cvs
27     cd /etc/pootle/cvs/smecontribs
28     for pkg in */contribs7
29     do
30     make -C $pkg clean &> /dev/null
31     done
32     cvs update -dPA > /dev/null
33     for pkg in */contribs7
34     do
35     make -C $pkg prep &> /dev/null
36     done
37    
38     cd /etc/pootle/tmp
39    
40     #==========================================================
41    
42     # Take server down to prevent translation issues
43     killall PootleServer
44    
45     #==========================================================
46    
47     # Update anaconda templates
48     anacondatmpl > anaconda.pot
49     diffmv anaconda.pot /etc/pootle/po/sme7bc/templates/anaconda.pot
50    
51     # Update console templates
52     potempl $(find /etc/pootle/cvs/smeserver/e-smith-quota/ -type f -name adminQuotaSummary.tmpl) > adminQuotaSummary.tmpl.pot
53     diffmv adminQuotaSummary.tmpl.pot /etc/pootle/po/sme7bc/templates/adminQuotaSummary.tmpl.pot
54     potempl $(find /etc/pootle/cvs/smeserver/e-smith-backup/ -type f -name do_backup -o -regex '.*/crontab/backup') > backup.pot
55     diffmv backup.pot /etc/pootle/po/sme7bc/templates/backup.pot
56     potempl $(find /etc/pootle/cvs/smeserver/e-smith-manager/ -type f -name 25Copyright) > foot.tmpl.pot
57     diffmv foot.tmpl.pot /etc/pootle/po/sme7bc/templates/foot.tmpl.pot
58     potempl $(find /etc/pootle/cvs/smeserver/ -type f -regex '.*/e-?smith/console.*') > server-console.pot
59     diffmv server-console.pot /etc/pootle/po/sme7bc/templates/server-console.pot
60     potempl $(find /etc/pootle/cvs/smeserver/e-smith-quota/ -type f -name userOverQuota.tmpl) > userOverQuota.tmpl.pot
61     diffmv userOverQuota.tmpl.pot /etc/pootle/po/sme7bc/templates/userOverQuota.tmpl.pot
62    
63     # Update panel templates
64     for pkg in $(find /etc/pootle/cvs/smeserver/*/*7/*/root/etc/e-smith/locale/en-us/ -type f -print)
65     do
66     xmltempl $pkg "SME Panels"
67     diffcp /etc/pootle/templates/$(basename $pkg).pot /etc/pootle/po/sme7bp/templates/$(basename $pkg).pot
68     done
69    
70     # Update contrib panel templates
71     for pkg in $(find /etc/pootle/cvs/smecontribs/*/*7/*/root/etc/e-smith/locale/en-us/ -type f -print)
72     do
73     xmltempl $pkg "Contrib Panels"
74     diffcp /etc/pootle/templates/$(basename $pkg).pot /etc/pootle/po/sme7cp/templates/$(basename $pkg).pot
75     done
76    
77     #==========================================================
78    
79     # Apply templates to languages
80     for lang in $(ls -I templates /etc/pootle/po/sme* | grep '[[:alpha:]]$' | sort -u)
81     do
82     # Create error compendium to assist translators
83     pocompendium -e errors-$lang.po -d /etc/pootle/po/sme*/$lang
84     sed -i '0,/^$/d' errors-$lang.po
85     chmod 644 errors-$lang.po
86     diffmv errors-$lang.po /var/www/html/errors/errors-$lang.po
87    
88     # Create compendium to assist translations
89     pocompendium -c /etc/pootle/tmp/compendium-$lang.po -d /etc/pootle/po/*/$lang
90    
91     # Use compendium to migrate each project to new template
92     for proj in $(ls -d /etc/pootle/po/sme*/$lang | sed 's@.*/\([^/]\+\)/[^/]\+$@\1@')
93     do
94     mkdir -p /etc/pootle/tmp/$proj/$lang
95     pomigrate2 -F -C=/etc/pootle/tmp/compendium-$lang.po -q --no-wrap --locale=$lang /etc/pootle/po/$proj/$lang /etc/pootle/tmp/$proj/$lang /etc/pootle/po/$proj/templates > /dev/null
96    
97     # Ensure language is correct
98     sed -i "/msgid \"en-us\"/{N;s@msgstr \"[^\"]*\"@msgstr \"$lang\"@}" /etc/pootle/tmp/$proj/$lang/*
99    
100     # Generate translation memory for panels
101     updatetm --progress none -c 4 -i /etc/pootle/tmp/$proj/$lang -t /etc/pootle/tmp/compendium-$lang.po -o /etc/pootle/tmp/$proj/$lang
102     done
103     done
104    
105     # Set package name/version in new po files
106     sed -i 's@Project-Id-Version.*\\n@Project-Id-Version: SME Console\\n@' /etc/pootle/tmp/sme7bc/*/*.po
107     sed -i 's@Project-Id-Version.*\\n@Project-Id-Version: SME Anadonda\\n@' /etc/pootle/tmp/sme7bc/*/anaconda.po
108     sed -i 's@Project-Id-Version.*\\n@Project-Id-Version: SME Panels\\n@' /etc/pootle/tmp/sme7bp/*/*.po
109     sed -i 's@Project-Id-Version.*\\n@Project-Id-Version: Contrib Panels\\n@' /etc/pootle/tmp/sme7cp/*/*.po
110    
111     # Move files that have changed
112     for chk in $(find /etc/pootle/tmp/sme* -type f)
113     do
114     diffmv $chk $(echo $chk | sed 's@/tmp/@/po/@')
115     done
116    
117     #==========================================================
118    
119     # Recalculate stats and restart server
120     cd /etc/pootle
121     PootleServer --refreshstats &> /dev/null
122     nohup PootleServer --servertype threaded >> /var/log/pootle.log 2>&1 &
123    
124     #==========================================================
125    
126     cd /etc/pootle/tmp
127    
128     # Build diffs for languages
129     for lang in $(ls /etc/pootle/po/sme7bp -I templates)
130     do
131     # Build anaconda files
132     mkdir -p /var/www/html/anaconda/sme7/$lang/LC_MESSAGES
133     anacondagen sme7 $lang > /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo
134     [ -s /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme7/$lang
135    
136     mkdir -p /var/www/html/anaconda/sme8/$lang/LC_MESSAGES
137     anacondagen sme8 $lang > /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo
138     [ -s /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme8/$lang
139    
140     # Build console files
141     pkgname=$(ls -d /etc/pootle/cvs/smeserver/smeserver-locale/*7/*/root | cut -d/ -f8)
142     mkdir -p ${pkgname}.update/po/$lang
143     for pkg in $(ls /etc/pootle/po/sme7bc/templates/ -I anaconda.pot | sed 's@\.pot@\.po@')
144     do
145     msgcat -F --no-wrap /etc/pootle/po/sme7bc/$lang/$pkg \
146     | grep -v 'Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \
147     | sed '0,/msgid ""/{/^#/d};/^#,/d' \
148     > ${pkgname}.update/po/$lang/$pkg
149     done
150     done
151    
152     # Build translated xml files
153     for pkg in $(ls /etc/pootle/po/sme7*p/templates/ | sed -n 's@\.pot@@p')
154     do
155     pkgname=$(find /etc/pootle/cvs/smecontribs/*/*7/*/root/etc/e-smith/locale/en-us -name $pkg | cut -d/ -f8)
156     if [ -z "$pkgname" ]
157     then
158     if [ -z "$(find /etc/pootle/cvs/smeserver/*/*7/*/root/etc/e-smith/locale/en-us -name $pkg)" ]
159     then
160     echo -e "\n *** Can't find package for $pkg ***\n"
161     continue
162     fi
163     pkgname=$(ls -d /etc/pootle/cvs/smeserver/smeserver-locale/*7/*/root | cut -d/ -f8)
164     else
165     mkdir -p ${pkgname}.update/$(localedir en-us $pkg)
166     cat /etc/pootle/templates/$pkg.orig \
167     | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
168     > ${pkgname}.update/$(localedir en-us $pkg)/$pkg
169     fi
170     for lang in $(ls /etc/pootle/po/sme7bp -I templates)
171     do
172     mkdir -p ${pkgname}.update/$(localedir $lang $pkg)
173     xmlgen /etc/pootle/po/sme7*p/$lang/${pkg}.po \
174     > ${pkgname}.update/$(localedir $lang $pkg)/$pkg
175     done
176     done
177    
178     # Build xml diffs
179     for pkg in $(ls -d *.update | sed 's@.update$@@')
180     do
181     orig=/etc/pootle/cvs/sme*/*/*7/$pkg/root/etc/e-smith/locale
182     rm /var/www/html/patches/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch
183     diff -ruN $orig $pkg.update/root/etc/e-smith/locale \
184     | sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/root/.*\)@\1 \2@;/^diff -ruN/d' \
185     > /var/www/html/patches/$pkg-locale-$(date +%F).patch
186     done
187    
188     # Build console diffs
189     pkg=$(ls -d smeserver-locale-* | sed 's@.update$@@')
190     orig=/etc/pootle/cvs/smeserver/smeserver-locale/*7/$pkg/po
191     rm /var/www/html/patches/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch
192     diff -ruN $orig $pkg.update/po \
193     | sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/po/.*\)@\1 \2@;/^diff -ruN/d' \
194     >> /var/www/html/patches/$pkg-locale-$(date +%F).patch
195    
196     ## cd /etc/pootle/tmp
197     ##
198     ## # Build diffs for languages
199     ## rm -f /var/www/html/patches/smeserver-locale-all-*.patch /var/www/html/patches/contribs/*
200     ## for lang in $(ls /etc/pootle/po/sme7bp -I templates)
201     ## do
202     ## # Remove previous patches
203     ## rm -f /var/www/html/patches/smeserver-locale-$lang-*.patch
204     ##
205     ## # Build anaconda files
206     ## mkdir -p /var/www/html/anaconda/sme7/$lang/LC_MESSAGES
207     ## anacondagen sme7 $lang > /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo
208     ## [ -s /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme7/$lang
209     ##
210     ## mkdir -p /var/www/html/anaconda/sme8/$lang/LC_MESSAGES
211     ## anacondagen sme8 $lang > /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo
212     ## [ -s /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme8/$lang
213     ##
214     ## # Build console diffs
215     ## mkdir -p pootleupdate/po/$lang
216     ## for pkg in $(ls /etc/pootle/po/sme7bc/templates/ -I anaconda.pot | sed 's@\.pot@\.po@')
217     ## do
218     ## msgcat -F --no-wrap /etc/pootle/po/sme7bc/$lang/$pkg \
219     ## | grep -v 'Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \
220     ## | sed '0,/msgid ""/{/^#/d}' \
221     ## > pootleupdate/po/$lang/$pkg
222     ## if [ -f /etc/pootle/cvs/smeserver/smeserver-locale/*/*/po/$lang/$pkg ]
223     ## then
224     ## diff -u /etc/pootle/cvs/smeserver/smeserver-locale/*/*/po/$lang/$pkg pootleupdate/po/$lang/$pkg \
225     ## | sed 's@/etc/pootle/cvs/smeserver/smeserver-locale/@@' \
226     ## >> /var/www/html/patches/smeserver-locale-$lang-$(date +%F).patch
227     ## else
228     ## diff -u /dev/null pootleupdate/po/$lang/$pkg >> /var/www/html/patches/smeserver-locale-$lang-$(date +%F).patch
229     ## fi
230     ## done
231     ##
232     ## # Build panel diffs
233     ## mkdir -p pootleupdate/{$(localedir $lang general),$(localedir $lang userpassword),$(localedir $lang other)}
234     ## for pkg in $(ls /etc/pootle/po/sme7bp/templates/ | sed 's@\.pot@@')
235     ## do
236     ## match=$(find /etc/pootle/cvs/smeserver/ -type f -regex ".*/e-smith/locale/$lang/.*/$pkg")
237     ## xmlgen /etc/pootle/po/sme7bp/$lang/$pkg.po > pootleupdate/$(localedir $lang $pkg)/$pkg
238     ## diff -u ${match:-/dev/null} pootleupdate/$(localedir $lang $pkg)/$pkg \
239     ## | sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/root/.*\)@\1 \2@' \
240     ## >> /var/www/html/patches/smeserver-locale-$lang-$(date +%F).patch
241     ## done
242     ##
243     ## # Build contrib diffs
244     ## for pkg in $(ls /etc/pootle/po/sme7cp/templates/ | sed 's@\.pot@@')
245     ## do
246     ## match=$(find /etc/pootle/cvs/smecontribs/ -type f -regex ".*/e-smith/locale/$lang/.*/$pkg")
247     ## pkgname=$(find /etc/pootle/cvs/smecontribs/ -type f -regex ".*/e-smith/locale/en-us/.*/$pkg" | sed 's@.*/\([^/]\+\)/root/.*@\1@')
248     ## if [ ! -z "$pkgname" ]
249     ## then
250     ## xmlgen /etc/pootle/po/sme7cp/$lang/$pkg.po > pootleupdate/$(localedir $lang $pkg)/$pkg
251     ## diff -u ${match:-/dev/null} pootleupdate/$(localedir $lang $pkg)/$pkg \
252     ## | sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/root/.*\)@\1 \2@' \
253     ## >> /var/www/html/patches/contribs/$pkgname-locale-$(date +%F).patch
254     ## fi
255     ## done
256     ## done
257     ## cat /var/www/html/patches/smeserver-locale-*-$(date +%F).patch > /var/www/html/patches/smeserver-locale-all-$(date +%F).patch

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed