SOURCES: rpm-find-lang - fix empty lang detection for append mode ...

glen glen at pld-linux.org
Fri Feb 15 01:24:15 CET 2008


Author: glen                         Date: Fri Feb 15 00:24:15 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fix empty lang detection for append mode (use tmp file)

---- Files affected:
SOURCES:
   rpm-find-lang (1.31 -> 1.32) 

---- Diffs:

================================================================
Index: SOURCES/rpm-find-lang
diff -u SOURCES/rpm-find-lang:1.31 SOURCES/rpm-find-lang:1.32
--- SOURCES/rpm-find-lang:1.31	Fri Feb 15 01:07:53 2008
+++ SOURCES/rpm-find-lang	Fri Feb 15 01:24:10 2008
@@ -84,7 +84,7 @@
 KDE='#'
 OMF='#'
 MO=''
-MO_NAME=$NAME.lang
+OUTPUT=$NAME.lang
 ALL_NAME='#'
 NO_ALL_NAME=''
 APPEND=''
@@ -118,25 +118,26 @@
 		;;
 	-o)
 		shift
-		MO_NAME=$1
+		OUTPUT=$1
 		shift
 		;;
 	-a)
 		shift
-		MO_NAME=$1
+		OUTPUT=$1
 		APPEND='>'
 		shift
 		;;
 	*)
-		MO_NAME=$1
+		OUTPUT=$1
 		shift
 		;;
     esac
 done
 
-echo "$PROG/$VERSION: find-lang '$NAME' $APPEND> $MO_NAME"
+echo "$PROG/$VERSION: find-lang '$NAME' $APPEND> $OUTPUT"
 
-[ -z "$APPEND" ] && echo '%defattr(644,root,root,755)' > $MO_NAME
+MO_NAME=.$OUTPUT.tmp~
+echo '%defattr(644,root,root,755)' > $MO_NAME
 
 if [ ! -f __find.files ] || [ "$TOP_DIR" -nt __find.files ]; then
 	find $TOP_DIR -xtype f -name '*.mo' | xargs -r file -L | \
@@ -228,3 +229,10 @@
 	echo >&2 "$PROG: Error: international files not found for '$NAME'!"
 	exit 1
 fi
+
+if [ "$APPEND" ]; then
+	cat $MO_NAME >> $OUTPUT
+	rm -f $MO_NAME
+else
+	mv -f $MO_NAME $OUTPUT
+fi
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/rpm-find-lang?r1=1.31&r2=1.32&f=u



More information about the pld-cvs-commit mailing list