]> git.pld-linux.org Git - packages/rpm-build-macros.git/commitdiff
- added qt .qm support
authorElan Ruusamäe <glen@pld-linux.org>
Mon, 18 Oct 2010 22:37:23 +0000 (22:37 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    rpm-find-lang -> 1.33

rpm-find-lang

index b82c8637951b075b368695aa43eb3f9e1ad479ef..197d83bcf45d3fe15e6db2a8cfb4037b151f679a 100644 (file)
@@ -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 @@ Additional options:
   --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 @@ shift
 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 @@ while test $# -gt 0 ; do
                OMF=''
                shift
                ;;
+       --with-qm)
+               echo "$PROG: Enabling with Qt QM"
+               QM=''
+               shift
+               ;;
        --without-mo)
                echo "$PROG: Disabling .mo files"
                MO='#'
@@ -139,6 +146,7 @@ echo "$PROG/$VERSION: find-lang '$NAME' $APPEND> $OUTPUT"
 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 @@ else
        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 @@ else
        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 @@ fi
 /^[^%]/d
 s:%lang(C) ::' >> $MO_NAME
 
+# .omf
 (
        if [ "$ALL_NAME" ]; then
                fgrep $NAME __omf.files
@@ -181,12 +201,26 @@ s:%lang(C) ::' >> $MO_NAME
 /^[^%]/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 @@ fi
 /^[^%]/d
 s:%lang(C) ::' >> $MO_NAME
 
+# kde
 (
        if [ "$ALL_NAME" ]; then
                fgrep $NAME __find.dirs
This page took 0.046593 seconds and 4 git commands to generate.