/[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.9 - (hide annotations) (download)
Sun Apr 28 18:53:34 2024 UTC (6 months ago) by jpp
Branch: MAIN
CVS Tags: HEAD
Changes since 1.8: +25 -31 lines
20240428

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 jpp 1.9 if [ "${1%%.tm}" == "$1" ]
9 slords 1.4 then
10 jpp 1.9 if diff -u "$2" "$1"
11     then
12     /bin/rm -f "$1"
13     else
14     /bin/mv -f "$1" "$2"
15     fi
16 slords 1.4 else
17 jpp 1.9 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 slords 1.4 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 jpp 1.9 if [ "${1%%.tm}" == "$1" ]
36 slords 1.4 then
37 jpp 1.9 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 slords 1.4 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.7 | sed 's@charset=CHARSET@charset=UTF-8@;s@[^ ]\+/\([^/]\+\)/[^/]\+/root/@\1/root/@g;s@Id-Version.*\\n@Id-Version: SME Template\\n@' \
56 slords 1.1 | 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 slords 1.7 mkdir -p /var/lib/pootle/templates/$1/
62 slords 1.1
63 slords 1.7 root=$(echo $2 | sed 's@.*/root/@root/@')
64     cat $2 \
65 slords 1.1 | 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 slords 1.7 > /var/lib/pootle/tmp/$(basename $2).orig
68    
69     xml2po -m sme -e -o - /var/lib/pootle/tmp/$(basename $2).orig \
70     | sed "/(lexicon)/{N;N;N;d};s@[^ ]\+\(:[0-9]\+([^)]\+)\)@$1/$root\1@g" \
71 slords 1.1 | tee >(cat - | sed '/^msgid/{p;s@msgid@msgstr@p;N;d}' \
72 slords 1.7 | xml2po -m sme -p - /var/lib/pootle/tmp/$(basename $2).orig \
73     > /var/lib/pootle/tmp/$(basename $2) ) \
74 slords 1.1 | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
75     | msgcat -F -t UTF-8 - \
76 slords 1.7 | sed "/^\"POT-Creation-Date:/d;s@Id-Version.*\\\n@Id-Version: SME Template\\\n@" \
77     > /var/lib/pootle/tmp/$(basename $2).pot
78     diffmv /var/lib/pootle/tmp/$(basename $2).orig /var/lib/pootle/templates/$1/$(basename $2).orig
79     diffmv /var/lib/pootle/tmp/$(basename $2) /var/lib/pootle/templates/$1/$(basename $2)
80     diffmv /var/lib/pootle/tmp/$(basename $2).pot /var/lib/pootle/templates/$1/$(basename $2).pot
81 slords 1.1 }
82    
83     anacondatmpl() {
84     xgettext -L python \
85     -k=_ \
86     -k=N_ \
87     -o - \
88 slords 1.7 $(sed -n "/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/var/lib/pootle/cvs/smeserver/\2/$1/\2-*\3/\1@p" \
89     /var/lib/pootle/cvs/smeserver/cdrom.image/$1/updates/README.txt) \
90 jpp 1.9 /var/lib/pootle/cvs/smeserver/cdrom.image/$1/updates/*.py \
91     /var/lib/pootle/cvs/smeserver/cdrom.image/$1/*/installclasses/*.py \
92 slords 1.7 | sed 's@charset=CHARSET@charset=UTF-8@;s@Id-Version.*\\n@Id-Version: SME Template\\n@' \
93     | sed 's@/var/lib/pootle/cvs/smeserver/[^/]\+/@@' \
94 slords 1.1 | msgcat -u \
95     --use-first \
96     - \
97 slords 1.7 <(sed 's@CHARSET@UTF-8@' /var/lib/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/anaconda.pot) \
98     <(sed 's@CHARSET@UTF-8@' /var/lib/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/anaconda.pot) \
99 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}' \
100     | msgcat -F -t UTF-8 -
101     }
102    
103     xmltrans() {
104 slords 1.7 if [ ! -f /var/lib/pootle/templates/$1/$(basename $2) ]
105 slords 1.1 then
106 slords 1.7 echo "Missing /var/lib/pootle/templates/$1/$(basename $2)"
107     elif [ ! -f /var/lib/pootle/templates/$1/$(basename $2).pot ]
108 slords 1.1 then
109 slords 1.7 echo "Missing /var/lib/pootle/templates/$1/$(basename $2).pot"
110 slords 1.1 else
111     #| iconv -f ISO-8859-1 -t UTF-8 \
112 slords 1.7 #lang=$(echo $2 | sed 's@.*/locale/\([^/]\+\)/.*@\1@')
113     cat $2 \
114 slords 1.1 | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g;s@_{_(/?(?:lexicon|entry|base|trans).*?)_}_@<$1>@g' \
115     | sed '/<\\\?lexicon/p;0,/<lexicon/d;/<\\lexicon/,$d' \
116 slords 1.7 | xml2po -m sme -r - -o - /var/lib/pootle/templates/$1/$(basename $2) \
117 slords 1.1 | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
118     | sed "/(lexicon)/{N;N;N;d}" \
119     | msgcat -F -t UTF-8 - \
120 slords 1.7 | msgmerge -q -F - /var/lib/pootle/templates/$1/$(basename $2).pot
121 slords 1.1 fi
122     }
123    
124     xmlgen() {
125 slords 1.7 if [ ! -f /var/lib/pootle/templates/$1/$(basename $2 | sed 's@\.pot\?$@@') ]
126 slords 1.1 then
127 slords 1.7 echo "Missing /var/lib/pootle/templates/$1/$(basename $2 | sed 's@\.pot\?$@@')" 1>&2
128 slords 1.1 else
129 slords 1.7 #lang=$(basename $(dirname $2))
130     msgcat -F $2 \
131 slords 1.4 | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g' \
132     | sed '/#,/d' | sed '1,/X-Generator/{;s,_{_,<,g;s,_}_,>,g;s,_AMP_,\&,g;}' \
133 slords 1.1 | sed '/#,/d' \
134 slords 1.7 | xml2po -m sme -p - /var/lib/pootle/templates/$1/$(basename $2 | sed 's@\.pot\?$@@') \
135 slords 1.1 | sed '1d' \
136     | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
137     | perl -pe 's@(lexicon\s+lang[^"]+"[^"]+)_([^"]+)"@"$1-".lc($2)."\""@e'
138     fi
139     }
140    
141     anacondagen() {
142 slords 1.7 if [ -f /var/lib/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po ]
143 slords 1.1 then
144     msgcat --use-first \
145 slords 1.7 /var/lib/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po \
146     /var/lib/pootle/po/$1/$2/anaconda.po \
147 slords 1.1 | msgfmt -f -o - - 2> /dev/null
148     if [ $? -ne 0 ]
149     then
150     msgcat --use-first \
151 slords 1.7 /var/lib/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po \
152     /var/lib/pootle/po/$1/$2/anaconda.po \
153 slords 1.1 | msgfmt -o - - 2> /dev/null
154     fi
155     fi
156     }
157    
158     localedir() {
159     dir=$(echo $1 | perl -pe 's/_(.*)/-lc($1)/e')
160     if [ "$2" == "general" ]
161     then
162     echo "root/etc/e-smith/locale/$dir/FormMagick"
163     elif [ "$2" == "userpassword" ]
164     then
165     echo "root/etc/e-smith/locale/$dir/etc/e-smith/web/panels/password/cgi-bin"
166     else
167     echo "root/etc/e-smith/locale/$dir/etc/e-smith/web/functions"
168     fi
169     }
170    

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