Bug 3244 - find-lang uses hardcoded path patterns
Summary: find-lang uses hardcoded path patterns
Alias: None
Product: Sisyphus
Classification: Development
Component: rpm-build (show other bugs)
Version: unstable
Hardware: all Linux
: P2 enhancement
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
Depends on:
Reported: 2003-11-06 19:00 MSK by Sir Raorn
Modified: 2008-06-13 12:15 MSD (History)
6 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Sir Raorn 2003-11-06 19:00:23 MSK
/usr/lib/rpm/find-lang uses hardcoded path patterns to find locale-dependant
files. It will be better if packager may pass file patterns as arguments.

For example:
vim-common contains gettext databases and menus for various locales in
/usr/share/vim/lang/{LOCALE}/LC_MESSAGES/vim.mo and
/usr/share/vim/lang/menu_{locale}.vim, where {LOCALE} - full or partial locale
name in form of language[_COUNTRY[.ENCODING]] and {locale} is lowercased locale
Comment 1 Dmitry V. Levin 2004-06-27 04:15:27 MSD
Please suggest some syntax.
Comment 2 Sir Raorn 2004-06-28 10:30:18 MSD
I think simplest way is to allow packager provide his own sed rules:

    if [ -n "$FIND_CUSTOM" ]; then
        find "$TOPDIR" -type f |sed '
<user-defined rules goes here>
        ' |grep -v '^$' >> "$OUTFILE" ||:

Maybe, different ruless for different file types (d, f, l).


's:\(.*/share/vim/lang/\)\([^/_]\+\)\(.*vim\.mo$\):%%lang(\2) \1\2\3:'
%add_custom_find_lang 's:^\([^%%].*\)::'


%find_lang --custom %name
Comment 3 Dmitry V. Levin 2004-06-29 19:44:10 MSD
Or maybe this way:
  --custom-dir-script=FILE  look for directories using specified sed script;
  --custom-file-script=FILE look for files using specified sed script;
  --custom-link-script=FILE look for symlinks using specified sed script;
Comment 4 Sir Raorn 2004-06-30 09:47:47 MSD
Sounds reasonable.

What about $NAME substitution?
Comment 5 Sir Raorn 2004-06-30 11:38:06 MSD
Oops.  According to /usr/lib/rpm/find-lang from rpm-4.0.4-alt40:


Argument is a sed script, not file.

To allow $NAME expansion following changes could be applied to FindLang():

    local script
    if [ -n "$CUSTOM_XXX_SCRIPT" ]; then
        eval "script=\"$CUSTOM_XXX_SCRIPT\""
        find "$TOPDIR" -type XXX |
            sed -e "s:$TOPDIR::" -e "$script" |
            grep -v '^$' >> "$OUTFILE" ||:
Comment 6 Dmitry V. Levin 2004-06-30 14:50:27 MSD
Я имел в виду -f, а написал -e и не проверил...

Ну так что,
sed -e "s:$TOPDIR::" -f "$CUSTOM_XXX_SCRIPT" пойдёт?
Comment 7 Sir Raorn 2004-06-30 15:45:18 MSD
В принципе - да. Огорчает неиспользование $NAME, но думаю это можно решить
другим способом, на уровне спекфайла.
Comment 8 Dmitry V. Levin 2005-10-10 18:09:29 MSD
Добавлено в 4.0.4-alt40, исправлено в 4.0.4-alt42.