unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 67686@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#67686] [PATCH core-updates 2/5] gnu: glibc-utf8-locales: Generalize and use gexps.
Date: Thu,  7 Dec 2023 11:22:45 +0100	[thread overview]
Message-ID: <614bd1b35c61d23a3de82c292cf3f55d52b56b29.1701943221.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1701943221.git.ludo@gnu.org>

Previously code was dependent on the ‘name’ field of the GLIBC package.

* gnu/packages/base.scm (make-glibc-utf8-locales): Use gexps.  Replace
references to ‘%build-inputs’ by calls to ‘which’.  Replace reference to
‘version’ by (package-version this-package).

Change-Id: I1e7003047aa85df74069b233191ab331b5f887b6
---
 gnu/packages/base.scm | 67 +++++++++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 31 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index b4982107b2..f95ae1b679 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -1348,47 +1348,52 @@ (define %default-utf8-locales
 (define*-public (make-glibc-utf8-locales glibc #:key
                                          (locales %default-utf8-locales)
                                          (name "glibc-utf8-locales"))
-  (define default-locales? (equal? locales %default-utf8-locales))
+  (define default-locales?
+    (equal? locales %default-utf8-locales))
+
   (package
     (name name)
     (version (package-version glibc))
     (source #f)
     (build-system trivial-build-system)
     (arguments
-     `(#:modules ((guix build utils))
-       #:builder (begin
-                   (use-modules (guix build utils))
+     (list #:modules '((guix build utils))
+           #:builder
+           #~(begin
+               (use-modules (guix build utils))
 
-                   (let* ((libc      (assoc-ref %build-inputs "glibc"))
-                          (gzip      (assoc-ref %build-inputs "gzip"))
-                          (out       (assoc-ref %outputs "out"))
-                          (localedir (string-append out "/lib/locale/"
-                                                    ,(version-major+minor version))))
-                     ;; 'localedef' needs 'gzip'.
-                     (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))
+               (let* ((libc      (dirname
+                                  (search-input-file %build-inputs
+                                                     "/bin/localedef")))
+                      (gzip      (dirname
+                                  (search-input-file %build-inputs
+                                                     "/bin/gzip")))
+                      (out       #$output)
+                      (localedir (string-append out "/lib/locale/"
+                                                #$(version-major+minor
+                                                   (package-version this-package)))))
+                 ;; 'localedef' needs 'gzip'.
+                 (setenv "PATH" (string-append libc ":" gzip ""))
 
-                     (mkdir-p localedir)
-                     (for-each (lambda (locale)
-                                 (define file
-                                   ;; Use the "normalized codeset" by
-                                   ;; default--e.g., "en_US.utf8".
-                                   (string-append localedir "/" locale ".utf8"))
+                 (mkdir-p localedir)
+                 (for-each (lambda (locale)
+                             (define file
+                               ;; Use the "normalized codeset" by
+                               ;; default--e.g., "en_US.utf8".
+                               (string-append localedir "/" locale ".utf8"))
 
-                                 (invoke "localedef" "--no-archive"
-                                         "--prefix" localedir
-                                         "-i" locale
-                                         "-f" "UTF-8" file)
+                             (invoke "localedef" "--no-archive"
+                                     "--prefix" localedir
+                                     "-i" locale
+                                     "-f" "UTF-8" file)
 
-                                 ;; For backward compatibility with Guix
-                                 ;; <= 0.8.3, add "xx_YY.UTF-8".
-                                 (symlink (string-append locale ".utf8")
-                                          (string-append localedir "/"
-                                                         locale ".UTF-8")))
-                               ',locales)
-                     #t))))
-    (native-inputs
-     `(("glibc" ,glibc)
-       ("gzip" ,gzip)))
+                             ;; For backward compatibility with Guix
+                             ;; <= 0.8.3, add "xx_YY.UTF-8".
+                             (symlink (string-append locale ".utf8")
+                                      (string-append localedir "/"
+                                                     locale ".UTF-8")))
+                           '#$locales)))))
+    (native-inputs (list glibc gzip))
     (synopsis (if default-locales?
                   (P_ "Small sample of UTF-8 locales")
                   (P_ "Customized sample of UTF-8 locales")))
-- 
2.41.0





  parent reply	other threads:[~2023-12-07 10:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 10:19 [bug#67686] [PATCH core-updates 0/5] Update glibc to 2.38; make C.UTF-8 always available Ludovic Courtès
2023-12-07 10:22 ` [bug#67686] [PATCH core-updates 1/5] gnu: gcc@11: Update to 11.4.0 Ludovic Courtès
2023-12-07 20:11   ` Janneke Nieuwenhuizen
2023-12-07 21:13     ` Ludovic Courtès
2023-12-07 10:22 ` Ludovic Courtès [this message]
2023-12-07 10:22 ` [bug#67686] [PATCH core-updates 3/5] DRAFT gnu: glibc: Update to 2.38 Ludovic Courtès
2023-12-07 10:22 ` [bug#67686] [PATCH core-updates 4/5] gnu: glibc: Install C.UTF-8 locale Ludovic Courtès
2023-12-07 10:30   ` Ludovic Courtès
2023-12-07 20:31     ` Janneke Nieuwenhuizen
2023-12-07 21:12       ` Ludovic Courtès
2023-12-07 21:26     ` Ludovic Courtès
2023-12-09 16:33       ` Efraim Flashner
2023-12-09 21:41         ` Ludovic Courtès
2023-12-10  7:24           ` Efraim Flashner
2023-12-07 10:22 ` [bug#67686] [PATCH core-updates 5/5] gnu: glibc: Ensure C.UTF-8 locale is always found Ludovic Courtès
2023-12-07 22:54 ` [bug#67686] [PATCH core-updates v2 0/7] Update glibc to 2.38; make C.UTF-8 always available Ludovic Courtès
2023-12-07 22:54   ` [bug#67686] [PATCH core-updates v2 1/7] gnu: gcc@11: Update to 11.4.0 Ludovic Courtès
2023-12-08 17:39     ` Janneke Nieuwenhuizen
2023-12-07 22:54   ` [bug#67686] [PATCH core-updates v2 2/7] gnu: glibc-utf8-locales: Generalize and use gexps Ludovic Courtès
2023-12-07 22:54   ` [bug#67686] [PATCH core-updates v2 3/7] gnu: mpfr: Update to 4.2.1 Ludovic Courtès
2023-12-07 22:54   ` [bug#67686] [PATCH core-updates v2 4/7] DRAFT gnu: glibc: Update to 2.38 Ludovic Courtès
2023-12-09 21:44     ` Ludovic Courtès
2023-12-10 10:14       ` Ludovic Courtès
2023-12-07 22:54   ` [bug#67686] [PATCH core-updates v2 5/7] gnu: glibc: Install C.UTF-8 locale Ludovic Courtès
2023-12-07 22:54   ` [bug#67686] [PATCH core-updates v2 6/7] gnu: glibc: Ensure C.UTF-8 locale is always found Ludovic Courtès
2023-12-07 22:54   ` [bug#67686] [PATCH core-updates v2 7/7] gnu: glibc: Improve handling of empty .a files Ludovic Courtès
2023-12-09 14:58   ` bug#67686: [PATCH core-updates v2 0/7] Update glibc to 2.38; make C.UTF-8 always available Ludovic Courtès
2023-12-09 16:37     ` [bug#67686] " Efraim Flashner

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=614bd1b35c61d23a3de82c292cf3f55d52b56b29.1701943221.git.ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=67686@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).