diff options
author | Jonathan GUILLOT <jonathan@joggee.fr> | 2023-12-06 16:03:47 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-14 13:52:20 +0000 |
commit | 0ffc7cf01225743789ac30dd325fca05b9203be1 (patch) | |
tree | d1a35e7b77978723f3e59e974e6526f6abbcf287 /meta/lib | |
parent | 108bc167ed0d43505af3140947a0ab79c89f0a7b (diff) | |
download | openembedded-core-0ffc7cf01225743789ac30dd325fca05b9203be1.tar.gz |
lib/oe/package: add LOCALE_PATHS to add define all locations for locales
Some packages may contain localized files not located in default path
${datadir}/locale. Add the new variable LOCALE_PATHS to allow a recipe
to define extra paths or even fully override the scanned directories.
LOCALE_PATHS is set at ${datadir}/locale by default to keep the exact
same behavior for the recipes which did not need modification.
Signed-off-by: Jonathan GUILLOT <jonathan@joggee.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/package.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py index cb6893f3c2..d1738d3b61 100644 --- a/meta/lib/oe/package.py +++ b/meta/lib/oe/package.py @@ -639,11 +639,6 @@ def split_locales(d): packages = (d.getVar('PACKAGES') or "").split() - datadir = d.getVar('datadir') - if not datadir: - bb.note("datadir not defined") - return - dvar = d.getVar('PKGD') pn = d.getVar('LOCALEBASEPN') @@ -653,14 +648,20 @@ def split_locales(d): except ValueError: locale_index = len(packages) - localedir = os.path.join(dvar + datadir, 'locale') + localepaths = [] + locales = set() + for localepath in (d.getVar('LOCALE_PATHS') or "").split(): + localedir = dvar + localepath + if cpath.isdir(localedir): + locales.update(os.listdir(localedir)) + localepaths.append(localepath) + else: + bb.debug(1, "No locale files in %s" % localepath) - if not cpath.isdir(localedir): + if len(locales) == 0: 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') @@ -670,7 +671,10 @@ def split_locales(d): pkg = pn + '-locale-' + ln packages.insert(locale_index, pkg) locale_index += 1 - d.setVar('FILES:' + pkg, os.path.join(datadir, 'locale', l)) + files = [] + for localepath in localepaths: + files.append(os.path.join(localepath, 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)) |