packages: rpm-build-macros/rpm-find-lang - added qt .qm support

glen glen at pld-linux.org
Tue Oct 19 00:37:28 CEST 2010


Author: glen                         Date: Mon Oct 18 22:37:28 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- added qt .qm support

---- Files affected:
packages/rpm-build-macros:
   rpm-find-lang (1.32 -> 1.33) 

---- Diffs:

================================================================
Index: packages/rpm-build-macros/rpm-find-lang
diff -u packages/rpm-build-macros/rpm-find-lang:1.32 packages/rpm-build-macros/rpm-find-lang:1.33
--- packages/rpm-build-macros/rpm-find-lang:1.32	Fri Feb 15 01:24:10 2008
+++ packages/rpm-build-macros/rpm-find-lang	Tue Oct 19 00:37:23 2010
@@ -1,7 +1,7 @@
 #!/bin/sh
 # $Id$
 
-# findlang - automagically generate list of language specific files
+# find-lang - automagically generate list of language specific files
 # for inclusion in an rpm spec file.
 # This does assume that the *.mo files are under .../share/locale/...
 # Run with no arguments gets a usage message.
@@ -52,6 +52,7 @@
   --with-gnome		find GNOME help files
   --with-kde		find KDE help files
   --with-omf		find OMF files
+  --with-qm			find QT .qm files
   --all-name		match all package/domain names
   --without-mo		skip *.mo locale files
   -o NAME			output will be saved to NAME
@@ -83,12 +84,13 @@
 GNOME='#'
 KDE='#'
 OMF='#'
+QM='#'
 MO=''
 OUTPUT=$NAME.lang
 ALL_NAME='#'
 NO_ALL_NAME=''
 APPEND=''
-while test $# -gt 0 ; do
+while test $# -gt 0; do
     case "$1" in
 	--with-gnome)
   		GNOME=''
@@ -105,6 +107,11 @@
 		OMF=''
 		shift
 		;;
+	--with-qm)
+		echo "$PROG: Enabling with Qt QM"
+		QM=''
+		shift
+		;;
 	--without-mo)
 		echo "$PROG: Disabling .mo files"
 		MO='#'
@@ -139,6 +146,7 @@
 MO_NAME=.$OUTPUT.tmp~
 echo '%defattr(644,root,root,755)' > $MO_NAME
 
+# .mo
 if [ ! -f __find.files ] || [ "$TOP_DIR" -nt __find.files ]; then
 	find $TOP_DIR -xtype f -name '*.mo' | xargs -r file -L | \
 	sed -e '
@@ -149,6 +157,7 @@
 	echo "$PROG: Using cached __find.files"
 fi
 
+# .omf
 if [ ! -f __omf.files ] || [ "$TOP_DIR" -nt __omf.files ]; then
 	find $TOP_DIR -type f -name '*.omf' | \
 	sed -e '
@@ -157,6 +166,16 @@
 	echo "$PROG: Using cached __omf.files"
 fi
 
+# .qm
+if [ ! -f __qm.files ] || [ "$TOP_DIR" -nt __qm.files ]; then
+	find $TOP_DIR -type f -name '*.qm' | \
+	sed -e '
+		s:'"$TOP_DIR"'::' > __qm.files
+else
+	echo "$PROG: Using cached __qm.files"
+fi
+
+# .mo
 (
 	if [ "$ALL_NAME" ]; then
 		fgrep $NAME __find.files
@@ -169,6 +188,7 @@
 /^[^%]/d
 s:%lang(C) ::' >> $MO_NAME
 
+# .omf
 (
 	if [ "$ALL_NAME" ]; then
 		fgrep $NAME __omf.files
@@ -181,12 +201,26 @@
 /^[^%]/d
 s:%lang(C) ::' >> $MO_NAME
 
+# .qm
+(
+	if [ "$ALL_NAME" ]; then
+		fgrep $NAME __qm.files
+	else
+		cat __qm.files
+	fi
+) | sed '
+'"$ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/@]\+\)\(@quot\|@boldquot\)\?\(@[^/]*\)\?\(/.*\.qm$\):%lang(\2\4) \1\2\3\4\5:
+'"$NO_ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/@]\+\)\(@quot\|@boldquot\)\?\(@[^/]*\)\?\(/.*/'"$NAME"'\.qm$\):%lang(\2\4) \1\2\3\4\5:
+/^[^%]/d
+s:%lang(C) ::' >> $MO_NAME
+
 if [ ! -f __find.dirs ] || [ "$TOP_DIR" -nt __find.dirs ]; then
 	find $TOP_DIR -mindepth 1 -type d | sed 's:'"$TOP_DIR"'::' > __find.dirs
 else
 	echo "$PROG: Using cached __find.dirs"
 fi
 
+# gnome
 (
 	if [ "$ALL_NAME" ]; then
 		fgrep $NAME __find.dirs
@@ -201,6 +235,7 @@
 /^[^%]/d
 s:%lang(C) ::' >> $MO_NAME
 
+# kde
 (
 	if [ "$ALL_NAME" ]; then
 		fgrep $NAME __find.dirs
================================================================

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



More information about the pld-cvs-commit mailing list