From 1805ac51a829f67b191b4f5922ef8c2e2f98bcfc Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 21 Oct 2006 20:53:58 +0000 Subject: [PATCH] Set up to preserve pgtranslation $Id$ header --- cp-po | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/cp-po b/cp-po index 01f412d..03421aa 100755 --- a/cp-po +++ b/cp-po @@ -12,12 +12,14 @@ set -e me=$(basename $0) +run=true + TEMP=$(getopt n "$@") eval set -- "$TEMP" while true; do case $1 in - -n) run=: ; shift;; + -n) run=false; shift;; --) shift; break;; esac done @@ -41,6 +43,12 @@ for srcfile in $(find "$srcdir" -name '*.po'); do lang=$(expr $base : '\([a-z][a-zA-Z_]*\)') srccat=$(expr $base : '.*/\([^/]*\)\.po$') + if ! msgfmt -o /dev/null -c -v $srcfile 2>/dev/null; then + echo "$me: $srcfile has errors" 1>&2 + msgfmt -o /dev/null -c -v $srcfile + exit 1 + fi + for y in $nls_mks; do destcat=$(cat $y | sed -n 's/CATALOG_NAME.*:*= *\([^ ]*\)$/\1/p') if [ -z "$destcat" ]; then @@ -49,12 +57,13 @@ for srcfile in $(find "$srcdir" -name '*.po'); do fi if [ "$srccat" = "$destcat" ]; then targetdir=$(echo $y | sed 's,nls\.mk$,po,') - if [ ! -e $targetdir/$lang.po ]; then - echo "NEW: $targetdir/$lang.po --- file will be copied, but do \"cvs add\" and fix $y by hand" 1>&2 + targetfile=$targetdir/$lang.po + if [ ! -e $targetfile ]; then + echo "NEW: $targetfile --- file will be copied, but do \"cvs add\" and fix $y by hand" 1>&2 fi - if [ ! -e $targetdir/$lang.po ] || ! diff -I '\$\(Header\|Id\|PostgreSQL\):.*\$' $srcfile $targetdir/$lang.po >/dev/null; then - echo " cp $srcfile $targetdir/$lang.po" - $run cp $srcfile $targetdir/$lang.po + if [ ! -e $targetfile ] || ! diff -I '\$\(Header\|Id\|PostgreSQL\):.*\$' $srcfile $targetfile >/dev/null; then + echo " $srcfile --> $targetfile" + $run && { cat $srcfile | sed 's/^\(# *\)$Id/\1pgtranslation Id/' >$targetfile; chmod 644 $targetfile; } fi fi done -- 2.39.5