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:53:36 +0000 |
commit | c2a7c008e17248edaf454c0911fcbb6acc513e5e (patch) | |
tree | b27bab197d7c033de0d707939ebd68a4f695a07a /meta/lib/oe | |
parent | c381ca72437ab097cd04db63bfb6fb1e13880223 (diff) | |
download | poky-c2a7c008e17248edaf454c0911fcbb6acc513e5e.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.
(From OE-Core rev: 0ffc7cf01225743789ac30dd325fca05b9203be1)
Signed-off-by: Jonathan GUILLOT <jonathan@joggee.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe')
-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): | |||
639 | 639 | ||
640 | packages = (d.getVar('PACKAGES') or "").split() | 640 | packages = (d.getVar('PACKAGES') or "").split() |
641 | 641 | ||
642 | datadir = d.getVar('datadir') | ||
643 | if not datadir: | ||
644 | bb.note("datadir not defined") | ||
645 | return | ||
646 | |||
647 | dvar = d.getVar('PKGD') | 642 | dvar = d.getVar('PKGD') |
648 | pn = d.getVar('LOCALEBASEPN') | 643 | pn = d.getVar('LOCALEBASEPN') |
649 | 644 | ||
@@ -653,14 +648,20 @@ def split_locales(d): | |||
653 | except ValueError: | 648 | except ValueError: |
654 | locale_index = len(packages) | 649 | locale_index = len(packages) |
655 | 650 | ||
656 | localedir = os.path.join(dvar + datadir, 'locale') | 651 | localepaths = [] |
652 | locales = set() | ||
653 | for localepath in (d.getVar('LOCALE_PATHS') or "").split(): | ||
654 | localedir = dvar + localepath | ||
655 | if cpath.isdir(localedir): | ||
656 | locales.update(os.listdir(localedir)) | ||
657 | localepaths.append(localepath) | ||
658 | else: | ||
659 | bb.debug(1, "No locale files in %s" % localepath) | ||
657 | 660 | ||
658 | if not cpath.isdir(localedir): | 661 | if len(locales) == 0: |
659 | bb.debug(1, "No locale files in this package") | 662 | bb.debug(1, "No locale files in this package") |
660 | return | 663 | return |
661 | 664 | ||
662 | locales = os.listdir(localedir) | ||
663 | |||
664 | summary = d.getVar('SUMMARY') or pn | 665 | summary = d.getVar('SUMMARY') or pn |
665 | description = d.getVar('DESCRIPTION') or "" | 666 | description = d.getVar('DESCRIPTION') or "" |
666 | locale_section = d.getVar('LOCALE_SECTION') | 667 | locale_section = d.getVar('LOCALE_SECTION') |
@@ -670,7 +671,10 @@ def split_locales(d): | |||
670 | pkg = pn + '-locale-' + ln | 671 | pkg = pn + '-locale-' + ln |
671 | packages.insert(locale_index, pkg) | 672 | packages.insert(locale_index, pkg) |
672 | locale_index += 1 | 673 | locale_index += 1 |
673 | d.setVar('FILES:' + pkg, os.path.join(datadir, 'locale', l)) | 674 | files = [] |
675 | for localepath in localepaths: | ||
676 | files.append(os.path.join(localepath, l)) | ||
677 | d.setVar('FILES:' + pkg, " ".join(files)) | ||
674 | d.setVar('RRECOMMENDS:' + pkg, '%svirtual-locale-%s' % (mlprefix, ln)) | 678 | d.setVar('RRECOMMENDS:' + pkg, '%svirtual-locale-%s' % (mlprefix, ln)) |
675 | d.setVar('RPROVIDES:' + pkg, '%s-locale %s%s-translation' % (pn, mlprefix, ln)) | 679 | d.setVar('RPROVIDES:' + pkg, '%s-locale %s%s-translation' % (pn, mlprefix, ln)) |
676 | d.setVar('SUMMARY:' + pkg, '%s - %s translations' % (summary, l)) | 680 | d.setVar('SUMMARY:' + pkg, '%s - %s translations' % (summary, l)) |