From: Elan Ruusamäe Date: Mon, 18 Oct 2010 22:37:23 +0000 (+0000) Subject: - added qt .qm support X-Git-Tag: auto/th/rpm-build-macros-1_588-1~7 X-Git-Url: http://git.pld-linux.org/gitweb.cgi?p=packages%2Frpm-build-macros.git;a=commitdiff_plain;h=2475a48edde50c7abd193c572a480f31d2f2e9a5;ds=sidebyside - added qt .qm support Changed files: rpm-find-lang -> 1.33 --- diff --git a/rpm-find-lang b/rpm-find-lang index b82c863..197d83b 100644 --- a/rpm-find-lang +++ b/rpm-find-lang @@ -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