unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Miguel Ángel Arruga Vivas" <rosen644835@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: Efraim Flashner <efraim@flashner.co.il>, 44075@debbugs.gnu.org
Subject: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection.
Date: Wed, 04 Nov 2020 17:12:47 +0100	[thread overview]
Message-ID: <87a6vx85j4.fsf@gmail.com> (raw)
In-Reply-To: <878sbz1p71.fsf@gnu.org> ("Ludovic Courtès"'s message of "Wed, 21 Oct 2020 19:09:06 +0200")


[-- Attachment #1.1: Type: text/plain, Size: 943 bytes --]

Hi Efraim and Ludo!

This patch could be an starting point to even master, it allows to
extend easily glibc-utf8-locales to the desired ones.

I've used the following steps to test it[1]:
------------------------------>8----------------------------------
$ echo '(define-module (t) #:use-module (gnu packages base))
(define-public glibc-utf8-test
  (make-glibc-utf8-locales glibc #:locales (list "es_ES")
                           #:name "glibc-utf8-test"))
glibc-utf8-test' > tmp/t.scm
$ ./pre-inst-env guix build -f tmp/t.scm
$ ./pre-inst-env guix package -L tmp --show=glibc-utf8-test
------------------------------8<----------------------------------

Something like glibc-utf8-<language>-locales could be easily implemented
on top of this, and I think it could be helpful for the end user too.
WDYT?

Happy hacking!
Miguel

[1] After checking that ./pre-inst-env guix build glibc-utf8-locales
didn't rebuild anything at all, of course.


[-- Attachment #1.2: utf8-locales.patch --]
[-- Type: text/x-patch, Size: 3755 bytes --]

From b0d2bfbe20a0a48a23a8dd4f14c0acce4ef5842f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <rosen644835@gmail.com>
Date: Wed, 4 Nov 2020 15:48:45 +0100
Subject: [PATCH] gnu: base: Add optional locales keyword to
 make-glibc-utf8-locales.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* gnu/packages/base.scm (make-glibc-utf8-locales): Add keyword parameter
locales with the old value as default.
[arguments]: Use locales value.

Co-authored-by: Efraim Flashner <efraim@flashner.co.il>
Co-authored-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu/packages/base.scm | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index c83775d8ee..5170a77270 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -52,13 +52,16 @@
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages gettext)
+  #:use-module (guix i18n)
   #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system trivial)
+  #:use-module (ice-9 format)
   #:use-module (ice-9 match)
+  #:use-module (ice-9 optargs)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (glibc
@@ -1106,9 +1109,16 @@ to the @code{share/locale} sub-directory of this package.")
                                         ,(version-major+minor
                                           (package-version glibc)))))))))))
 
-(define-public (make-glibc-utf8-locales glibc)
+(define %default-utf8-locales
+  ;; These are the locales commonly used for tests---e.g., in Guile's i18n
+  ;; tests.
+  '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))
+(define*-public (make-glibc-utf8-locales glibc #:key
+                                         (locales %default-utf8-locales)
+                                         (name "glibc-utf8-locales"))
+  (define default-locales? (equal? locales %default-utf8-locales))
   (package
-    (name "glibc-utf8-locales")
+    (name name)
     (version (package-version glibc))
     (source #f)
     (build-system trivial-build-system)
@@ -1142,17 +1152,22 @@ to the @code{share/locale} sub-directory of this package.")
                                  (symlink (string-append locale ".utf8")
                                           (string-append localedir "/"
                                                          locale ".UTF-8")))
-
-                               ;; These are the locales commonly used for
-                               ;; tests---e.g., in Guile's i18n tests.
-                               '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))
+                               ',locales)
                      #t))))
     (native-inputs `(("glibc" ,glibc)
                      ("gzip" ,gzip)))
-    (synopsis "Small sample of UTF-8 locales")
+    (synopsis (if default-locales?
+                  (P_ "Small sample of UTF-8 locales")
+                  (P_ "Customized sample of UTF-8 locales")))
     (description
-     "This package provides a small sample of UTF-8 locales mostly useful in
+     (if default-locales?
+         (P_ "This package provides a small sample of UTF-8 locales mostly useful in
 test environments.")
+         (format #f (P_ "This package provides the following UTF-8 locales:
+@itemize
+~{@item ~a~%~}
+@end itemize~%")
+                 locales)))
     (home-page (package-home-page glibc))
     (license (package-license glibc))))
 
-- 
2.28.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

  reply	other threads:[~2020-11-04 16:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19  6:47 [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection Efraim Flashner
2020-10-19 13:17 ` Miguel Ángel Arruga Vivas
2020-10-19 14:02   ` Efraim Flashner
2020-10-19 17:43     ` Miguel Ángel Arruga Vivas
2020-10-21  7:01       ` Efraim Flashner
2020-10-21 23:18         ` Miguel Ángel Arruga Vivas
2020-10-21 17:09 ` Ludovic Courtès
2020-11-04 16:12   ` Miguel Ángel Arruga Vivas [this message]
2020-11-06 15:58     ` Ludovic Courtès
2020-11-18 22:10       ` Ludovic Courtès
2021-01-07 12:00         ` Miguel Ángel Arruga Vivas
2020-12-24  9:38 ` bdju--- via Guix-patches via
2020-12-24 22:04   ` Leo Famulari
2020-12-24 22:05     ` Leo Famulari

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=87a6vx85j4.fsf@gmail.com \
    --to=rosen644835@gmail.com \
    --cc=44075@debbugs.gnu.org \
    --cc=efraim@flashner.co.il \
    --cc=ludo@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).