/[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.6 - (hide annotations) (download)
Sun Jun 7 17:11:51 2009 UTC (15 years, 5 months ago) by slords
Branch: MAIN
Changes since 1.5: +11 -5 lines
Updates for cdrom.images changes

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 slords 1.5 xgettext --from-code UTF-8 -L perl -o - $@ \
55 slords 1.1 | 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 slords 1.6 /etc/pootle/cvs/smeserver/cdrom.image/sme7/updates/README.txt) \
89     $(sed -n '/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/etc/pootle/cvs/smeserver/\2/sme8/\2-*\3/\1@p' \
90     /etc/pootle/cvs/smeserver/cdrom.image/sme8/updates/README.txt) \
91     /etc/pootle/cvs/smeserver/cdrom.image/sme7/updates/*.py \
92     /etc/pootle/cvs/smeserver/cdrom.image/sme7/product/installclasses/*.py \
93     /etc/pootle/cvs/smeserver/cdrom.image/sme8/updates/*.py \
94     /etc/pootle/cvs/smeserver/cdrom.image/sme8/updates/installclasses/*.py \
95     | sed 's@charset=CHARSET@charset=UTF-8@;s@Project-Id-Version.*\\n@Project-Id-Version: SME Anaconda\\n@' \
96     | sed 's@/etc/pootle/cvs/smeserver/[^/]\+/@@' \
97 slords 1.1 | msgcat -u \
98     --use-first \
99     - \
100     <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \
101     <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \
102 slords 1.6 <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme8/anaconda-*/po/anaconda.pot) \
103     <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme8/anaconda-*/po/anaconda.pot) \
104 slords 1.1 | 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}' \
105     | msgcat -F -t UTF-8 -
106     }
107    
108     xmltrans() {
109     if [ ! -f /etc/pootle/templates/$(basename $1) ]
110     then
111     echo "Missing /etc/pootle/templates/$(basename $1)"
112     elif [ ! -f /etc/pootle/templates/$(basename $1).pot ]
113     then
114     echo "Missing /etc/pootle/templates/$(basename $1).pot"
115     else
116     #| iconv -f ISO-8859-1 -t UTF-8 \
117     #lang=$(echo $1 | sed 's@.*/locale/\([^/]\+\)/.*@\1@')
118     cat $1 \
119     | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g;s@_{_(/?(?:lexicon|entry|base|trans).*?)_}_@<$1>@g' \
120     | sed '/<\\\?lexicon/p;0,/<lexicon/d;/<\\lexicon/,$d' \
121     | xml2po -m sme -r - -o - /etc/pootle/templates/$(basename $1) \
122     | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
123     | sed "/(lexicon)/{N;N;N;d}" \
124     | msgcat -F -t UTF-8 - \
125     | msgmerge -q -F - /etc/pootle/templates/$(basename $1).pot
126     fi
127     }
128    
129     xmlgen() {
130     if [ ! -f /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') ]
131     then
132     echo "Missing /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@')" 1>&2
133     else
134     #lang=$(basename $(dirname $1))
135     msgcat -F $1 \
136 slords 1.4 | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g' \
137     | sed '/#,/d' | sed '1,/X-Generator/{;s,_{_,<,g;s,_}_,>,g;s,_AMP_,\&,g;}' \
138 slords 1.1 | sed '/#,/d' \
139     | xml2po -m sme -p - /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') \
140     | sed '1d' \
141     | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
142     | perl -pe 's@(lexicon\s+lang[^"]+"[^"]+)_([^"]+)"@"$1-".lc($2)."\""@e'
143     fi
144     }
145    
146     anacondagen() {
147     if [ -f /etc/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po ]
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 -f -o - - 2> /dev/null
153     if [ $? -ne 0 ]
154     then
155     msgcat --use-first \
156     /etc/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po \
157     /etc/pootle/po/sme7bc/$2/anaconda.po \
158     | msgfmt -o - - 2> /dev/null
159     fi
160     fi
161     }
162    
163     localedir() {
164     dir=$(echo $1 | perl -pe 's/_(.*)/-lc($1)/e')
165     if [ "$2" == "general" ]
166     then
167     echo "root/etc/e-smith/locale/$dir/FormMagick"
168     elif [ "$2" == "userpassword" ]
169     then
170     echo "root/etc/e-smith/locale/$dir/etc/e-smith/web/panels/password/cgi-bin"
171     else
172     echo "root/etc/e-smith/locale/$dir/etc/e-smith/web/functions"
173     fi
174     }
175    

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