Github messages for voidlinux
 help / color / mirror / Atom feed
From: ahesford <ahesford@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] glibc: clean up install, add C.UTF-8 by default
Date: Thu, 07 Mar 2024 01:49:00 +0100	[thread overview]
Message-ID: <20240307004900.31F91268E1@inbox.vuxu.org> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-49146@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1443 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages library-policeman
https://github.com/void-linux/void-packages/pull/49146

glibc: clean up install, add C.UTF-8 by default
We should really provide the `C.UTF-8` locale by default. I believe that the best way to do so is by removing it entirely from `/etc/default/libc-locales` processing and install it, as part of the main `glibc` package, in `/usr/lib/locales` like Arch does.

This currently trips the package linter, so either
- We can make an exception for glibc in the linter, or
- Rather than include the locale files in the package, we can add an `INSTALL` script to the base package to write the `C.utf-8` locale outside of an archive, where it will always be reachable.

I favor the first because it is less wasteful; why should everybody have to generate a locale that we expect everybody to have available by default?

A third option is to modify the `glibc-locales` `INSTALL` script to either add a separate, non-archived `C.utf-8` locale directory, or just ensure that `C.UTF-8` is always included in the locale processing. Both seem even more kludgey than doing the right thing by default.

Thoughts? @void-linux/pkg-committers 

While I was at it, I cleaned up the install function a bit.

A patch file from https://github.com/void-linux/void-packages/pull/49146.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-library-policeman-49146.patch --]
[-- Type: text/x-diff, Size: 4113 bytes --]

From 5b1976b6792005d43a020d9d02fa93c94dbfe2c4 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 6 Mar 2024 08:46:43 -0500
Subject: [PATCH 1/2] glibc: clean up install, add C.UTF-8 locale by default

---
 srcpkgs/glibc/template | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/srcpkgs/glibc/template b/srcpkgs/glibc/template
index abd2ad846c9de1..6faee3db8133ff 100644
--- a/srcpkgs/glibc/template
+++ b/srcpkgs/glibc/template
@@ -1,7 +1,7 @@
 # Template file for 'glibc'
 pkgname=glibc
 version=2.38
-revision=5
+revision=6
 bootstrap=yes
 short_desc="GNU C library"
 maintainer="Enno Boland <gottox@voidlinux.org>"
@@ -123,23 +123,38 @@ do_build() {
 	env LDFLAGS.so="-Wl,--hash-style=both" LDFLAGS-rtld="-Wl,--hash-style=both" \
 		make ${makejobs}
 }
+
 do_install() {
 	vlicense LICENSES
 	# Create DESTDIR/etc/ld.so.conf
 	mkdir -p ${DESTDIR}/etc
 	echo "include /etc/ld.so.conf.d/*.conf" > ${DESTDIR}/etc/ld.so.conf
 
-	cd build
-	make install_root=${DESTDIR} install
+	( cd build && make install_root=${DESTDIR} install )
+
+	# The C.UTF-8 locale should always be available
+	if [ -z "${CROSS_BUILD}" ]; then
+		make -C localedata DESTDIR="${DESTDIR}" \
+			objdir="../build" install-files-C.UTF-8/UTF-8
+	else
+		local endian=
+		case "$XBPS_TARGET_ENDIAN" in
+			be) endian="--big-endian" ;;
+			le) endian="--little-endian" ;;
+		esac
+
+		vmkdir usr/lib/locale
+		I18NPATH=./localedata localedef --prefix="${DESTDIR}" ${endian} \
+			-i C -f UTF-8 --no-archive "${DESTDIR}/usr/lib/locale/C.utf8"
+	fi
 
 	# create /etc/default/libc-locales
 	vinstall ${FILESDIR}/libc-locales 644 etc/default
-	cp ${wrksrc}/localedata/SUPPORTED ${wrksrc}/build
-	sed -i	-e "s|/| |g" \
+	sed -e "s|/| |g" \
 		-e 's|\\| |g' \
 		-e "s|SUPPORTED-LOCALES=||" \
-		-e "s|^|#|g" ${wrksrc}/build/SUPPORTED
-	cat ${wrksrc}/build/SUPPORTED >> ${DESTDIR}/etc/default/libc-locales
+		-e "s|^|#|g" localedata/SUPPORTED \
+			>> "${DESTDIR}/etc/default/libc-locales"
 
 	# ldd is a bash script, so make it run as such.
 	replace_interpreter bash ${DESTDIR}/usr/bin/ldd
@@ -162,7 +177,7 @@ do_install() {
 		armv?l) ln -sfr ${DESTDIR}/usr/lib/ld-linux-armhf.so.3 ${DESTDIR}/usr/lib/ld-linux.so.3;;
 	esac
 
-	vinstall ${wrksrc}/posix/gai.conf 644 etc
+	vinstall posix/gai.conf 644 etc
 	rm -rf ${DESTDIR}/var/db
 	# Remove tzselect and z{dump,ic}, provided by tzutils.
 	rm -f ${DESTDIR}/usr/bin/tzselect
@@ -185,6 +200,7 @@ glibc-devel_package() {
 		fi
 	}
 }
+
 glibc-locales_package() {
 	conf_files="/etc/default/libc-locales"
 	short_desc+=" - locale data files"
@@ -194,6 +210,7 @@ glibc-locales_package() {
 		vmove usr/share/locale
 	}
 }
+
 nscd_package() {
 	conf_files="/etc/nscd.conf"
 	short_desc+=" - Name Service Cache Daemon"

From 508f007e9464456a1bd7ec9716572330f645b230 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Wed, 6 Mar 2024 10:05:46 -0500
Subject: [PATCH 2/2] common/hooks/pre-pkg/99-pkglint.sh: allow C.utf8 locale
 in glibc package

---
 common/hooks/pre-pkg/99-pkglint.sh | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh
index 30d97fcda40d46..90cb07da3f4aff 100644
--- a/common/hooks/pre-pkg/99-pkglint.sh
+++ b/common/hooks/pre-pkg/99-pkglint.sh
@@ -79,8 +79,22 @@ hook() {
 
 	# Check for l10n files in usr/lib/locale
 	if [ -d ${PKGDESTDIR}/usr/lib/locale ]; then
-		msg_red "${pkgver}: /usr/lib/locale is forbidden, use /usr/share/locale!\n"
-		error=1
+		local locale_allow=0 ldir
+		local lroot="${PKGDESTDIR}/usr/lib/locale"
+
+		if [ "${pkgname}" = "glibc" ]; then
+			# glibc gets an exception for its included C.utf8 locale
+			locale_allow=1
+			for ldir in "${lroot}"/*; do
+				[ "${ldir}" = "${lroot}/C.utf8" ] && continue
+				locale_allow=0
+			done
+		fi
+
+		if [ "${locale_allow}" -ne 1 ]; then
+			msg_red "${pkgver}: /usr/lib/locale is forbidden, use /usr/share/locale!\n"
+			error=1
+		fi
 	fi
 
 	# Check for bash completions in etc/bash_completion.d

  parent reply	other threads:[~2024-03-07  0:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 13:55 [PR PATCH] " ahesford
2024-03-06 15:44 ` [PR PATCH] [Updated] " ahesford
2024-03-06 15:45 ` ahesford
2024-03-06 16:04 ` [PR PATCH] [Updated] " ahesford
2024-03-06 20:10 ` oreo639
2024-03-06 20:10 ` oreo639
2024-03-06 20:11 ` oreo639
2024-03-06 20:20 ` oreo639
2024-03-06 20:45 ` oreo639
2024-03-06 20:46 ` oreo639
2024-03-06 20:46 ` oreo639
2024-03-06 23:24 ` oreo639
2024-03-06 23:27 ` [PR REVIEW] " oreo639
2024-03-06 23:37 ` oreo639
2024-03-06 23:37 ` oreo639
2024-03-06 23:37 ` oreo639
2024-03-06 23:37 ` oreo639
2024-03-06 23:38 ` oreo639
2024-03-07  0:49 ` ahesford [this message]
2024-03-07  0:50 ` ahesford
2024-03-07 21:56 ` oreo639
2024-03-07 21:57 ` oreo639
2024-03-07 21:58 ` oreo639
2024-03-07 21:59 ` ahesford
2024-03-07 21:59 ` oreo639
2024-03-13 10:46 ` [PR PATCH] [Merged]: " ahesford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240307004900.31F91268E1@inbox.vuxu.org \
    --to=ahesford@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).