profiles: Use C.UTF-8 instead of ‘glibc-utf8-locales’ where possible.

This is a followup to 1cebc334a77030c0c94955981652f4df7608c9e3.

* guix/profiles.scm (ca-certificate-bundle)[libc-utf8-locales-for-target]:
Remove.
[build]: Use “C.UTF-8” instead of “en_US.utf8”.
(profile-derivation)[libc-utf8-locales-for-target]: Remove.
[set-utf8-locale]: Rewrite to a gexp that calls ‘setlocale’ for “C.UTF-8”.
* tests/profiles.scm ("profile-derivation, cross-compilation"): Remove
‘locales’ variable and related check.

Change-Id: I7cb148b9149fe5fbe5b9b1b25fdce1002ad1f37e
This commit is contained in:
Ludovic Courtès 2023-12-11 16:55:29 +01:00
parent 92727f4af5
commit 949ee85019
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 6 additions and 34 deletions

View file

@ -1127,11 +1127,6 @@ (define* (ca-certificate-bundle manifest #:optional system)
MANIFEST. Single-file bundles are required by programs such as Git and Lynx." MANIFEST. Single-file bundles are required by programs such as Git and Lynx."
;; See <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00429.html> ;; See <http://lists.gnu.org/archive/html/guix-devel/2015-02/msg00429.html>
;; for a discussion. ;; for a discussion.
(define libc-utf8-locales-for-target ;lazy reference
(module-ref (resolve-interface '(gnu packages base))
'libc-utf8-locales-for-target))
(define build (define build
(with-imported-modules '((guix build utils)) (with-imported-modules '((guix build utils))
#~(begin #~(begin
@ -1163,13 +1158,7 @@ (define (dump file port)
;; Some file names in the NSS certificates are UTF-8 encoded so ;; Some file names in the NSS certificates are UTF-8 encoded so
;; install a UTF-8 locale. ;; install a UTF-8 locale.
(setenv "LOCPATH" (setlocale LC_ALL "C.UTF-8")
(string-append #+(libc-utf8-locales-for-target system)
"/lib/locale/"
#+(version-major+minor
(package-version
(libc-utf8-locales-for-target system)))))
(setlocale LC_ALL "en_US.utf8")
(match (append-map ca-files '#$(manifest-inputs manifest)) (match (append-map ca-files '#$(manifest-inputs manifest))
(() (()
@ -1965,8 +1954,7 @@ (define* (profile-derivation manifest
or TARGET is set, raise an error if MANIFEST contains a package that does not or TARGET is set, raise an error if MANIFEST contains a package that does not
support SYSTEM. support SYSTEM.
When LOCALES? is true, the build is performed under a UTF-8 locale; this adds When LOCALES? is true, the build is performed under a UTF-8 locale.
a dependency on the 'glibc-utf8-locales' package.
When RELATIVE-SYMLINKS? is true, use relative file names for symlink targets. When RELATIVE-SYMLINKS? is true, use relative file names for symlink targets.
This is one of the things to do for the result to be relocatable. This is one of the things to do for the result to be relocatable.
@ -2009,21 +1997,10 @@ (define extra-inputs
(and (derivation? drv) (gexp-input drv))) (and (derivation? drv) (gexp-input drv)))
extras)) extras))
(define libc-utf8-locales-for-target ;lazy reference
(module-ref (resolve-interface '(gnu packages base))
'libc-utf8-locales-for-target))
(define set-utf8-locale (define set-utf8-locale
;; Some file names (e.g., in 'nss-certs') are UTF-8 encoded so ;; Some file names (e.g., in 'nss-certs') are UTF-8 encoded so install a
;; install a UTF-8 locale. ;; UTF-8 locale. Assume libc comes with a copy of C.UTF-8.
(let ((locales (libc-utf8-locales-for-target #~(setlocale LC_ALL "C.UTF-8"))
(or system (%current-system)))))
#~(begin
(setenv "LOCPATH"
#$(file-append locales "/lib/locale/"
(version-major+minor
(package-version locales))))
(setlocale LC_ALL "en_US.utf8"))))
(define builder (define builder
(with-imported-modules '((guix build profiles) (with-imported-modules '((guix build profiles)

View file

@ -463,7 +463,6 @@ (define-syntax-rule (with-environment-excursion exp ...)
(target -> "arm-linux-gnueabihf") (target -> "arm-linux-gnueabihf")
(grep (package->cross-derivation packages:grep target)) (grep (package->cross-derivation packages:grep target))
(sed (package->cross-derivation packages:sed target)) (sed (package->cross-derivation packages:sed target))
(locales (package->derivation (packages:libc-utf8-locales-for-target)))
(drv (profile-derivation manifest (drv (profile-derivation manifest
#:hooks '() #:hooks '()
#:locales? #t #:locales? #t
@ -475,15 +474,11 @@ (define (find-input package)
(and (string-suffix? name input) input))) (and (string-suffix? name input) input)))
(derivation-inputs drv)))) (derivation-inputs drv))))
;; The inputs for grep and sed should be cross-build derivations, but that
;; for the glibc-utf8-locales should be a native build.
(return (and (string=? (derivation-system drv) (%current-system)) (return (and (string=? (derivation-system drv) (%current-system))
(string=? (find-input packages:grep) (string=? (find-input packages:grep)
(derivation-file-name grep)) (derivation-file-name grep))
(string=? (find-input packages:sed) (string=? (find-input packages:sed)
(derivation-file-name sed)) (derivation-file-name sed))))))
(string=? (find-input (packages:libc-utf8-locales-for-target))
(derivation-file-name locales))))))
(test-assert "package->manifest-entry defaults to \"out\"" (test-assert "package->manifest-entry defaults to \"out\""
(let ((outputs (package-outputs packages:glibc))) (let ((outputs (package-outputs packages:glibc)))