X-Git-Url: http://git.pld-linux.org/?p=packages%2Frpm.git;a=blobdiff_plain;f=rpm-find-lang;h=b82c8637951b075b368695aa43eb3f9e1ad479ef;hp=309d32cb6e9269a1a2fef9972d9c217e2791ba92;hb=b48366bfa6d02e94af3356b5cb2891e65f579604;hpb=f44f16a69b1b643bf5b17d3f6cd7038ef12c58d3 diff --git a/rpm-find-lang b/rpm-find-lang index 309d32c..b82c863 100644 --- a/rpm-find-lang +++ b/rpm-find-lang @@ -1,18 +1,20 @@ #!/bin/sh -#findlang - 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. +# $Id$ -#findlang is copyright (c) 1998 by W. L. Estes +# findlang - 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. -#Redistribution and use of this software are hereby permitted for any -#purpose as long as this notice and the above copyright notice remain -#in tact and are included with any redistribution of this file or any -#work based on this file. +# findlang is copyright (c) 1998 by W. L. Estes -#changes: -# $Id$ +# Redistribution and use of this software are hereby permitted for any +# purpose as long as this notice and the above copyright notice remain +# in tact and are included with any redistribution of this file or any +# work based on this file. + +# Changes: +# # 2006-08-28 Elan Ruusamäe # * fixed --all-name which got broken with last change. # 2006-08-09 Elan Ruusamäe @@ -33,10 +35,10 @@ # * start support for KDE help files PROG=${0##*/} +VERSION=$(set -- $Revision$; echo $2) usage () { cat < $OUTPUT" +MO_NAME=.$OUTPUT.tmp~ echo '%defattr(644,root,root,755)' > $MO_NAME if [ ! -f __find.files ] || [ "$TOP_DIR" -nt __find.files ]; then @@ -145,8 +164,8 @@ fi cat __find.files fi ) | sed ' -'"$ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/@]\+\)\(@quot\|@boldquot\)\?\(@[^/]*\)\?\(.*\.mo$\):%lang(\2\4) \1\2\3\4\5: -'"$NO_ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/@]\+\)\(@quot\|@boldquot\)\?\(@[^/]*\)\?\(.*/'"$NAME"'\.mo$\):%lang(\2\4) \1\2\3\4\5: +'"$ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/@]\+\)\(@quot\|@boldquot\)\?\(@[^/]*\)\?\(/.*\.mo$\):%lang(\2\4) \1\2\3\4\5: +'"$NO_ALL_NAME$MO"'s:\(.*/share/locale/\)\([^/@]\+\)\(@quot\|@boldquot\)\?\(@[^/]*\)\?\(/.*/'"$NAME"'\.mo$\):%lang(\2\4) \1\2\3\4\5: /^[^%]/d s:%lang(C) ::' >> $MO_NAME @@ -207,6 +226,13 @@ s:%lang(C) ::' >> $MO_NAME s:%lang(C) ::' >> $MO_NAME if [ "$(egrep -v '(^%defattr|^$)' $MO_NAME | wc -l)" -le 0 ]; then - echo >&2 "Error: international files not found for $NAME!" + 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