/[smeserver]/builds_bin/functions
ViewVC logotype

Annotation of /builds_bin/functions

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


Revision 1.2 - (hide annotations) (download)
Fri Sep 26 23:54:10 2008 UTC (16 years, 1 month ago) by slords
Branch: MAIN
Changes since 1.1: +2 -0 lines
Test commit

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

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