| Summary: | find-lang uses hardcoded path patterns | ||
|---|---|---|---|
| Product: | Sisyphus | Reporter: | Sir Raorn <raorn> |
| Component: | rpm-build | Assignee: | placeholder <placeholder> |
| Status: | CLOSED FIXED | QA Contact: | qa-sisyphus |
| Severity: | enhancement | ||
| Priority: | P2 | CC: | arseny, glebfm, imz, ldv, placeholder, vt |
| Version: | unstable | ||
| Hardware: | all | ||
| OS: | Linux | ||
Please suggest some syntax. I think simplest way is to allow packager provide his own sed rules:
FindLang(){
...
if [ -n "$FIND_CUSTOM" ]; then
find "$TOPDIR" -type f |sed '
s:'"$TOPDIR"'::
<user-defined rules goes here>
' |grep -v '^$' >> "$OUTFILE" ||:
fi
...
}
Maybe, different ruless for different file types (d, f, l).
Example:
%add_custom_find_lang
's:\(.*/share/vim/lang/\)\([^/_]\+\)\(.*vim\.mo$\):%%lang(\2) \1\2\3:'
%add_custom_find_lang 's:^\([^%%].*\)::'
...
%find_lang --custom %name
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; ? Sounds reasonable. What about $NAME substitution? Oops. According to /usr/lib/rpm/find-lang from rpm-4.0.4-alt40:
s/FILE/CODE/
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" ||:
Я имел в виду -f, а написал -e и не проверил... Ну так что, sed -e "s:$TOPDIR::" -f "$CUSTOM_XXX_SCRIPT" пойдёт? В принципе - да. Огорчает неиспользование $NAME, но думаю это можно решить другим способом, на уровне спекфайла. Добавлено в 4.0.4-alt40, исправлено в 4.0.4-alt42. |
/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 name.