/[smeserver]/builds_bin/functions
ViewVC logotype

Contents of /builds_bin/functions

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


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

1 #!/usr/bash
2
3 diffmv() {
4 if [ ! -z "$1" -a ! -z "$2" ]
5 then
6 if [ "${1%%.tm}" == "$1" ]
7 then
8 if diff -u "$2" "$1"
9 then
10 /bin/rm -f "$1"
11 else
12 /bin/mv -f "$1" "$2"
13 fi
14 else
15 if diff -q "$2" "$1" > /dev/null
16 then
17 /bin/rm -f "$1"
18 else
19 /bin/mv -f "$1" "$2"
20 fi
21 fi
22 fi
23 }
24
25 diffcp() {
26 if [ ! -z "$1" -a ! -z "$2" ]
27 then
28 if [ "${1%%.tm}" == "$1" ]
29 then
30 if ! diff -u "$2" "$1"
31 then
32 /bin/cp -a "$1" "$2"
33 fi
34 else
35 if ! diff -q "$2" "$1" > /dev/null
36 then
37 /bin/cp -a "$1" "$2"
38 fi
39 fi
40 fi
41 }
42
43 potempl() {
44 xgettext -L perl -o - $@ \
45 | sed 's@charset=CHARSET@charset=UTF-8@;s@[^ ]*/root/@root/@g;s@Project-Id-Version.*\\n@Project-Id-Version: SME Console\\n@' \
46 | sed '/Report-Msgid-Bugs-To/d;/POT-Creation-Date/d;/PO-Revision-Date/d;/Language-Team/d;/X-Generator/d;0,/^msgid/{/^#/d}' \
47 | msgcat -F -t UTF-8 -
48 }
49
50 xmltempl() {
51 mkdir -p /etc/pootle/tmp/templates /etc/pootle/templates
52
53 root=$(echo $1 | sed 's@.*/root/@root/@')
54 cat $1 \
55 | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g;s@_{_(/?(?:lexicon|entry|base|trans).*?)_}_@<$1>@g' \
56 | sed '/<\\\?lexicon/p;0,/<lexicon/d;/<\\lexicon/,$d' \
57 | tee /etc/pootle/tmp/templates/$(basename $1).orig \
58 | xml2po -m sme -e -o - - \
59 | sed "/(lexicon)/{N;N;N;d};s@-\(:[0-9]\+([^)]\+)\)@$root\1@g" \
60 | tee >(cat - | sed '/^msgid/{p;s@msgid@msgstr@p;N;d}' \
61 | xml2po -m sme -p - /etc/pootle/tmp/templates/$(basename $1).orig \
62 > /etc/pootle/tmp/templates/$(basename $1) ) \
63 | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
64 | msgcat -F -t UTF-8 - \
65 | sed "/^\"POT-Creation-Date:/d;s@Project-Id-Version.*\\\n@Project-Id-Version: $2\\\n@" \
66 > /etc/pootle/tmp/templates/$(basename $1).pot
67 diffmv /etc/pootle/tmp/templates/$(basename $1).orig /etc/pootle/templates/$(basename $1).orig
68 diffmv /etc/pootle/tmp/templates/$(basename $1) /etc/pootle/templates/$(basename $1)
69 diffmv /etc/pootle/tmp/templates/$(basename $1).pot /etc/pootle/templates/$(basename $1).pot
70 }
71
72 anacondatmpl() {
73 xgettext -L python \
74 -k=_ \
75 -k=N_ \
76 -o - \
77 $(sed -n '/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/etc/pootle/cvs/smeserver/\2/sme7/\2-*\3/\1@p' \
78 /etc/pootle/cvs/smeserver/cdrom.image/updates/README.txt) \
79 /etc/pootle/cvs/smeserver/cdrom.image/updates/*.py \
80 /etc/pootle/cvs/smeserver/cdrom.image/product/installclasses/*.py \
81 | sed 's@charset=CHARSET@charset=UTF-8@;s@[^ ]*/sme7/[^:]\+/\([^:]\+\):@updates/\1:@g;s@[^ ]*/cdrom.image/@@g;' \
82 | sed 's@Project-Id-Version.*\\n@Project-Id-Version: SME Anaconda\\n@' \
83 | msgcat -u \
84 --use-first \
85 - \
86 <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \
87 <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \
88 | sed '/Report-Msgid-Bugs-To/d;/POT-Creation-Date/d;/PO-Revision-Date/d;/Last-Translator/d;/Language-Team/d;/X-Generator/d;0,/^msgid/{/^#/d}' \
89 | msgcat -F -t UTF-8 -
90 }
91
92 xmltrans() {
93 if [ ! -f /etc/pootle/templates/$(basename $1) ]
94 then
95 echo "Missing /etc/pootle/templates/$(basename $1)"
96 elif [ ! -f /etc/pootle/templates/$(basename $1).pot ]
97 then
98 echo "Missing /etc/pootle/templates/$(basename $1).pot"
99 else
100 #| iconv -f ISO-8859-1 -t UTF-8 \
101 #lang=$(echo $1 | sed 's@.*/locale/\([^/]\+\)/.*@\1@')
102 cat $1 \
103 | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g;s@_{_(/?(?:lexicon|entry|base|trans).*?)_}_@<$1>@g' \
104 | sed '/<\\\?lexicon/p;0,/<lexicon/d;/<\\lexicon/,$d' \
105 | xml2po -m sme -r - -o - /etc/pootle/templates/$(basename $1) \
106 | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
107 | sed "/(lexicon)/{N;N;N;d}" \
108 | msgcat -F -t UTF-8 - \
109 | msgmerge -q -F - /etc/pootle/templates/$(basename $1).pot
110 fi
111 }
112
113 xmlgen() {
114 if [ ! -f /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') ]
115 then
116 echo "Missing /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@')" 1>&2
117 else
118 #lang=$(basename $(dirname $1))
119 msgcat -F $1 \
120 | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g;s@\(n _}_ (\d+)\)@(n > $1)@' \
121 | sed '/#,/d' \
122 | xml2po -m sme -p - /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') \
123 | sed '1d' \
124 | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
125 | perl -pe 's@(lexicon\s+lang[^"]+"[^"]+)_([^"]+)"@"$1-".lc($2)."\""@e'
126 fi
127 }
128
129 anacondagen() {
130 if [ -f /etc/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po ]
131 then
132 msgcat --use-first \
133 /etc/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po \
134 /etc/pootle/po/sme7bc/$2/anaconda.po \
135 | msgfmt -f -o - - 2> /dev/null
136 if [ $? -ne 0 ]
137 then
138 msgcat --use-first \
139 /etc/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po \
140 /etc/pootle/po/sme7bc/$2/anaconda.po \
141 | msgfmt -o - - 2> /dev/null
142 fi
143 fi
144 }
145
146 localedir() {
147 dir=$(echo $1 | perl -pe 's/_(.*)/-lc($1)/e')
148 if [ "$2" == "general" ]
149 then
150 echo "root/etc/e-smith/locale/$dir/FormMagick"
151 elif [ "$2" == "userpassword" ]
152 then
153 echo "root/etc/e-smith/locale/$dir/etc/e-smith/web/panels/password/cgi-bin"
154 else
155 echo "root/etc/e-smith/locale/$dir/etc/e-smith/web/functions"
156 fi
157 }
158

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