summary refs log tree commit diff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-02-10 11:01:54 +0100
committerLudovic Courtès <ludo@gnu.org>2016-02-10 15:15:17 +0100
commitf5582b2c1d7cb73f36d5278bec99d7279f813a39 (patch)
tree1af4e61e8aa258338e4eeb9e0b5d4c78fe3a7a8f /gnu/system.scm
parent32e16112064ae3f7bad729802834c965b270bbc0 (diff)
downloadguix-f5582b2c1d7cb73f36d5278bec99d7279f813a39.tar.gz
system: Selected locale is automatically built.
Fixes <http://bugs.gnu.org/22572>.
Reported by Mark H Weaver <mhw@netris.org>.

* gnu/system/locale.scm (%not-dot): New variable.
(denormalize-codeset, locale-name->definition): New procedures.
* gnu/system.scm (locale-name->definition*): New procedure.
(operating-system-locale-directory): Instead of raising an error, add
the missing locale.
* doc/guix.texi (Locales): Adjust accordingly.
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm29
1 files changed, 21 insertions, 8 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 9540324df0..b9d717d5ed 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -669,18 +669,31 @@ hardware-related operations as necessary when booting a Linux container."
                                            #:mapped-devices mapped-devices)))
     (return #~(string-append #$initrd "/initrd"))))
 
+(define (locale-name->definition* name)
+  "Variant of 'locale-name->definition' that raises an error upon failure."
+  (match (locale-name->definition name)
+    (#f
+     (raise (condition
+             (&message
+              (message (format #f (_ "~a: invalid locale name") name))))))
+    (def def)))
+
 (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."
-  ;; While we're at it, check whether the locale of OS is defined.
-  (unless (member (operating-system-locale os)
-                  (map locale-definition-name
-                       (operating-system-locale-definitions os)))
-    (raise (condition
-            (&message (message "system locale lacks a definition")))))
-
-  (locale-directory (operating-system-locale-definitions os)
+  (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
                     #:libcs (operating-system-locale-libcs os)))
 
 (define (kernel->grub-label kernel)