On Wed, Dec 13, 2023 at 7:07 AM Jonathan GUILLOT <[email protected]> wrote:
>
> Some packages may contain localized files not located in
> /usr/share/locale. This new variables allows to add these directories in
> dedicated locale packages.

I think using _ to separate the words would make it more readable so
call it LOCALE_EXTRA_PATHS or something.
secondly, it needs to be documented as well.

>
> Signed-off-by: Jonathan GUILLOT <[email protected]>
> ---
>  meta/lib/oe/package.py | 23 ++++++++++++++++++-----
>  1 file changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
> index 2f7a50e144..fc8b20324e 100644
> --- a/meta/lib/oe/package.py
> +++ b/meta/lib/oe/package.py
> @@ -653,24 +653,37 @@ def split_locales(d):
>      except ValueError:
>          locale_index = len(packages)
>
> -    localedir = os.path.join(dvar + datadir, 'locale')
> +    localedirs = [os.path.join(dvar + datadir, 'locale')]
>
> -    if not cpath.isdir(localedir):
> +    for localedir in (d.getVar('LOCALEEXTRADIRS') or "").split():
> +        localedirs.append(dvar + localedir)
> +
> +    locales = set()
> +    locale_found = False
> +    for localedir in localedirs:
> +        if cpath.isdir(localedir):
> +            locale_found = True
> +            locales.update(os.listdir(localedir))
> +
> +    if not locale_found:
>          bb.debug(1, "No locale files in this package")
>          return
>
> -    locales = os.listdir(localedir)
> -
>      summary = d.getVar('SUMMARY') or pn
>      description = d.getVar('DESCRIPTION') or ""
>      locale_section = d.getVar('LOCALE_SECTION')
>      mlprefix = d.getVar('MLPREFIX') or ""
> +    dvar_len = len(dvar)
>      for l in sorted(locales):
>          ln = legitimize_package_name(l)
>          pkg = pn + '-locale-' + ln
>          packages.insert(locale_index, pkg)
>          locale_index += 1
> -        d.setVar('FILES:' + pkg, os.path.join(datadir, 'locale', l))
> +        files = []
> +        for localedir in localedirs:
> +            # Remove dvar prefix
> +            files.append(os.path.join(localedir[dvar_len:], l))
> +        d.setVar('FILES:' + pkg, " ".join(files))
>          d.setVar('RRECOMMENDS:' + pkg, '%svirtual-locale-%s' % (mlprefix, 
> ln))
>          d.setVar('RPROVIDES:' + pkg, '%s-locale %s%s-translation' % (pn, 
> mlprefix, ln))
>          d.setVar('SUMMARY:' + pkg, '%s - %s translations' % (summary, l))
> --
> 2.43.0
>
>
>
> 
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#192320): 
https://lists.openembedded.org/g/openembedded-core/message/192320
Mute This Topic: https://lists.openembedded.org/mt/103150560/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to