[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#70280] [PATCH 2/5] system: ‘operating-system-locale-definitions’ in
From: |
Ludovic Courtès |
Subject: |
[bug#70280] [PATCH 2/5] system: ‘operating-system-locale-definitions’ includes the OS’ locale. |
Date: |
Mon, 8 Apr 2024 16:24:32 +0200 |
* gnu/system.scm (<operating-system>)[locale-definitions]: Mark as
thunked. Default to (operating-system-default-locale-definitions os).
(operating-system-default-locale-definitions): New procedure.
(operating-system-locale-directory): Remove logic to add the OS
‘locale’, instead assuming (operating-system-locale-directory os) has
everything.
* doc/guix.texi (operating-system Reference): Adjust accordingly.
Change-Id: I8798fa0de7421e0bfc07870cc3cae6b7f99fa47d
---
doc/guix.texi | 3 ++-
gnu/system.scm | 28 +++++++++++++++-------------
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 5827e0de14..7ca06046ba 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17502,7 +17502,8 @@ operating-system Reference
The name of the default locale (@pxref{Locale Names,,, libc, The GNU C
Library Reference Manual}). @xref{Locales}, for more information.
-@item @code{locale-definitions} (default: @code{%default-locale-definitions})
+@item @code{locale-definitions} (default: @
+ @code{(operating-system-default-locale-definitions os)})
The list of locale definitions to be compiled and that may be used at
run time. @xref{Locales}.
diff --git a/gnu/system.scm b/gnu/system.scm
index aef81d8ccf..94d734b014 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -282,7 +282,9 @@ (define-record-type* <operating-system> operating-system
(locale operating-system-locale ; string
(default "en_US.utf8"))
(locale-definitions operating-system-locale-definitions ; list of
<locale-definition>
- (default %default-locale-definitions))
+ (thunked)
+ (default (operating-system-default-locale-definitions
+ this-operating-system)))
(locale-libcs operating-system-locale-libcs ; list of <packages>
(default %default-locale-libcs))
(name-service-switch operating-system-name-service-switch ;
<name-service-switch>
@@ -1397,22 +1399,22 @@ (define (locale-name->definition* name)
(raise (formatted-message (G_ "~a: invalid locale name") name)))
(def def)))
+(define (operating-system-default-locale-definitions os)
+ "Return the default locale definitions for OS, which includes that specified
+in its 'locale' field."
+ (define name
+ (operating-system-locale os))
+
+ (if (member name (map locale-definition-name %default-locale-definitions))
+ %default-locale-definitions
+ (cons (locale-name->definition* name)
+ %default-locale-definitions)))
+
(define (operating-system-locale-directory os)
"Return the directory containing the locales compiled for the definitions
listed in OS. The C library expects to find it under
/run/current-system/locale."
- (define name
- (operating-system-locale os))
-
- (define definitions
- ;; While we're at it, check whether NAME is defined and add it if needed.
- (if (member name (map locale-definition-name
- (operating-system-locale-definitions os)))
- (operating-system-locale-definitions os)
- (cons (locale-name->definition* name)
- (operating-system-locale-definitions os))))
-
- (locale-directory definitions
+ (locale-directory (operating-system-locale-definitions os)
#:libcs (operating-system-locale-libcs os)))
(define* (kernel->boot-label kernel #:key hurd)
--
2.41.0
[bug#70280] [PATCH 2/5] system: ‘operating-system-locale-definitions’ includes the OS’ locale.,
Ludovic Courtès <=