commit:     d1ca6dabb7b7d8f474d7f95869c45b1b9a5f5e3f
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 17 04:03:31 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 18 15:50:24 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d1ca6dab

sys-apps/locale-gen: integrate the mkconfig util into 9999

The locale-gen repo now carries the mkconfig utility. It writes a sample
/etc/locale.gen file to standard output as a columnated list, consisting
only of UTF-8 locales supported by the installed version of glibc, with
comments indicating the languages and territories in plain English.

Have the src_install() function of the live ebuild take advantage of it.

[sam: Note that this introduces a BDEPEND (but not an RDEPEND) on
 dev-perl/File-Slurper. If this is unacceptable to someone, please file
 a bug explaining why and we can discuss.]

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/locale-gen/locale-gen-9999.ebuild | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/sys-apps/locale-gen/locale-gen-9999.ebuild 
b/sys-apps/locale-gen/locale-gen-9999.ebuild
index 45a38c7dfc25..b676a0c54f01 100644
--- a/sys-apps/locale-gen/locale-gen-9999.ebuild
+++ b/sys-apps/locale-gen/locale-gen-9999.ebuild
@@ -18,6 +18,10 @@ fi
 LICENSE="GPL-2"
 SLOT="0"
 
+BDEPEND="
+       >=dev-lang/perl-5.36
+       dev-perl/File-Slurper
+"
 RDEPEND="
        >=dev-lang/perl-5.36
        !<sys-libs/glibc-2.37-r3
@@ -27,6 +31,17 @@ src_install() {
        dosbin locale-gen
        doman *.[0-8]
        insinto /etc
-       doins locale.gen
+       {
+               cat <<-'EOF' &&
+               # This file defines which locales to incorporate into the glibc 
locale archive.
+               # See the locale.gen(5) and locale-gen(8) man pages for more 
details.
+
+               EOF
+               # Run the interpreter by name so as not to have to prefixify 
mkconfig.
+               perl mkconfig "${EROOT}"
+       } | newins - locale.gen
+       if (( PIPESTATUS[0] || PIPESTATUS[1] )); then
+               die "Failed to generate and/or install locale.gen"
+       fi
        keepdir /usr/lib/locale
 }

Reply via email to