all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 70280@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#70280] [PATCH 2/5] system: ‘operating-system-locale-definitions’ includes the OS’ locale.
Date: Mon,  8 Apr 2024 16:24:32 +0200	[thread overview]
Message-ID: <184c38bf07d985a8831f60024a2ae94e2fd6804d.1712585810.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1712585810.git.ludo@gnu.org>

* 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





  parent reply	other threads:[~2024-04-08 14:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08 14:22 [bug#70280] [PATCH 0/5] Reducing system size: locales and initrd Ludovic Courtès
2024-04-08 14:24 ` [bug#70280] [PATCH 1/5] system: Remove ‘glibc-2.33’ from ‘%default-locale-libcs’ Ludovic Courtès
2024-04-08 14:24 ` Ludovic Courtès [this message]
2024-04-10  9:09   ` [bug#70280] [PATCH 2/5] system: ‘operating-system-locale-definitions’ includes the OS’ locale pelzflorian (Florian Pelz)
2024-04-10  9:52     ` pelzflorian (Florian Pelz)
2024-04-15 16:23     ` Ludovic Courtès
2024-04-15 22:51       ` pelzflorian (Florian Pelz)
2024-04-17 15:16         ` Ludovic Courtès
2024-04-08 14:24 ` [bug#70280] [PATCH 3/5] locale: Shrink ‘%default-locale-definitions’ from 34 to 10 locales Ludovic Courtès
2024-04-09 19:38   ` pelzflorian (Florian Pelz)
2024-04-15 16:22     ` Ludovic Courtès
2024-04-15 22:32       ` pelzflorian (Florian Pelz)
2024-04-17 15:20         ` Ludovic Courtès
2024-04-29 22:30           ` bug#70280: " Ludovic Courtès
2024-04-08 14:24 ` [bug#70280] [PATCH 4/5] services: build-vm: Provide only one locale Ludovic Courtès
2024-04-08 14:24 ` [bug#70280] [PATCH 5/5] linux-initrd: Further strip the static Guile Ludovic Courtès

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=184c38bf07d985a8831f60024a2ae94e2fd6804d.1712585810.git.ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=70280@debbugs.gnu.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.