commit: e133de5ee597abf391f5ea3d13e1d077a40a2165
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Jul 31 17:38:46 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug 2 15:43:33 2025 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e133de5e
sys-libs/glibc: add support for >=sys-apps/locale-gen-3 to >=2.37-r10
Presently, the gentoo package repository offers sys-apps/locale-gen-3.0,
a fully rewritten implementation of the locale-gen(1) utility which
addresses a great many issues of reliability and safety. However, this
new implementation is not yet supported by the sys-libs/glibc package.
For it to be supported, the ebuild must acknowledge the existence of the
new --prefix option, which effectively supplants the --destdir option.
Indeed, the new implementation no longer supports the --destdir option,
partly because the behaviour of both options isn't wholly identical.
Add support for >=sys-apps/locale-gen-3 by having the run_locale_gen()
function determine the version of locale-gen that is installed. In the
event that is found to be 3.0 or greater, only the --prefix and --jobs
options may be specified. In addition to making this necessary change,
some miscellaneous improvements have been made to the ebuilds. These
improvements are described herewith.
As regards the pkg_postinst() function, raise a warning if locale-gen(1)
does not exit successfully.
As regards the glibc_do_src_install() function, die if locale-gen(1)
does not exit successfully. There is no sense in allowing for the
package to be built without an integrated locale archive in the case
that USE="compile-locales" is in effect.
As regards the run_locale_gen() function, use the read builtin to
consume no more than a single line of output from "locale-gen --list".
To do is more efficient and produces less noise if PORTAGE_DEBUG=1 be
enabled. Also, use the ${param@Q} form of expansion to unambiguously
show how the locale-gen command has been composed before executing.
Refrain from specifying the --inplace-glibc option in the case that
<sys-apps/locale-gen-3 is found. It causes locale-gen(1) to fail because
the utility expects to be able to find the linux loader by matching
against "ld-*.so" as a glob, whereas it now has a suffix of ".so.1" or
".so.2", depending on the architecture. To address the bug directly was
considered as being unnecessary because:
- the effort is better spent in keywording >=sys-apps/locale-gen-3
- =sys-apps/locale-gen-3.0 dispenses with the --inplace-glibc option
Finally, it should be noted that =sys-apps/locale-gen-3.0 is
incompatible with the "compile-locales" USE flag, owing to a bug that
will be addressed by its next release.
Bug: https://bugs.gentoo.org/945269
Closes: https://bugs.gentoo.org/915629
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>
sys-libs/glibc/glibc-2.37-r10.ebuild | 56 ++++++++++++++++++------------------
sys-libs/glibc/glibc-2.38-r13.ebuild | 56 ++++++++++++++++++------------------
sys-libs/glibc/glibc-2.39-r11.ebuild | 56 ++++++++++++++++++------------------
sys-libs/glibc/glibc-2.40-r11.ebuild | 56 ++++++++++++++++++------------------
sys-libs/glibc/glibc-2.41-r4.ebuild | 56 ++++++++++++++++++------------------
sys-libs/glibc/glibc-2.42.ebuild | 56 ++++++++++++++++++------------------
sys-libs/glibc/glibc-9999.ebuild | 56 ++++++++++++++++++------------------
7 files changed, 196 insertions(+), 196 deletions(-)
diff --git a/sys-libs/glibc/glibc-2.37-r10.ebuild
b/sys-libs/glibc/glibc-2.37-r10.ebuild
index e323ee8ae32d..14ea48d6eefd 100644
--- a/sys-libs/glibc/glibc-2.37-r10.ebuild
+++ b/sys-libs/glibc/glibc-2.37-r10.ebuild
@@ -1295,38 +1295,36 @@ src_test() {
# src_install
run_locale_gen() {
- # if the host locales.gen contains no entries, we'll install everything
- local root="$1"
- local inplace=""
+ local prefix=$1 user_config config
+ local -a hasversion_opts localegen_args
- if [[ "${root}" == "--inplace-glibc" ]] ; then
- inplace="--inplace-glibc"
- root="$2"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ hasversion_opts=( -b )
fi
- local locale_list="${root%/}/etc/locale.gen"
-
- pushd "${ED}"/$(get_libdir) >/dev/null
-
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
- [[ -z ${inplace} ]] && ewarn "Generating all locales; edit
/etc/locale.gen to save time/space"
- locale_list="${root%/}/usr/share/i18n/SUPPORTED"
+ if has_version "${hasversion_opts[@]}" '>=sys-apps/locale-gen-3'; then
+ localegen_args=( --prefix "${prefix}" )
+ else
+ config="${prefix}/usr/share/i18n/SUPPORTED"
+ user_config="${prefix}/etc/locale.gen"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ # For USE=compile-locales, all locales should be built.
+ mkdir -p -- "${prefix}/usr/lib/locale" || die
+ elif locale-gen --list --config "${user_config}" | read -r; then
+ config=${user_config}
+ fi
+ localegen_args=( --config "${config}" --destdir "${prefix}" )
fi
- # bug 736794: we need to be careful with the parallelization... the
number of
- # processors saved in the environment of a binary package may differ
strongly
- # from the number of processes available during postinst
- local mygenjobs="$(makeopts_jobs)"
- if [[ "${EMERGE_FROM}" == "binary" ]] ; then
- mygenjobs="$(nproc)"
+ # bug 736794: we need to be careful with the parallelization... the
+ # number of processors saved in the environment of a binary package may
+ # differ strongly from the number of processes available during postinst
+ if [[ ${EMERGE_FROM} != binary ]]; then
+ localegen_args+=( --jobs "$(makeopts_jobs)" )
fi
- set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config
"${locale_list}" \
- --destdir "${root}"
- echo "$@"
- "$@"
-
- popd >/dev/null
+ printf 'Executing: locale-gen %s\n' "${localegen_args[*]@Q}" >&2
+ locale-gen "${localegen_args[@]}"
}
glibc_do_src_install() {
@@ -1539,8 +1537,8 @@ glibc_do_src_install() {
rm -f "${ED}"/etc/localtime
# Generate all locales if this is a native build as locale generation
- if use compile-locales && ! is_crosscompile ; then
- run_locale_gen --inplace-glibc "${ED}/"
+ if use compile-locales && ! is_crosscompile && ! run_locale_gen
"${ED}"; then
+ die "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
fi
}
@@ -1663,7 +1661,9 @@ pkg_postinst() {
fi
if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
- use compile-locales || run_locale_gen "${EROOT}/"
+ if ! use compile-locales && ! run_locale_gen "${EROOT}"; then
+ ewarn "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
+ fi
fi
upgrade_warning
diff --git a/sys-libs/glibc/glibc-2.38-r13.ebuild
b/sys-libs/glibc/glibc-2.38-r13.ebuild
index 5bba661e9e91..4bee7a911aea 100644
--- a/sys-libs/glibc/glibc-2.38-r13.ebuild
+++ b/sys-libs/glibc/glibc-2.38-r13.ebuild
@@ -1314,38 +1314,36 @@ src_test() {
# src_install
run_locale_gen() {
- # if the host locales.gen contains no entries, we'll install everything
- local root="$1"
- local inplace=""
+ local prefix=$1 user_config config
+ local -a hasversion_opts localegen_args
- if [[ "${root}" == "--inplace-glibc" ]] ; then
- inplace="--inplace-glibc"
- root="$2"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ hasversion_opts=( -b )
fi
- local locale_list="${root%/}/etc/locale.gen"
-
- pushd "${ED}"/$(get_libdir) >/dev/null
-
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
- [[ -z ${inplace} ]] && ewarn "Generating all locales; edit
/etc/locale.gen to save time/space"
- locale_list="${root%/}/usr/share/i18n/SUPPORTED"
+ if has_version "${hasversion_opts[@]}" '>=sys-apps/locale-gen-3'; then
+ localegen_args=( --prefix "${prefix}" )
+ else
+ config="${prefix}/usr/share/i18n/SUPPORTED"
+ user_config="${prefix}/etc/locale.gen"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ # For USE=compile-locales, all locales should be built.
+ mkdir -p -- "${prefix}/usr/lib/locale" || die
+ elif locale-gen --list --config "${user_config}" | read -r; then
+ config=${user_config}
+ fi
+ localegen_args=( --config "${config}" --destdir "${prefix}" )
fi
- # bug 736794: we need to be careful with the parallelization... the
number of
- # processors saved in the environment of a binary package may differ
strongly
- # from the number of processes available during postinst
- local mygenjobs="$(makeopts_jobs)"
- if [[ "${EMERGE_FROM}" == "binary" ]] ; then
- mygenjobs="$(nproc)"
+ # bug 736794: we need to be careful with the parallelization... the
+ # number of processors saved in the environment of a binary package may
+ # differ strongly from the number of processes available during postinst
+ if [[ ${EMERGE_FROM} != binary ]]; then
+ localegen_args+=( --jobs "$(makeopts_jobs)" )
fi
- set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config
"${locale_list}" \
- --destdir "${root}"
- echo "$@"
- "$@"
-
- popd >/dev/null
+ printf 'Executing: locale-gen %s\n' "${localegen_args[*]@Q}" >&2
+ locale-gen "${localegen_args[@]}"
}
glibc_do_src_install() {
@@ -1558,8 +1556,8 @@ glibc_do_src_install() {
rm -f "${ED}"/etc/localtime
# Generate all locales if this is a native build as locale generation
- if use compile-locales && ! is_crosscompile ; then
- run_locale_gen --inplace-glibc "${ED}/"
+ if use compile-locales && ! is_crosscompile && ! run_locale_gen
"${ED}"; then
+ die "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
fi
}
@@ -1708,7 +1706,9 @@ pkg_postinst() {
# window for the affected programs.
use loong && glibc_refresh_ldconfig
- use compile-locales || run_locale_gen "${EROOT}/"
+ if ! use compile-locales && ! run_locale_gen "${EROOT}"; then
+ ewarn "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
+ fi
fi
upgrade_warning
diff --git a/sys-libs/glibc/glibc-2.39-r11.ebuild
b/sys-libs/glibc/glibc-2.39-r11.ebuild
index 4b46bc6f4e34..b34df92b725a 100644
--- a/sys-libs/glibc/glibc-2.39-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.39-r11.ebuild
@@ -1322,38 +1322,36 @@ src_test() {
# src_install
run_locale_gen() {
- # if the host locales.gen contains no entries, we'll install everything
- local root="$1"
- local inplace=""
+ local prefix=$1 user_config config
+ local -a hasversion_opts localegen_args
- if [[ "${root}" == "--inplace-glibc" ]] ; then
- inplace="--inplace-glibc"
- root="$2"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ hasversion_opts=( -b )
fi
- local locale_list="${root%/}/etc/locale.gen"
-
- pushd "${ED}"/$(get_libdir) >/dev/null
-
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
- [[ -z ${inplace} ]] && ewarn "Generating all locales; edit
/etc/locale.gen to save time/space"
- locale_list="${root%/}/usr/share/i18n/SUPPORTED"
+ if has_version "${hasversion_opts[@]}" '>=sys-apps/locale-gen-3'; then
+ localegen_args=( --prefix "${prefix}" )
+ else
+ config="${prefix}/usr/share/i18n/SUPPORTED"
+ user_config="${prefix}/etc/locale.gen"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ # For USE=compile-locales, all locales should be built.
+ mkdir -p -- "${prefix}/usr/lib/locale" || die
+ elif locale-gen --list --config "${user_config}" | read -r; then
+ config=${user_config}
+ fi
+ localegen_args=( --config "${config}" --destdir "${prefix}" )
fi
- # bug 736794: we need to be careful with the parallelization... the
number of
- # processors saved in the environment of a binary package may differ
strongly
- # from the number of processes available during postinst
- local mygenjobs="$(makeopts_jobs)"
- if [[ "${EMERGE_FROM}" == "binary" ]] ; then
- mygenjobs="$(nproc)"
+ # bug 736794: we need to be careful with the parallelization... the
+ # number of processors saved in the environment of a binary package may
+ # differ strongly from the number of processes available during postinst
+ if [[ ${EMERGE_FROM} != binary ]]; then
+ localegen_args+=( --jobs "$(makeopts_jobs)" )
fi
- set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config
"${locale_list}" \
- --destdir "${root}"
- echo "$@"
- "$@"
-
- popd >/dev/null
+ printf 'Executing: locale-gen %s\n' "${localegen_args[*]@Q}" >&2
+ locale-gen "${localegen_args[@]}"
}
glibc_do_src_install() {
@@ -1568,8 +1566,8 @@ glibc_do_src_install() {
rm -f "${ED}"/etc/localtime
# Generate all locales if this is a native build as locale generation
- if use compile-locales && ! is_crosscompile ; then
- run_locale_gen --inplace-glibc "${ED}/"
+ if use compile-locales && ! is_crosscompile && ! run_locale_gen
"${ED}"; then
+ die "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
fi
}
@@ -1719,7 +1717,9 @@ pkg_postinst() {
# window for the affected programs.
use loong && glibc_refresh_ldconfig
- use compile-locales || run_locale_gen "${EROOT}/"
+ if ! use compile-locales && ! run_locale_gen "${EROOT}"; then
+ ewarn "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
+ fi
fi
upgrade_warning
diff --git a/sys-libs/glibc/glibc-2.40-r11.ebuild
b/sys-libs/glibc/glibc-2.40-r11.ebuild
index 07f8c01de0e8..3e94d2cd3212 100644
--- a/sys-libs/glibc/glibc-2.40-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.40-r11.ebuild
@@ -1302,38 +1302,36 @@ src_test() {
# src_install
run_locale_gen() {
- # if the host locales.gen contains no entries, we'll install everything
- local root="$1"
- local inplace=""
+ local prefix=$1 user_config config
+ local -a hasversion_opts localegen_args
- if [[ "${root}" == "--inplace-glibc" ]] ; then
- inplace="--inplace-glibc"
- root="$2"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ hasversion_opts=( -b )
fi
- local locale_list="${root%/}/etc/locale.gen"
-
- pushd "${ED}"/$(get_libdir) >/dev/null
-
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
- [[ -z ${inplace} ]] && ewarn "Generating all locales; edit
/etc/locale.gen to save time/space"
- locale_list="${root%/}/usr/share/i18n/SUPPORTED"
+ if has_version "${hasversion_opts[@]}" '>=sys-apps/locale-gen-3'; then
+ localegen_args=( --prefix "${prefix}" )
+ else
+ config="${prefix}/usr/share/i18n/SUPPORTED"
+ user_config="${prefix}/etc/locale.gen"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ # For USE=compile-locales, all locales should be built.
+ mkdir -p -- "${prefix}/usr/lib/locale" || die
+ elif locale-gen --list --config "${user_config}" | read -r; then
+ config=${user_config}
+ fi
+ localegen_args=( --config "${config}" --destdir "${prefix}" )
fi
- # bug 736794: we need to be careful with the parallelization... the
number of
- # processors saved in the environment of a binary package may differ
strongly
- # from the number of processes available during postinst
- local mygenjobs="$(makeopts_jobs)"
- if [[ "${EMERGE_FROM}" == "binary" ]] ; then
- mygenjobs="$(nproc)"
+ # bug 736794: we need to be careful with the parallelization... the
+ # number of processors saved in the environment of a binary package may
+ # differ strongly from the number of processes available during postinst
+ if [[ ${EMERGE_FROM} != binary ]]; then
+ localegen_args+=( --jobs "$(makeopts_jobs)" )
fi
- set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config
"${locale_list}" \
- --destdir "${root}"
- echo "$@"
- "$@"
-
- popd >/dev/null
+ printf 'Executing: locale-gen %s\n' "${localegen_args[*]@Q}" >&2
+ locale-gen "${localegen_args[@]}"
}
glibc_do_src_install() {
@@ -1548,8 +1546,8 @@ glibc_do_src_install() {
rm -f "${ED}"/etc/localtime
# Generate all locales if this is a native build as locale generation
- if use compile-locales && ! is_crosscompile ; then
- run_locale_gen --inplace-glibc "${ED}/"
+ if use compile-locales && ! is_crosscompile && ! run_locale_gen
"${ED}"; then
+ die "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
fi
}
@@ -1699,7 +1697,9 @@ pkg_postinst() {
# window for the affected programs.
use loong && glibc_refresh_ldconfig
- use compile-locales || run_locale_gen "${EROOT}/"
+ if ! use compile-locales && ! run_locale_gen "${EROOT}"; then
+ ewarn "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
+ fi
# If fixincludes was/is active for a particular GCC slot, we
# must refresh it. See bug #933282 and GCC's documentation:
diff --git a/sys-libs/glibc/glibc-2.41-r4.ebuild
b/sys-libs/glibc/glibc-2.41-r4.ebuild
index 867e5411657b..93a09f6448d3 100644
--- a/sys-libs/glibc/glibc-2.41-r4.ebuild
+++ b/sys-libs/glibc/glibc-2.41-r4.ebuild
@@ -1316,38 +1316,36 @@ src_test() {
# src_install
run_locale_gen() {
- # if the host locales.gen contains no entries, we'll install everything
- local root="$1"
- local inplace=""
+ local prefix=$1 user_config config
+ local -a hasversion_opts localegen_args
- if [[ "${root}" == "--inplace-glibc" ]] ; then
- inplace="--inplace-glibc"
- root="$2"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ hasversion_opts=( -b )
fi
- local locale_list="${root%/}/etc/locale.gen"
-
- pushd "${ED}"/$(get_libdir) >/dev/null
-
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
- [[ -z ${inplace} ]] && ewarn "Generating all locales; edit
/etc/locale.gen to save time/space"
- locale_list="${root%/}/usr/share/i18n/SUPPORTED"
+ if has_version "${hasversion_opts[@]}" '>=sys-apps/locale-gen-3'; then
+ localegen_args=( --prefix "${prefix}" )
+ else
+ config="${prefix}/usr/share/i18n/SUPPORTED"
+ user_config="${prefix}/etc/locale.gen"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ # For USE=compile-locales, all locales should be built.
+ mkdir -p -- "${prefix}/usr/lib/locale" || die
+ elif locale-gen --list --config "${user_config}" | read -r; then
+ config=${user_config}
+ fi
+ localegen_args=( --config "${config}" --destdir "${prefix}" )
fi
- # bug 736794: we need to be careful with the parallelization... the
number of
- # processors saved in the environment of a binary package may differ
strongly
- # from the number of processes available during postinst
- local mygenjobs="$(makeopts_jobs)"
- if [[ "${EMERGE_FROM}" == "binary" ]] ; then
- mygenjobs="$(nproc)"
+ # bug 736794: we need to be careful with the parallelization... the
+ # number of processors saved in the environment of a binary package may
+ # differ strongly from the number of processes available during postinst
+ if [[ ${EMERGE_FROM} != binary ]]; then
+ localegen_args+=( --jobs "$(makeopts_jobs)" )
fi
- set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config
"${locale_list}" \
- --destdir "${root}"
- echo "$@"
- "$@"
-
- popd >/dev/null
+ printf 'Executing: locale-gen %s\n' "${localegen_args[*]@Q}" >&2
+ locale-gen "${localegen_args[@]}"
}
glibc_do_src_install() {
@@ -1562,8 +1560,8 @@ glibc_do_src_install() {
rm -f "${ED}"/etc/localtime
# Generate all locales if this is a native build as locale generation
- if use compile-locales && ! is_crosscompile ; then
- run_locale_gen --inplace-glibc "${ED}/"
+ if use compile-locales && ! is_crosscompile && ! run_locale_gen
"${ED}"; then
+ die "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
fi
}
@@ -1713,7 +1711,9 @@ pkg_postinst() {
# window for the affected programs.
use loong && glibc_refresh_ldconfig
- use compile-locales || run_locale_gen "${EROOT}/"
+ if ! use compile-locales && ! run_locale_gen "${EROOT}"; then
+ ewarn "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
+ fi
# If fixincludes was/is active for a particular GCC slot, we
# must refresh it. See bug #933282 and GCC's documentation:
diff --git a/sys-libs/glibc/glibc-2.42.ebuild b/sys-libs/glibc/glibc-2.42.ebuild
index bbb2337cb544..8c57e3216423 100644
--- a/sys-libs/glibc/glibc-2.42.ebuild
+++ b/sys-libs/glibc/glibc-2.42.ebuild
@@ -1317,38 +1317,36 @@ src_test() {
# src_install
run_locale_gen() {
- # if the host locales.gen contains no entries, we'll install everything
- local root="$1"
- local inplace=""
+ local prefix=$1 user_config config
+ local -a hasversion_opts localegen_args
- if [[ "${root}" == "--inplace-glibc" ]] ; then
- inplace="--inplace-glibc"
- root="$2"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ hasversion_opts=( -b )
fi
- local locale_list="${root%/}/etc/locale.gen"
-
- pushd "${ED}"/$(get_libdir) >/dev/null
-
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
- [[ -z ${inplace} ]] && ewarn "Generating all locales; edit
/etc/locale.gen to save time/space"
- locale_list="${root%/}/usr/share/i18n/SUPPORTED"
+ if has_version "${hasversion_opts[@]}" '>=sys-apps/locale-gen-3'; then
+ localegen_args=( --prefix "${prefix}" )
+ else
+ config="${prefix}/usr/share/i18n/SUPPORTED"
+ user_config="${prefix}/etc/locale.gen"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ # For USE=compile-locales, all locales should be built.
+ mkdir -p -- "${prefix}/usr/lib/locale" || die
+ elif locale-gen --list --config "${user_config}" | read -r; then
+ config=${user_config}
+ fi
+ localegen_args=( --config "${config}" --destdir "${prefix}" )
fi
- # bug 736794: we need to be careful with the parallelization... the
number of
- # processors saved in the environment of a binary package may differ
strongly
- # from the number of processes available during postinst
- local mygenjobs="$(makeopts_jobs)"
- if [[ "${EMERGE_FROM}" == "binary" ]] ; then
- mygenjobs="$(nproc)"
+ # bug 736794: we need to be careful with the parallelization... the
+ # number of processors saved in the environment of a binary package may
+ # differ strongly from the number of processes available during postinst
+ if [[ ${EMERGE_FROM} != binary ]]; then
+ localegen_args+=( --jobs "$(makeopts_jobs)" )
fi
- set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config
"${locale_list}" \
- --destdir "${root}"
- echo "$@"
- "$@"
-
- popd >/dev/null
+ printf 'Executing: locale-gen %s\n' "${localegen_args[*]@Q}" >&2
+ locale-gen "${localegen_args[@]}"
}
glibc_do_src_install() {
@@ -1563,8 +1561,8 @@ glibc_do_src_install() {
rm -f "${ED}"/etc/localtime
# Generate all locales if this is a native build as locale generation
- if use compile-locales && ! is_crosscompile ; then
- run_locale_gen --inplace-glibc "${ED}/"
+ if use compile-locales && ! is_crosscompile && ! run_locale_gen
"${ED}"; then
+ die "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
fi
}
@@ -1714,7 +1712,9 @@ pkg_postinst() {
# window for the affected programs.
use loong && glibc_refresh_ldconfig
- use compile-locales || run_locale_gen "${EROOT}/"
+ if ! use compile-locales && ! run_locale_gen "${EROOT}"; then
+ ewarn "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
+ fi
# If fixincludes was/is active for a particular GCC slot, we
# must refresh it. See bug #933282 and GCC's documentation:
diff --git a/sys-libs/glibc/glibc-9999.ebuild b/sys-libs/glibc/glibc-9999.ebuild
index 10446c984609..0133b65ee20b 100644
--- a/sys-libs/glibc/glibc-9999.ebuild
+++ b/sys-libs/glibc/glibc-9999.ebuild
@@ -1318,38 +1318,36 @@ src_test() {
# src_install
run_locale_gen() {
- # if the host locales.gen contains no entries, we'll install everything
- local root="$1"
- local inplace=""
+ local prefix=$1 user_config config
+ local -a hasversion_opts localegen_args
- if [[ "${root}" == "--inplace-glibc" ]] ; then
- inplace="--inplace-glibc"
- root="$2"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ hasversion_opts=( -b )
fi
- local locale_list="${root%/}/etc/locale.gen"
-
- pushd "${ED}"/$(get_libdir) >/dev/null
-
- if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
- [[ -z ${inplace} ]] && ewarn "Generating all locales; edit
/etc/locale.gen to save time/space"
- locale_list="${root%/}/usr/share/i18n/SUPPORTED"
+ if has_version "${hasversion_opts[@]}" '>=sys-apps/locale-gen-3'; then
+ localegen_args=( --prefix "${prefix}" )
+ else
+ config="${prefix}/usr/share/i18n/SUPPORTED"
+ user_config="${prefix}/etc/locale.gen"
+ if [[ ${EBUILD_PHASE_FUNC} == src_install ]]; then
+ # For USE=compile-locales, all locales should be built.
+ mkdir -p -- "${prefix}/usr/lib/locale" || die
+ elif locale-gen --list --config "${user_config}" | read -r; then
+ config=${user_config}
+ fi
+ localegen_args=( --config "${config}" --destdir "${prefix}" )
fi
- # bug 736794: we need to be careful with the parallelization... the
number of
- # processors saved in the environment of a binary package may differ
strongly
- # from the number of processes available during postinst
- local mygenjobs="$(makeopts_jobs)"
- if [[ "${EMERGE_FROM}" == "binary" ]] ; then
- mygenjobs="$(nproc)"
+ # bug 736794: we need to be careful with the parallelization... the
+ # number of processors saved in the environment of a binary package may
+ # differ strongly from the number of processes available during postinst
+ if [[ ${EMERGE_FROM} != binary ]]; then
+ localegen_args+=( --jobs "$(makeopts_jobs)" )
fi
- set -- locale-gen ${inplace} --jobs "${mygenjobs}" --config
"${locale_list}" \
- --destdir "${root}"
- echo "$@"
- "$@"
-
- popd >/dev/null
+ printf 'Executing: locale-gen %s\n' "${localegen_args[*]@Q}" >&2
+ locale-gen "${localegen_args[@]}"
}
glibc_do_src_install() {
@@ -1564,8 +1562,8 @@ glibc_do_src_install() {
rm -f "${ED}"/etc/localtime
# Generate all locales if this is a native build as locale generation
- if use compile-locales && ! is_crosscompile ; then
- run_locale_gen --inplace-glibc "${ED}/"
+ if use compile-locales && ! is_crosscompile && ! run_locale_gen
"${ED}"; then
+ die "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
fi
}
@@ -1715,7 +1713,9 @@ pkg_postinst() {
# window for the affected programs.
use loong && glibc_refresh_ldconfig
- use compile-locales || run_locale_gen "${EROOT}/"
+ if ! use compile-locales && ! run_locale_gen "${EROOT}"; then
+ ewarn "locale-gen(1) unexpectedly failed during the
${EBUILD_PHASE_FUNC} phase"
+ fi
# If fixincludes was/is active for a particular GCC slot, we
# must refresh it. See bug #933282 and GCC's documentation: