all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Miguel Ángel Arruga Vivas" <rosen644835@gmail.com>
To: 44196@debbugs.gnu.org
Subject: bug#44196: [PATCH v4 3/4] system: Do not depend on locale folder generated by
Date: Wed, 28 Oct 2020 22:34:05 +0100	[thread overview]
Message-ID: <87v9eum3w2.fsf_-_@gmail.com> (raw)
In-Reply-To: <87y2jsod97.fsf_-_@gmail.com> ("Miguel Ángel Arruga Vivas"'s message of "Mon, 26 Oct 2020 23:04:20 +0100")

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

Sorry, the last one didn't generate correctly the locale folder for two
reasons: wrong name for the .mo name, and incomplete path.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v4-0003-system-do-not-depend-on-locale-folder.patch --]
[-- Type: text/x-patch, Size: 3500 bytes --]

From 37ef6594c6db00595b4e3aec6bcaec3eb9b4e1cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <rosen644835@gmail.com>
Date: Sat, 24 Oct 2020 20:36:21 +0200
Subject: [PATCH v4 3/5] system: Do not depend on locale folder generated by
 grub-install.

* gnu/bootloader/grub.scm (define-module): Use (guix packages).
(grub-locale-folder): New computed folder.
(grub-configuration-file)[locale-config]: Use grub-locale-folder only when a
locale is needed.
---
 gnu/bootloader/grub.scm | 49 ++++++++++++++++++++++++++++++++---------
 1 file changed, 38 insertions(+), 11 deletions(-)

diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index f1479024e6..1fe09d01c1 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -25,6 +25,7 @@
 
 (define-module (gnu bootloader grub)
   #:use-module (guix build union)
+  #:use-module (guix packages)
   #:use-module (guix records)
   #:use-module (guix store)
   #:use-module (guix utils)
@@ -142,6 +143,24 @@ file with the resolution provided in CONFIG."
             (image->png image #:width width #:height height))
            (_ #f)))))
 
+(define (grub-locale-folder grub)
+  "Generate a folder with the locales from GRUB."
+  (define builder
+    #~(begin
+        (use-modules (ice-9 ftw))
+        (let ((locale (string-append #$grub "/share/locale"))
+              (out    #$output))
+          (mkdir out)
+          (chdir out)
+          (for-each (lambda (lang)
+                      (let ((file (string-append locale "/" lang
+                                                 "/LC_MESSAGES/grub.mo"))
+                            (dest (string-append lang ".mo")))
+                        (when (file-exists? file)
+                          (copy-file file dest))))
+                    (scandir locale)))))
+  (computed-file "grub-boot-locale" builder))
+
 (define* (eye-candy config store-device store-mount-point
                     #:key store-directory-prefix port)
   "Return a gexp that writes to PORT (a port-valued gexp) the 'grub.cfg' part
@@ -402,18 +421,26 @@ menuentry ~s {
                  #:port #~port)))
 
   (define locale-config
-    #~(let ((locale #$(and locale
-                           (locale-definition-source
-                            (locale-name->definition locale)))))
-        (when locale
-          (format port "\
+    (let* ((entry (first all-entries))
+           (device (menu-entry-device entry))
+           (mount-point (menu-entry-device-mount-point entry))
+           (bootloader (bootloader-configuration-bootloader config))
+           (grub (bootloader-package bootloader))
+           (locale-dir (grub-locale-folder grub)))
+
+      #~(let ((locale #$(and locale
+                             (locale-definition-source
+                              (locale-name->definition locale))))
+              (locale-dir #$(and locale (grub-locale-folder grub))))
+          (when locale
+            (format port "\
 # Localization configuration.
-if search --file --set boot_partition /grub/grub.cfg; then
-    set locale_dir=(${boot_partition})/grub/locale
-else
-    set locale_dir=/boot/grub/locale
-fi
-set lang=~a~%" locale))))
+search --file --set ~a
+set locale_dir=~a
+set lang=~a~%"
+                    (string-append locale-dir "/es@quot.mo")
+                    locale-dir
+                    locale)))))
 
   (define keyboard-layout-config
     (let* ((layout (bootloader-configuration-keyboard-layout config))
-- 
2.28.0


  reply	other threads:[~2020-10-28 21:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-24 17:56 bug#44196: Problems with /gnu/store in a different btrfs subvolume Miguel Ángel Arruga Vivas
2020-10-24 18:01 ` bug#44196: [PATCH 1/3] system: Fix grub keymap with store in " Miguel Ángel Arruga Vivas
2020-10-30 19:36   ` Danny Milosavljevic
2020-10-30 21:38     ` Miguel Ángel Arruga Vivas
2020-10-24 18:02 ` bug#44196: [PATCH 2/3] system: Add store-directory-prefix to boot-parameters Miguel Ángel Arruga Vivas
2020-10-31 21:39   ` Ludovic Courtès
2020-10-31 23:02     ` Miguel Ángel Arruga Vivas
2020-11-01  0:01       ` Miguel Ángel Arruga Vivas
2020-11-01  1:44         ` Miguel Ángel Arruga Vivas
2020-11-02 16:06       ` Ludovic Courtès
2020-11-02 18:52         ` Miguel Ángel Arruga Vivas
2020-11-03  9:26           ` Ludovic Courtès
2020-10-24 21:13 ` bug#44196: [PATCH 3/3] gnu: grub: Add output locale Miguel Ángel Arruga Vivas
2020-10-25 10:04   ` bug#44196: [PATCH 3/3 v2] gnu: grub: Add locale output Miguel Ángel Arruga Vivas
2020-10-26 22:04     ` bug#44196: [PATCH 3/3 v3] system: Do not depend on locale folder generated by grub-install Miguel Ángel Arruga Vivas
2020-10-28 21:34       ` Miguel Ángel Arruga Vivas [this message]
2020-10-30 18:13         ` bug#44196: [PATCH v5 3/4] system: Do not depend on locale folder generated by Miguel Ángel Arruga Vivas
2020-10-30 21:45           ` bug#44196: [PATCH v6 " Miguel Ángel Arruga Vivas
2020-10-31 21:44             ` Ludovic Courtès
2020-11-01  0:36               ` Miguel Ángel Arruga Vivas
2020-10-26 22:29 ` bug#44196: [PATCH 4/3] system: Fix dependency for grub.cfg generation Miguel Ángel Arruga Vivas
2020-10-30 19:35   ` Danny Milosavljevic
2020-10-30 21:38     ` Miguel Ángel Arruga Vivas

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=87v9eum3w2.fsf_-_@gmail.com \
    --to=rosen644835@gmail.com \
    --cc=44196@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.