--- builds_bin/functions 2008/09/26 23:54:10 1.2 +++ builds_bin/functions 2009/06/07 17:11:51 1.6 @@ -1,49 +1,57 @@ #!/usr/bash -# functions used for pootle - diffmv() { if [ ! -z "$1" -a ! -z "$2" ] then - if [ "${1%%.tm}" == "$1" ] - then - if diff -u "$2" "$1" - then - /bin/rm -f "$1" - else - /bin/mv -f "$1" "$2" - fi - else - if diff -q "$2" "$1" > /dev/null - then - /bin/rm -f "$1" - else - /bin/mv -f "$1" "$2" - fi - fi + if [ -f "$2" ] + then + if [ "${1%%.tm}" == "$1" ] + then + if diff -u "$2" "$1" + then + /bin/rm -f "$1" + else + /bin/mv -f "$1" "$2" + fi + else + if diff -q "$2" "$1" > /dev/null + then + /bin/rm -f "$1" + else + /bin/mv -f "$1" "$2" + fi + fi + else + /bin/mv -f "$1" "$2" + fi fi } diffcp() { if [ ! -z "$1" -a ! -z "$2" ] then - if [ "${1%%.tm}" == "$1" ] - then - if ! diff -u "$2" "$1" - then - /bin/cp -a "$1" "$2" - fi - else - if ! diff -q "$2" "$1" > /dev/null - then - /bin/cp -a "$1" "$2" - fi - fi + if [ -f "$2" ] + then + if [ "${1%%.tm}" == "$1" ] + then + if ! diff -u "$2" "$1" + then + /bin/cp -a "$1" "$2" + fi + else + if ! diff -q "$2" "$1" > /dev/null + then + /bin/cp -a "$1" "$2" + fi + fi + else + /bin/cp -a "$1" "$2" + fi fi } potempl() { - xgettext -L perl -o - $@ \ + xgettext --from-code UTF-8 -L perl -o - $@ \ | sed 's@charset=CHARSET@charset=UTF-8@;s@[^ ]*/root/@root/@g;s@Project-Id-Version.*\\n@Project-Id-Version: SME Console\\n@' \ | sed '/Report-Msgid-Bugs-To/d;/POT-Creation-Date/d;/PO-Revision-Date/d;/Language-Team/d;/X-Generator/d;0,/^msgid/{/^#/d}' \ | msgcat -F -t UTF-8 - @@ -77,16 +85,22 @@ anacondatmpl() { -k=N_ \ -o - \ $(sed -n '/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/etc/pootle/cvs/smeserver/\2/sme7/\2-*\3/\1@p' \ - /etc/pootle/cvs/smeserver/cdrom.image/updates/README.txt) \ - /etc/pootle/cvs/smeserver/cdrom.image/updates/*.py \ - /etc/pootle/cvs/smeserver/cdrom.image/product/installclasses/*.py \ - | sed 's@charset=CHARSET@charset=UTF-8@;s@[^ ]*/sme7/[^:]\+/\([^:]\+\):@updates/\1:@g;s@[^ ]*/cdrom.image/@@g;' \ - | sed 's@Project-Id-Version.*\\n@Project-Id-Version: SME Anaconda\\n@' \ + /etc/pootle/cvs/smeserver/cdrom.image/sme7/updates/README.txt) \ + $(sed -n '/\.py/s@^\([^ \t]\+\)[ \t]\+\([^/]\+\)\(/.*\)\?@/etc/pootle/cvs/smeserver/\2/sme8/\2-*\3/\1@p' \ + /etc/pootle/cvs/smeserver/cdrom.image/sme8/updates/README.txt) \ + /etc/pootle/cvs/smeserver/cdrom.image/sme7/updates/*.py \ + /etc/pootle/cvs/smeserver/cdrom.image/sme7/product/installclasses/*.py \ + /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/[^/]\+/@@' \ | msgcat -u \ --use-first \ - \ <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/anaconda-*/po/anaconda.pot) \ <(sed 's@CHARSET@UTF-8@' /etc/pootle/cvs/smeserver/anaconda/sme7/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) \ | 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}' \ | msgcat -F -t UTF-8 - } @@ -119,7 +133,8 @@ xmlgen() { else #lang=$(basename $(dirname $1)) msgcat -F $1 \ - | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g;s@\(n _}_ (\d+)\)@(n > $1)@' \ + | perl -pe 's@<@_{_@g;s@>@_}_@g;s@&@_AMP_@g' \ + | sed '/#,/d' | sed '1,/X-Generator/{;s,_{_,<,g;s,_}_,>,g;s,_AMP_,\&,g;}' \ | sed '/#,/d' \ | xml2po -m sme -p - /etc/pootle/templates/$(basename $1 | sed 's@\.pot\?$@@') \ | sed '1d' \