From kde-core-devel Tue Oct 05 19:02:07 2004 From: Nicolas Goutte Date: Tue, 05 Oct 2004 19:02:07 +0000 To: kde-core-devel Subject: [PATCH] Scripty/cvs.sh: create a function "extract_messages" Message-Id: <200410052102.07718.nicolasg () snafu ! de> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=109700292729891 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_v+uYBJ0nUWkckY9" --Boundary-00=_v+uYBJ0nUWkckY9 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline The attached patch is for kde-common/admin/cvs.sh It creates a function "extract_messages" that just makes the minimum to extract the messages out the source. The original function "package_messages" is still available that way, so that it can still be used for other use than Scripty's. But Scripty's main script kde-common/creatediff will now to be able to use the new function directly (and will be able to control more what happens.) (This patch also contains the simplifications of my earlier patch.) Have a nice day! --Boundary-00=_v+uYBJ0nUWkckY9 Content-Type: text/x-diff; charset="iso-8859-15"; name="cvs_sh_extract_messages.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cvs_sh_extract_messages.diff" Index: cvs.sh =================================================================== RCS file: /home/kde/kde-common/admin/cvs.sh,v retrieving revision 1.140 diff -u -p -r1.140 cvs.sh --- cvs.sh 4 Oct 2004 08:04:51 -0000 1.140 +++ cvs.sh 5 Oct 2004 18:53:04 -0000 @@ -523,18 +523,8 @@ for cat in $catalogs; do done } -package_messages() +extract_messages() { -rm -rf po.backup -mkdir po.backup - -for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do - egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > po.backup/$i - cat po/$i > po.backup/backup_$i - touch -r po/$i po.backup/backup_$i - rm po/$i -done - podir=${podir:-$PWD/po} files=`find . -name Makefile.am | xargs egrep -l '^messages:' ` dirs=`for i in $files; do echo \`dirname $i\`; done` @@ -575,18 +565,31 @@ for subdir in $dirs; do rm -f $subdir/_transMakefile done rm -f $tmpname +} + +package_messages() +{ +rm -rf po.backup +mkdir po.backup + +for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do + egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > po.backup/$i + cat po/$i > po.backup/backup_$i + touch -r po/$i po.backup/backup_$i + rm po/$i +done + +extract_messages + for i in `ls -1 po.backup/*.pot 2>/dev/null | sed -e "s#po.backup/##" | egrep -v '^backup_'`; do test -f po/$i || echo "disappeared: $i" done for i in `ls -1 po/*.pot 2>/dev/null | sed -e "s#po/##"`; do sed -e 's,^"Content-Type: text/plain; charset=CHARSET\\n"$,"Content-Type: text/plain; charset=UTF-8\\n",' po/$i > po/$i.new && mv po/$i.new po/$i - msgmerge -q -o po/$i po/$i po/$i + #msgmerge -q -o po/$i po/$i po/$i egrep -v '^#([^:]|$)' po/$i | egrep '^.*[^ ]+.*$' | grep -v "\"POT-Creation" > temp.pot - if test -f po.backup/$i && test -n "`diff temp.pot po.backup/$i`"; then + if test -f po.backup/$i && ! cmp -s temp.pot po.backup/$i; then echo "will update $i" - sed -e 's,^"Content-Type: text/plain; charset=CHARSET\\n"$,"Content-Type: text/plain; charset=UTF-8\\n",' po.backup/backup_$i > po/$i.new && mv po/$i.new po.backup/backup_$i - msgmerge -q po.backup/backup_$i po/$i > temp.pot - mv temp.pot po/$i else if test -f po.backup/backup_$i; then test -z "$VERBOSE" || echo "I'm restoring $i" --Boundary-00=_v+uYBJ0nUWkckY9--