summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan GUILLOT <jonathan@joggee.fr>2023-12-06 16:03:47 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-14 13:53:36 +0000
commitc2a7c008e17248edaf454c0911fcbb6acc513e5e (patch)
treeb27bab197d7c033de0d707939ebd68a4f695a07a
parentc381ca72437ab097cd04db63bfb6fb1e13880223 (diff)
downloadpoky-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>
-rw-r--r--meta/classes-global/package.bbclass1
-rw-r--r--meta/conf/documentation.conf1
-rw-r--r--meta/lib/oe/package.py24
3 files changed, 16 insertions, 10 deletions
diff --git a/meta/classes-global/package.bbclass b/meta/classes-global/package.bbclass
index f56bca3542..aa1eb5e901 100644
--- a/meta/classes-global/package.bbclass
+++ b/meta/classes-global/package.bbclass
@@ -335,6 +335,7 @@ python package_convert_pr_autoinc() {
335} 335}
336 336
337LOCALEBASEPN ??= "${PN}" 337LOCALEBASEPN ??= "${PN}"
338LOCALE_PATHS ?= "${datadir}/locale"
338 339
339python package_do_split_locales() { 340python package_do_split_locales() {
340 oe.package.split_locales(d) 341 oe.package.split_locales(d)
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf
index 486c62b6e8..90d8e82932 100644
--- a/meta/conf/documentation.conf
+++ b/meta/conf/documentation.conf
@@ -271,6 +271,7 @@ LICENSE_PATH[doc] = "Path to additional licenses used during the build."
271LINUX_KERNEL_TYPE[doc] = "Defines the kernel type to be used in assembling the configuration." 271LINUX_KERNEL_TYPE[doc] = "Defines the kernel type to be used in assembling the configuration."
272LINUX_VERSION[doc] = "The Linux version from kernel.org on which the Linux kernel image being built using the OpenEmbedded build system is based. You define this variable in the kernel recipe." 272LINUX_VERSION[doc] = "The Linux version from kernel.org on which the Linux kernel image being built using the OpenEmbedded build system is based. You define this variable in the kernel recipe."
273LINUX_VERSION_EXTENSION[doc] = "A string extension compiled into the version string of the Linux kernel built with the OpenEmbedded build system. You define this variable in the kernel recipe." 273LINUX_VERSION_EXTENSION[doc] = "A string extension compiled into the version string of the Linux kernel built with the OpenEmbedded build system. You define this variable in the kernel recipe."
274LOCALE_PATHS[doc] = "Whitespace separated list of paths that are scanned to construct locale packages. The list already contains ${datadir}/locale by default."
274LOCALE_UTF8_IS_DEFAULT[doc] = "If set, locale names are renamed such that those lacking an explicit encoding (e.g. en_US) will always be UTF-8, and non-UTF-8 encodings are renamed to, e.g., en_US.ISO-8859-1. Otherwise, the encoding is specified by glibc's SUPPORTED file. Not supported for precompiled locales." 275LOCALE_UTF8_IS_DEFAULT[doc] = "If set, locale names are renamed such that those lacking an explicit encoding (e.g. en_US) will always be UTF-8, and non-UTF-8 encodings are renamed to, e.g., en_US.ISO-8859-1. Otherwise, the encoding is specified by glibc's SUPPORTED file. Not supported for precompiled locales."
275LOG_DIR[doc] = "Specifies the directory to which the OpenEmbedded build system writes overall log files. The default directory is ${TMPDIR}/log" 276LOG_DIR[doc] = "Specifies the directory to which the OpenEmbedded build system writes overall log files. The default directory is ${TMPDIR}/log"
276 277
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))