<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>3244</bug_id>
          
          <creation_ts>2003-11-06 19:00:23 +0300</creation_ts>
          <short_desc>find-lang uses hardcoded path patterns</short_desc>
          <delta_ts>2008-06-13 12:15:56 +0400</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Development</classification>
          <product>Sisyphus</product>
          <component>rpm-build</component>
          <version>unstable</version>
          <rep_platform>all</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sir Raorn">raorn</reporter>
          <assigned_to name="Gleb F-Malinovskiy">glebfm</assigned_to>
          <cc>arseny</cc>
    
    <cc>glebfm</cc>
    
    <cc>imz</cc>
          
          <qa_contact>qa-sisyphus</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>10509</commentid>
    <comment_count>0</comment_count>
    <who name="Sir Raorn">raorn</who>
    <bug_when>2003-11-06 19:00:23 +0300</bug_when>
    <thetext>/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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15668</commentid>
    <comment_count>1</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2004-06-27 04:15:27 +0400</bug_when>
    <thetext>Please suggest some syntax.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15705</commentid>
    <comment_count>2</comment_count>
    <who name="Sir Raorn">raorn</who>
    <bug_when>2004-06-28 10:30:18 +0400</bug_when>
    <thetext>I think simplest way is to allow packager provide his own sed rules:

FindLang(){
...
    if [ -n &quot;$FIND_CUSTOM&quot; ]; then
        find &quot;$TOPDIR&quot; -type f |sed &apos;
s:&apos;&quot;$TOPDIR&quot;&apos;::
&lt;user-defined rules goes here&gt;
        &apos; |grep -v &apos;^$&apos; &gt;&gt; &quot;$OUTFILE&quot; ||:
    fi
...
}

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

Example:

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

...

%find_lang --custom %name</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15906</commentid>
    <comment_count>3</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2004-06-29 19:44:10 +0400</bug_when>
    <thetext>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;
?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15944</commentid>
    <comment_count>4</comment_count>
    <who name="Sir Raorn">raorn</who>
    <bug_when>2004-06-30 09:47:47 +0400</bug_when>
    <thetext>Sounds reasonable.

What about $NAME substitution?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15949</commentid>
    <comment_count>5</comment_count>
    <who name="Sir Raorn">raorn</who>
    <bug_when>2004-06-30 11:38:06 +0400</bug_when>
    <thetext>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 &quot;$CUSTOM_XXX_SCRIPT&quot; ]; then
        eval &quot;script=\&quot;$CUSTOM_XXX_SCRIPT\&quot;&quot;
        find &quot;$TOPDIR&quot; -type XXX |
            sed -e &quot;s:$TOPDIR::&quot; -e &quot;$script&quot; |
            grep -v &apos;^$&apos; &gt;&gt; &quot;$OUTFILE&quot; ||:
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15964</commentid>
    <comment_count>6</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2004-06-30 14:50:27 +0400</bug_when>
    <thetext>Я имел в виду -f, а написал -e и не проверил...

Ну так что,
sed -e &quot;s:$TOPDIR::&quot; -f &quot;$CUSTOM_XXX_SCRIPT&quot; пойдёт?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>15972</commentid>
    <comment_count>7</comment_count>
    <who name="Sir Raorn">raorn</who>
    <bug_when>2004-06-30 15:45:18 +0400</bug_when>
    <thetext>В принципе - да. Огорчает неиспользование $NAME, но думаю это можно решить
другим способом, на уровне спекфайла.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>31639</commentid>
    <comment_count>8</comment_count>
    <who name="Dmitry V. Levin">ldv</who>
    <bug_when>2005-10-10 18:09:29 +0400</bug_when>
    <thetext>Добавлено в 4.0.4-alt40, исправлено в 4.0.4-alt42.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>