/[smeserver]/builds_bin/functions
ViewVC logotype

Diff of /builds_bin/functions

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

Revision 1.6 by slords, Sun Jun 7 17:11:51 2009 UTC Revision 1.7 by slords, Tue Mar 2 21:16:48 2010 UTC
# Line 52  diffcp() { Line 52  diffcp() {
52    
53  potempl() {  potempl() {
54      xgettext --from-code UTF-8 -L perl -o - $@ \      xgettext --from-code UTF-8 -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@' \      | sed 's@charset=CHARSET@charset=UTF-8@;s@[^ ]\+/\([^/]\+\)/[^/]\+/root/@\1/root/@g;s@Id-Version.*\\n@Id-Version: SME Template\\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}' \      | 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 -      | msgcat -F -t UTF-8 -
58  }  }
59    
60  xmltempl() {  xmltempl() {
61      mkdir -p /etc/pootle/tmp/templates /etc/pootle/templates      mkdir -p /var/lib/pootle/templates/$1/
62    
63      root=$(echo $1 | sed 's@.*/root/@root/@')      root=$(echo $2 | sed 's@.*/root/@root/@')
64      cat $1 \      cat $2 \
65      | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g;s@_{_(/?(?:lexicon|entry|base|trans).*?)_}_@<$1>@g' \      | 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' \      | sed '/<\\\?lexicon/p;0,/<lexicon/d;/<\\lexicon/,$d' \
67      | tee /etc/pootle/tmp/templates/$(basename $1).orig \      > /var/lib/pootle/tmp/$(basename $2).orig
68      | xml2po -m sme -e -o - - \  
69      | sed "/(lexicon)/{N;N;N;d};s@-\(:[0-9]\+([^)]\+)\)@$root\1@g" \      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      | tee >(cat - |  sed '/^msgid/{p;s@msgid@msgstr@p;N;d}' \      | tee >(cat - |  sed '/^msgid/{p;s@msgid@msgstr@p;N;d}' \
72                    | xml2po -m sme -p - /etc/pootle/tmp/templates/$(basename $1).orig \                    | xml2po -m sme -p - /var/lib/pootle/tmp/$(basename $2).orig \
73                    > /etc/pootle/tmp/templates/$(basename $1) ) \                    > /var/lib/pootle/tmp/$(basename $2) ) \
74      | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \      | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
75      | msgcat -F -t UTF-8 - \      | msgcat -F -t UTF-8 - \
76      | sed "/^\"POT-Creation-Date:/d;s@Project-Id-Version.*\\\n@Project-Id-Version: $2\\\n@" \      | sed "/^\"POT-Creation-Date:/d;s@Id-Version.*\\\n@Id-Version: SME Template\\\n@" \
77      > /etc/pootle/tmp/templates/$(basename $1).pot      > /var/lib/pootle/tmp/$(basename $2).pot
78      diffmv /etc/pootle/tmp/templates/$(basename $1).orig /etc/pootle/templates/$(basename $1).orig      diffmv /var/lib/pootle/tmp/$(basename $2).orig /var/lib/pootle/templates/$1/$(basename $2).orig
79      diffmv /etc/pootle/tmp/templates/$(basename $1) /etc/pootle/templates/$(basename $1)      diffmv /var/lib/pootle/tmp/$(basename $2) /var/lib/pootle/templates/$1/$(basename $2)
80      diffmv /etc/pootle/tmp/templates/$(basename $1).pot /etc/pootle/templates/$(basename $1).pot      diffmv /var/lib/pootle/tmp/$(basename $2).pot /var/lib/pootle/templates/$1/$(basename $2).pot
81  }  }
82    
83  anacondatmpl() {  anacondatmpl() {
# Line 84  anacondatmpl() { Line 85  anacondatmpl() {
85               -k=_ \               -k=_ \
86               -k=N_ \               -k=N_ \
87               -o - \               -o - \
88               $(sed -n '/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/etc/pootle/cvs/smeserver/\2/sme7/\2-*\3/\1@p' \               $(sed -n "/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/var/lib/pootle/cvs/smeserver/\2/$1/\2-*\3/\1@p" \
89                     /etc/pootle/cvs/smeserver/cdrom.image/sme7/updates/README.txt) \                     /var/lib/pootle/cvs/smeserver/cdrom.image/$1/updates/README.txt) \
90               $(sed -n '/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/etc/pootle/cvs/smeserver/\2/sme8/\2-*\3/\1@p' \               /var/lib/pootle/cvs/smeserver/cdrom.image/$1/updates/*.py \
91                     /etc/pootle/cvs/smeserver/cdrom.image/sme8/updates/README.txt) \               /var/lib/pootle/cvs/smeserver/cdrom.image/$1/*/installclasses/*.py \
92               /etc/pootle/cvs/smeserver/cdrom.image/sme7/updates/*.py \      | sed 's@charset=CHARSET@charset=UTF-8@;s@Id-Version.*\\n@Id-Version: SME Template\\n@' \
93               /etc/pootle/cvs/smeserver/cdrom.image/sme7/product/installclasses/*.py \      | sed 's@/var/lib/pootle/cvs/smeserver/[^/]\+/@@' \
              /etc/pootle/cvs/smeserver/cdrom.image/sme8/updates/*.py \  
              /etc/pootle/cvs/smeserver/cdrom.image/sme8/updates/installclasses/*.py \  
     | sed 's@charset=CHARSET@charset=UTF-8@;s@Project-Id-Version.*\\n@Project-Id-Version: SME Anaconda\\n@' \  
     | sed 's@/etc/pootle/cvs/smeserver/[^/]\+/@@' \  
94      | msgcat -u \      | msgcat -u \
95               --use-first \               --use-first \
96               - \               - \
97               <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \               <(sed 's@CHARSET@UTF-8@' /var/lib/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/anaconda.pot) \
98               <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \               <(sed 's@CHARSET@UTF-8@' /var/lib/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/anaconda.pot) \
              <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme8/anaconda-*/po/anaconda.pot) \  
              <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme8/anaconda-*/po/anaconda.pot) \  
99      | 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}' \      | 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 -      | msgcat -F -t UTF-8 -
101  }  }
102    
103  xmltrans() {  xmltrans() {
104      if [ ! -f /etc/pootle/templates/$(basename $1) ]      if [ ! -f /var/lib/pootle/templates/$1/$(basename $2) ]
105      then      then
106          echo "Missing /etc/pootle/templates/$(basename $1)"          echo "Missing /var/lib/pootle/templates/$1/$(basename $2)"
107      elif [ ! -f /etc/pootle/templates/$(basename $1).pot ]      elif [ ! -f /var/lib/pootle/templates/$1/$(basename $2).pot ]
108      then      then
109          echo "Missing /etc/pootle/templates/$(basename $1).pot"          echo "Missing /var/lib/pootle/templates/$1/$(basename $2).pot"
110      else      else
111          #| iconv -f ISO-8859-1 -t UTF-8 \          #| iconv -f ISO-8859-1 -t UTF-8 \
112          #lang=$(echo $1 | sed 's@.*/locale/\([^/]\+\)/.*@\1@')          #lang=$(echo $2 | sed 's@.*/locale/\([^/]\+\)/.*@\1@')
113          cat $1 \          cat $2 \
114          | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g;s@_{_(/?(?:lexicon|entry|base|trans).*?)_}_@<$1>@g' \          | 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' \          | sed '/<\\\?lexicon/p;0,/<lexicon/d;/<\\lexicon/,$d' \
116          | xml2po -m sme -r - -o - /etc/pootle/templates/$(basename $1) \          | xml2po -m sme -r - -o - /var/lib/pootle/templates/$1/$(basename $2) \
117          | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \          | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
118          | sed "/(lexicon)/{N;N;N;d}" \          | sed "/(lexicon)/{N;N;N;d}" \
119          | msgcat -F -t UTF-8 - \          | msgcat -F -t UTF-8 - \
120          | msgmerge -q -F - /etc/pootle/templates/$(basename $1).pot          | msgmerge -q -F - /var/lib/pootle/templates/$1/$(basename $2).pot
121      fi      fi
122  }  }
123    
124  xmlgen() {  xmlgen() {
125      if [ ! -f /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') ]      if [ ! -f /var/lib/pootle/templates/$1/$(basename $2 | sed 's@\.pot\?$@@') ]
126      then      then
127          echo "Missing /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@')" 1>&2          echo "Missing /var/lib/pootle/templates/$1/$(basename $2 | sed 's@\.pot\?$@@')" 1>&2
128      else      else
129          #lang=$(basename $(dirname $1))          #lang=$(basename $(dirname $2))
130          msgcat -F $1 \          msgcat -F $2 \
131          | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g' \          | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g' \
132          | sed '/#,/d' | sed '1,/X-Generator/{;s,_{_,<,g;s,_}_,>,g;s,_AMP_,\&,g;}' \          | sed '/#,/d' | sed '1,/X-Generator/{;s,_{_,<,g;s,_}_,>,g;s,_AMP_,\&,g;}' \
133          | sed '/#,/d' \          | sed '/#,/d' \
134          | xml2po -m sme -p - /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') \          | xml2po -m sme -p - /var/lib/pootle/templates/$1/$(basename $2 | sed 's@\.pot\?$@@') \
135          | sed '1d' \          | sed '1d' \
136          | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \          | perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \
137          | perl -pe 's@(lexicon\s+lang[^"]+"[^"]+)_([^"]+)"@"$1-".lc($2)."\""@e'          | perl -pe 's@(lexicon\s+lang[^"]+"[^"]+)_([^"]+)"@"$1-".lc($2)."\""@e'
# Line 144  xmlgen() { Line 139  xmlgen() {
139  }  }
140    
141  anacondagen() {  anacondagen() {
142      if [ -f /etc/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po ]      if [ -f /var/lib/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po ]
143      then      then
144          msgcat --use-first \          msgcat --use-first \
145                 /etc/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po \                 /var/lib/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po \
146                 /etc/pootle/po/sme7bc/$2/anaconda.po \                 /var/lib/pootle/po/$1/$2/anaconda.po \
147          | msgfmt -f -o - - 2> /dev/null          | msgfmt -f -o - - 2> /dev/null
148          if [ $? -ne 0 ]          if [ $? -ne 0 ]
149          then          then
150              msgcat --use-first \              msgcat --use-first \
151                     /etc/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po \                     /var/lib/pootle/cvs/smeserver/anaconda/$1/anaconda-*/po/$2.po \
152                     /etc/pootle/po/sme7bc/$2/anaconda.po \                     /var/lib/pootle/po/$1/$2/anaconda.po \
153              | msgfmt -o - - 2> /dev/null              | msgfmt -o - - 2> /dev/null
154          fi          fi
155      fi      fi


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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