[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] Scripty/cvs.sh: create a function "extract_messages"
From:       Nicolas Goutte <nicolasg () snafu ! de>
Date:       2004-10-05 19:02:07
Message-ID: 200410052102.07718.nicolasg () snafu ! de
[Download RAW message or body]

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!

["cvs_sh_extract_messages.diff" (text/x-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"



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic