commit:     031ac62b1e9848313ab5285698757dcc79f7f6e3
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug  1 21:11:54 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Aug  2 15:43:39 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=031ac62b

sys-libs/glibc: backport various ebuild fixes to <=2.36-r8

This commit applies several quality improvements to the glibc-2.36-r8
ebuild and its predecessors. These improvements are described herewith.

Refrain from specifying the --inplace-glibc option to locale-gen(1),
fixing builds for which the "compile-locales" USE flag is in effect.

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.

Refrain from specifying the --jobs option to locale-gen(1) in the case
that the value of the 'EMERGE_FROM' variable is "binary".

As regards the pkg_postinst() function of the glibc-2.19-r3 ebuild,
check whether the value of the 'ROOT' variable is empty rather than
non-empty, just as all of the other ebuilds do.

See-also: e133de5ee597abf391f5ea3d13e1d077a40a2165
Closes: https://bugs.gentoo.org/915629
Bug: https://bugs.gentoo.org/736794
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/glibc/glibc-2.19-r3.ebuild  | 40 +++++++++++++++++++++++---------
 sys-libs/glibc/glibc-2.31-r7.ebuild  | 44 ++++++++++++++++++++----------------
 sys-libs/glibc/glibc-2.32-r8.ebuild  | 44 ++++++++++++++++++++----------------
 sys-libs/glibc/glibc-2.33-r14.ebuild | 44 ++++++++++++++++++++----------------
 sys-libs/glibc/glibc-2.34-r14.ebuild | 44 ++++++++++++++++++++----------------
 sys-libs/glibc/glibc-2.35-r11.ebuild | 44 ++++++++++++++++++++----------------
 sys-libs/glibc/glibc-2.36-r8.ebuild  | 44 ++++++++++++++++++++----------------
 7 files changed, 173 insertions(+), 131 deletions(-)

diff --git a/sys-libs/glibc/glibc-2.19-r3.ebuild 
b/sys-libs/glibc/glibc-2.19-r3.ebuild
index 7d492b72364a..275cfa3d70e9 100644
--- a/sys-libs/glibc/glibc-2.19-r3.ebuild
+++ b/sys-libs/glibc/glibc-2.19-r3.ebuild
@@ -1036,16 +1036,30 @@ src_test() {
 }
 
 run_locale_gen() {
-       # if the host locales.gen contains no entries, we'll install everything
-       local root="$1"
-       local locale_list="${root%/}/etc/locale.gen"
-       if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
-               ewarn "Generating all locales; edit /etc/locale.gen to save 
time/space"
-               locale_list="${root%/}/usr/share/i18n/SUPPORTED"
+       local prefix=$1 user_config config
+       local -a localegen_args
+
+       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
 
-       locale-gen --jobs $(makeopts_jobs) --config "${locale_list}" \
-               --destdir "${root}"
+       localegen_args=( --config "${config}" --destdir "${prefix}" )
+
+       # 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
+
+       printf 'Executing: locale-gen %s\n' "${localegen_args[*]@Q}" >&2
+       locale-gen "${localegen_args[@]}"
 }
 
 glibc_do_src_install() {
@@ -1219,7 +1233,9 @@ glibc_do_src_install() {
 
        # Generate all locales if this is a native build as locale generation
        if use compile-locales && ! is_crosscompile ; then
-               run_locale_gen "${ED}"
+               if ! run_locale_gen "${ED}"; then
+                       die "locale-gen(1) unexpectedly failed during the 
${EBUILD_PHASE_FUNC} phase"
+               fi
        fi
 }
 
@@ -1311,8 +1327,10 @@ pkg_postinst() {
                "${EROOT}"/usr/sbin/iconvconfig --prefix="${ROOT}/"
        fi
 
-       if ! is_crosscompile && [[ -n ${ROOT} ]] ; then
-               use compile-locales || run_locale_gen "${EROOT}/"
+       if ! is_crosscompile && [[ -z ${ROOT} ]] ; then
+               if ! use compile-locales && ! run_locale_gen "${EROOT}"; then
+                       ewarn "locale-gen(1) unexpectedly failed during the 
${EBUILD_PHASE_FUNC} phase"
+               fi
        fi
 
        # Check for sanity of /etc/nsswitch.conf, take 2

diff --git a/sys-libs/glibc/glibc-2.31-r7.ebuild 
b/sys-libs/glibc/glibc-2.31-r7.ebuild
index 7df8f5816447..8ec824d2fdcc 100644
--- a/sys-libs/glibc/glibc-2.31-r7.ebuild
+++ b/sys-libs/glibc/glibc-2.31-r7.ebuild
@@ -1174,30 +1174,30 @@ src_test() {
 }
 
 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 localegen_args
 
-       if [[ "${root}" == "--inplace-glibc" ]] ; then
-               inplace="--inplace-glibc"
-               root="$2"
-       fi
+       config="${prefix}/usr/share/i18n/SUPPORTED"
+       user_config="${prefix}/etc/locale.gen"
 
-       local locale_list="${root}/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
 
-       pushd "${ED}"/$(get_libdir) >/dev/null
+       localegen_args=( --config "${config}" --destdir "${prefix}" )
 
-       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"
+       # 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 $(makeopts_jobs) --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() {
@@ -1392,7 +1392,9 @@ glibc_do_src_install() {
 
        # 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 ! run_locale_gen "${ED%/}"; then
+                       die "locale-gen(1) unexpectedly failed during the 
${EBUILD_PHASE_FUNC} phase"
+               fi
                sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i 
"${ED}"/usr/sbin/locale-gen || die
        fi
 }
@@ -1491,7 +1493,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
 
        # Check for sanity of /etc/nsswitch.conf, take 2

diff --git a/sys-libs/glibc/glibc-2.32-r8.ebuild 
b/sys-libs/glibc/glibc-2.32-r8.ebuild
index 656ad5161a27..c44f933c4c8f 100644
--- a/sys-libs/glibc/glibc-2.32-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.32-r8.ebuild
@@ -1203,30 +1203,30 @@ src_test() {
 }
 
 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 localegen_args
 
-       if [[ "${root}" == "--inplace-glibc" ]] ; then
-               inplace="--inplace-glibc"
-               root="$2"
-       fi
+       config="${prefix}/usr/share/i18n/SUPPORTED"
+       user_config="${prefix}/etc/locale.gen"
 
-       local locale_list="${root}/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
 
-       pushd "${ED}"/$(get_libdir) >/dev/null
+       localegen_args=( --config "${config}" --destdir "${prefix}" )
 
-       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"
+       # 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 $(makeopts_jobs) --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() {
@@ -1404,7 +1404,9 @@ glibc_do_src_install() {
 
        # 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 ! run_locale_gen "${ED%/}"; then
+                       die "locale-gen(1) unexpectedly failed during the 
${EBUILD_PHASE_FUNC} phase"
+               fi
                sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i 
"${ED}"/usr/sbin/locale-gen || die
        fi
 }
@@ -1509,7 +1511,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
 
        # Check for sanity of /etc/nsswitch.conf, take 2

diff --git a/sys-libs/glibc/glibc-2.33-r14.ebuild 
b/sys-libs/glibc/glibc-2.33-r14.ebuild
index 5e23df0069e8..192948714461 100644
--- a/sys-libs/glibc/glibc-2.33-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.33-r14.ebuild
@@ -1225,30 +1225,30 @@ src_test() {
 }
 
 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 localegen_args
 
-       if [[ "${root}" == "--inplace-glibc" ]] ; then
-               inplace="--inplace-glibc"
-               root="$2"
-       fi
+       config="${prefix}/usr/share/i18n/SUPPORTED"
+       user_config="${prefix}/etc/locale.gen"
 
-       local locale_list="${root%/}/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
 
-       pushd "${ED}"/$(get_libdir) >/dev/null
+       localegen_args=( --config "${config}" --destdir "${prefix}" )
 
-       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"
+       # 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 $(makeopts_jobs) --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() {
@@ -1453,7 +1453,9 @@ glibc_do_src_install() {
 
        # 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 ! run_locale_gen "${ED%/}"; then
+                       die "locale-gen(1) unexpectedly failed during the 
${EBUILD_PHASE_FUNC} phase"
+               fi
                sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i 
"${ED}"/usr/sbin/locale-gen || die
        fi
 }
@@ -1574,7 +1576,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.34-r14.ebuild 
b/sys-libs/glibc/glibc-2.34-r14.ebuild
index e23b9ae35e9c..93da806cc979 100644
--- a/sys-libs/glibc/glibc-2.34-r14.ebuild
+++ b/sys-libs/glibc/glibc-2.34-r14.ebuild
@@ -1246,30 +1246,30 @@ src_test() {
 }
 
 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 localegen_args
 
-       if [[ "${root}" == "--inplace-glibc" ]] ; then
-               inplace="--inplace-glibc"
-               root="$2"
-       fi
+       config="${prefix}/usr/share/i18n/SUPPORTED"
+       user_config="${prefix}/etc/locale.gen"
 
-       local locale_list="${root%/}/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
 
-       pushd "${ED}"/$(get_libdir) >/dev/null
+       localegen_args=( --config "${config}" --destdir "${prefix}" )
 
-       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"
+       # 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 $(makeopts_jobs) --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() {
@@ -1474,7 +1474,9 @@ glibc_do_src_install() {
 
        # 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 ! run_locale_gen "${ED%/}"; then
+                       die "locale-gen(1) unexpectedly failed during the 
${EBUILD_PHASE_FUNC} phase"
+               fi
                sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i 
"${ED}"/usr/sbin/locale-gen || die
        fi
 }
@@ -1595,7 +1597,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.35-r11.ebuild 
b/sys-libs/glibc/glibc-2.35-r11.ebuild
index 0c2aec0025e0..b61d907c813b 100644
--- a/sys-libs/glibc/glibc-2.35-r11.ebuild
+++ b/sys-libs/glibc/glibc-2.35-r11.ebuild
@@ -1254,30 +1254,30 @@ src_test() {
 }
 
 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 localegen_args
 
-       if [[ "${root}" == "--inplace-glibc" ]] ; then
-               inplace="--inplace-glibc"
-               root="$2"
-       fi
+       config="${prefix}/usr/share/i18n/SUPPORTED"
+       user_config="${prefix}/etc/locale.gen"
 
-       local locale_list="${root%/}/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
 
-       pushd "${ED}"/$(get_libdir) >/dev/null
+       localegen_args=( --config "${config}" --destdir "${prefix}" )
 
-       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"
+       # 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 $(makeopts_jobs) --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() {
@@ -1482,7 +1482,9 @@ glibc_do_src_install() {
 
        # 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 ! run_locale_gen "${ED%/}"; then
+                       die "locale-gen(1) unexpectedly failed during the 
${EBUILD_PHASE_FUNC} phase"
+               fi
                sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i 
"${ED}"/usr/sbin/locale-gen || die
        fi
 }
@@ -1603,7 +1605,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.36-r8.ebuild 
b/sys-libs/glibc/glibc-2.36-r8.ebuild
index cb6ddba38eb7..5df7eb487f16 100644
--- a/sys-libs/glibc/glibc-2.36-r8.ebuild
+++ b/sys-libs/glibc/glibc-2.36-r8.ebuild
@@ -1284,30 +1284,30 @@ src_test() {
 }
 
 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 localegen_args
 
-       if [[ "${root}" == "--inplace-glibc" ]] ; then
-               inplace="--inplace-glibc"
-               root="$2"
-       fi
+       config="${prefix}/usr/share/i18n/SUPPORTED"
+       user_config="${prefix}/etc/locale.gen"
 
-       local locale_list="${root%/}/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
 
-       pushd "${ED}"/$(get_libdir) >/dev/null
+       localegen_args=( --config "${config}" --destdir "${prefix}" )
 
-       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"
+       # 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 $(makeopts_jobs) --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() {
@@ -1523,7 +1523,9 @@ glibc_do_src_install() {
 
        # 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 ! run_locale_gen "${ED%/}"; then
+                       die "locale-gen(1) unexpectedly failed during the 
${EBUILD_PHASE_FUNC} phase"
+               fi
                sed -e 's:COMPILED_LOCALES="":COMPILED_LOCALES="1":' -i 
"${ED}"/usr/sbin/locale-gen || die
        fi
 }
@@ -1644,7 +1646,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

Reply via email to