lib/oe/package: fix LOCALE_PATHS scan to create locale packages
v2 cover lib/oe/package: fix LOCALE_PATHS scan to create locale packages
Hi,
The main patch of the series ensures only the subdirectories of paths added to LOCALE_PATHS are scanned to construct the locale packages. Without the check, the CUPS recipe creates packages such as cups-locale-add-class.tmpl because of file /usr/share/cups/templates/add-class.tmpl existence.
New version now also includes a patch for the glibc-locale recipes and its /usr/share/locale/locale.alias file. Until now, the file was added to a package weirdly named glibc-locale-locale.alias package. It was automatically created by the split_locales() function during the do_package step. Now, even if the file is explictly included in a new glic-locale-alias package. Without such a patch, the glibc-locale recipe was also broken by the main LOCALE_PATHS fix.
Regards,
Jonathan GUILLOT
Jonathan GUILLOT (2):
glibc-locale: add an explicit dedicated package for locale.alias file lib/oe/package: fix LOCALE_PATHS scan to create locale packages
meta/conf/documentation.conf | 2 +- meta/lib/oe/package.py | 14 +++++++++----- meta/recipes-core/glibc/glibc-locale.inc | 3 ++- 3 files changed, 12 insertions(+), 7 deletions(-)
base-commit: 4c45f975310184a773b25b8e7d7ef50fba2f7bd6
Signature · 1 line
2.43.2
PATCH v2 1/2 glibc-locale: add an explicit dedicated package for locale.alias file
Until now, ${datadir}/locale/locale.alias file were automatically added to a weird glibc-locale-locale.alias package by split_locales() during do_package task.
Create an explicit package name in recipe for this file.
--- meta/recipes-core/glibc/glibc-locale.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-core/glibc/glibc-locale.inc +2 -1
@@ -28,7 +28,7 @@ LOCALE_GENERATION_WITH_CROSS-LOCALEDEF = "1" PROVIDES = "virtual/libc-locale" -PACKAGES = "localedef ${PN}-dbg" +PACKAGES = "localedef ${PN}-dbg ${LOCALEBASEPN}-locale-alias" PACKAGES_DYNAMIC = "^locale-base-.* \ ^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \
@@ -61,6 +61,7 @@ DESCRIPTION:localedef = "glibc: compile locale definition files" # Explicitly add ${MLPREFIX} for FILES:glibc-gconv. FILES:${MLPREFIX}glibc-gconv = "${libdir}/gconv/*" FILES:localedef = "${bindir}/localedef" +FILES:${LOCALEBASEPN}-locale-alias = "${datadir}/locale/locale.alias" LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
Signature · 1 line
2.43.2
PATCH v2 2/2 lib/oe/package: fix LOCALE_PATHS scan to create locale packages
In reply to Jonathan GUILLOTsplit_locales() must only check subdirectories in paths added to LOCALE_PATHS to avoid creating weird packages based on filenames also present in paths.
Without such a filter, cups recipe adding ${datadir}/cups/templates to LOCALE_PATHS creates the following incorrect packages:
- cups-locale-add-class.tmpl
- cups-locale-add-printer.tmpl
- cups-locale-admin.tmpl
--- meta/conf/documentation.conf | 2 +- meta/lib/oe/package.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-)
meta/conf/documentation.conf +1 -1
@@ -271,7 +271,7 @@ LICENSE_PATH[doc] = "Path to additional licenses used during the build." LINUX_KERNEL_TYPE[doc] = "Defines the kernel type to be used in assembling the configuration." LINUX_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." LINUX_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." -LOCALE_PATHS[doc] = "Whitespace separated list of paths that are scanned to construct locale packages. The list already contains ${datadir}/locale by default." +LOCALE_PATHS[doc] = "Whitespace separated list of paths that are scanned to construct locale packages. The list already contains ${datadir}/locale by default. Note that all subdirectories in these paths are assumed to be locales." LOCALE_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." LOG_DIR[doc] = "Specifies the directory to which the OpenEmbedded build system writes overall log files. The default directory is ${TMPDIR}/log"
meta/lib/oe/package.py +9 -5
@@ -652,11 +652,15 @@ def split_locales(d): 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): + bb.debug(1, 'No locale files in %s' % localepath) + continue + + localepaths.append(localepath) + with os.scandir(localedir) as it: + for entry in it: + if entry.is_dir(): + locales.add(entry.name) if len(locales) == 0: bb.debug(1, "No locale files in this package")
Signature · 1 line
2.43.2