/[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.4 - (hide annotations) (download)
Mon Mar 2 22:08:07 2009 UTC (15 years, 8 months ago) by slords
Branch: MAIN
Changes since 1.3: +40 -29 lines
Tools updates

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

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