GNU bug report logs - #44075
[PATCH] gnu: Add make-glibc-locales-collection.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Efraim Flashner <efraim@HIDDEN>; Keywords: patch; dated Mon, 19 Oct 2020 06:49:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 44075 <at> debbugs.gnu.org:


Received: (at 44075) by debbugs.gnu.org; 18 Nov 2020 22:10:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 18 17:10:54 2020
Received: from localhost ([127.0.0.1]:36836 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kfVfC-0006wc-JE
	for submit <at> debbugs.gnu.org; Wed, 18 Nov 2020 17:10:54 -0500
Received: from eggs.gnu.org ([209.51.188.92]:49932)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kfVfA-0006wP-Ij
 for 44075 <at> debbugs.gnu.org; Wed, 18 Nov 2020 17:10:52 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:35591)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kfVf5-0007AX-0n; Wed, 18 Nov 2020 17:10:47 -0500
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=35444 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kfVf0-0007nh-Eq; Wed, 18 Nov 2020 17:10:45 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Miguel =?utf-8?Q?=C3=81ngel?= Arruga Vivas <rosen644835@HIDDEN>
Subject: Re: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection.
References: <20201019064739.4736-1-efraim@HIDDEN>
 <878sbz1p71.fsf@HIDDEN> <87a6vx85j4.fsf@HIDDEN>
 <87d00qxyrx.fsf@HIDDEN>
Date: Wed, 18 Nov 2020 23:10:40 +0100
In-Reply-To: <87d00qxyrx.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Fri, 06 Nov 2020 16:58:42 +0100")
Message-ID: <873616joyn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44075
Cc: Efraim Flashner <efraim@HIDDEN>, 44075 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Ludovic Court=C3=A8s <ludo@HIDDEN> skribis:

> Miguel =C3=81ngel Arruga Vivas <rosen644835@HIDDEN> skribis:
>
>> From b0d2bfbe20a0a48a23a8dd4f14c0acce4ef5842f Mon Sep 17 00:00:00 2001
>> From: =3D?UTF-8?q?Miguel=3D20=3DC3=3D81ngel=3D20Arruga=3D20Vivas?=3D
>>  <rosen644835@HIDDEN>
>> 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=3DUTF-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@HIDDEN>
>> Co-authored-by: Ludovic Court=C3=A8s <ludo@HIDDEN>
>
> Looks reasonable to me.

I think it=E2=80=99s OK for =E2=80=98master=E2=80=99.

> The next question is how we=E2=80=99ll use it.  I think it=E2=80=99s an e=
xcellent case
> for parameterized packages, for which I=E2=80=99ve proposed a rough design
> before, but we need someone to champion on that one.

It=E2=80=99s not there yet but there=E2=80=99s hope:

  https://lists.gnu.org/archive/html/guix-devel/2020-11/msg00312.html

Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#44075; Package guix-patches. Full text available.

Message received at 44075 <at> debbugs.gnu.org:


Received: (at 44075) by debbugs.gnu.org; 6 Nov 2020 15:58:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 06 10:58:55 2020
Received: from localhost ([127.0.0.1]:57063 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kb48d-0001RM-14
	for submit <at> debbugs.gnu.org; Fri, 06 Nov 2020 10:58:55 -0500
Received: from eggs.gnu.org ([209.51.188.92]:44794)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kb48a-0001R7-Me
 for 44075 <at> debbugs.gnu.org; Fri, 06 Nov 2020 10:58:53 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:39782)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kb48U-0003sK-RG; Fri, 06 Nov 2020 10:58:46 -0500
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=35916 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kb48R-0007ca-Hg; Fri, 06 Nov 2020 10:58:44 -0500
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Miguel =?utf-8?Q?=C3=81ngel?= Arruga Vivas <rosen644835@HIDDEN>
Subject: Re: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection.
References: <20201019064739.4736-1-efraim@HIDDEN>
 <878sbz1p71.fsf@HIDDEN> <87a6vx85j4.fsf@HIDDEN>
X-URL: http://www.fdn.fr/~lcourtes/
X-Revolutionary-Date: 16 Brumaire an 229 de la =?utf-8?Q?R=C3=A9volution?=
X-PGP-Key-ID: 0x090B11993D9AEBB5
X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc
X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4  0CFB 090B 1199 3D9A EBB5
X-OS: x86_64-pc-linux-gnu
Date: Fri, 06 Nov 2020 16:58:42 +0100
In-Reply-To: <87a6vx85j4.fsf@HIDDEN> ("Miguel =?utf-8?Q?=C3=81ngel?=
 Arruga Vivas"'s message of "Wed, 04 Nov 2020 17:12:47 +0100")
Message-ID: <87d00qxyrx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44075
Cc: Efraim Flashner <efraim@HIDDEN>, 44075 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Miguel =C3=81ngel Arruga Vivas <rosen644835@HIDDEN> skribis:

> From b0d2bfbe20a0a48a23a8dd4f14c0acce4ef5842f Mon Sep 17 00:00:00 2001
> From: =3D?UTF-8?q?Miguel=3D20=3DC3=3D81ngel=3D20Arruga=3D20Vivas?=3D
>  <rosen644835@HIDDEN>
> 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=3DUTF-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@HIDDEN>
> Co-authored-by: Ludovic Court=C3=A8s <ludo@HIDDEN>

Looks reasonable to me.

The next question is how we=E2=80=99ll use it.  I think it=E2=80=99s an exc=
ellent case
for parameterized packages, for which I=E2=80=99ve proposed a rough design
before, but we need someone to champion on that one.

Thanks,
Ludo=E2=80=99.




Information forwarded to guix-patches@HIDDEN:
bug#44075; Package guix-patches. Full text available.

Message received at 44075 <at> debbugs.gnu.org:


Received: (at 44075) by debbugs.gnu.org; 4 Nov 2020 16:13:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 04 11:13:04 2020
Received: from localhost ([127.0.0.1]:50362 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kaLPD-0006Q4-Ml
	for submit <at> debbugs.gnu.org; Wed, 04 Nov 2020 11:13:04 -0500
Received: from mail-wr1-f65.google.com ([209.85.221.65]:41045)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rosen644835@HIDDEN>) id 1kaLPB-0006PS-NB
 for 44075 <at> debbugs.gnu.org; Wed, 04 Nov 2020 11:13:02 -0500
Received: by mail-wr1-f65.google.com with SMTP id s9so22638728wro.8
 for <44075 <at> debbugs.gnu.org>; Wed, 04 Nov 2020 08:13:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=I/I0OBAld0nSsYgRyrsRgPkfVrcFgrbPfCUWxaL4L7w=;
 b=XZNxssHBuNdMdf5ayECSObZC0tJjh7tn04/udsyuZM8334Klfuk8mDioAf3Pz+pp1f
 L9b5XfqIzqQoAmyUBbfX8re8KM3kWX7GG3RaDU/oVXRpYbMf1Uen7crFErIbM4cPgTzp
 iQObrpdauNUfaTwnI3yBBFl4QpO8/QZTv5z1NXiYv7lIj7FX4oPhGXCV/d6ItQmQw2pL
 Iz2O9Xy5aYIzHAKJ2r5toJWRcJCoGJqqzSH8CioRvkzwYu1HzCjdYLADStrm58F2kCrt
 D/yptUTrdd8mdJRyTUNlSs4MB7QSfBhd9kVvsuQ4aiuEZmaPExkcVOLshQusixJIncSf
 v8Ig==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=I/I0OBAld0nSsYgRyrsRgPkfVrcFgrbPfCUWxaL4L7w=;
 b=H059paWAPb/LYLkxwLXjyAjCLEGssNmSWFZN9qHJF0FHilsBrVdjbj2ijtLWRJP9QN
 xVAC8uWGyM6lDvqwfzvEeU5dnrx5hatEay79UYDWsPA7Hql5gSoRL9n3PxfHgbR3yBa0
 yeEceiH8F0G5lWcdhlQTkNew+LMWo87h1stdZd2A/bxXm1OWQiipxf3yy+rQ7dqpU1y1
 /QK+U67ov9oTtl63hcRovaDRlyfQscYv1dvwnRqrqzkHRbDo3LA7IBXUaiJLXYfwTpPm
 8nzz6xjnf59AgY49rmketWLo7qLJEwK1XGq8J5i+9EPkdagAcrC6eXs7WxFHd2hMYWoI
 WkQw==
X-Gm-Message-State: AOAM531LpKvrPYMXgBltdENki7eFoOUeXvc8PrplmGqSTmpeIMzu83g3
 weWIBTPpqF1uHUIS15rOjFiLJI3P6YwDIA==
X-Google-Smtp-Source: ABdhPJx7t7mMUcZ3fKu3OOxxwr52hmwUvHMOSsL+9IArFwOe4l8P5lxLMw7EOhBoBDxIWtTw2+1LrQ==
X-Received: by 2002:adf:a554:: with SMTP id j20mr7840630wrb.182.1604506375406; 
 Wed, 04 Nov 2020 08:12:55 -0800 (PST)
Received: from unfall (218.139.134.37.dynamic.jazztel.es. [37.134.139.218])
 by smtp.gmail.com with ESMTPSA id i11sm1337276wro.85.2020.11.04.08.12.53
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 04 Nov 2020 08:12:53 -0800 (PST)
From: =?utf-8?Q?Miguel_=C3=81ngel_Arruga_Vivas?= <rosen644835@HIDDEN>
To: Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>
Subject: Re: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection.
References: <20201019064739.4736-1-efraim@HIDDEN>
 <878sbz1p71.fsf@HIDDEN>
Date: Wed, 04 Nov 2020 17:12:47 +0100
In-Reply-To: <878sbz1p71.fsf@HIDDEN> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?=
 =?utf-8?Q?s?= message of "Wed, 21 Oct 2020 19:09:06 +0200")
Message-ID: <87a6vx85j4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="==-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 44075
Cc: Efraim Flashner <efraim@HIDDEN>, 44075 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

--==-=-=
Content-Type: multipart/mixed; boundary="=-=-="

--=-=-=
Content-Type: text/plain

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.


--=-=-=
Content-Type: text/x-patch; charset=utf-8
Content-Disposition: attachment;
 filename=0001-gnu-base-Add-optional-locales-keyword-to-make-glibc-.patch
Content-Transfer-Encoding: quoted-printable
Content-Description: utf8-locales.patch

From=20b0d2bfbe20a0a48a23a8dd4f14c0acce4ef5842f Mon Sep 17 00:00:00 2001
From: =3D?UTF-8?q?Miguel=3D20=3DC3=3D81ngel=3D20Arruga=3D20Vivas?=3D
 <rosen644835@HIDDEN>
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=3DUTF-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@HIDDEN>
Co-authored-by: Ludovic Court=C3=A8s <ludo@HIDDEN>
=2D--
 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
=2D-- 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 pac=
kage.")
                                         ,(version-major+minor
                                           (package-version glibc)))))))))))
=20
=2D(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
=2D    (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 pa=
ckage.")
                                  (symlink (string-append locale ".utf8")
                                           (string-append localedir "/"
                                                          locale ".UTF-8")))
=2D
=2D                               ;; These are the locales commonly used for
=2D                               ;; tests---e.g., in Guile's i18n tests.
=2D                               '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"=
))
+                               ',locales)
                      #t))))
     (native-inputs `(("glibc" ,glibc)
                      ("gzip" ,gzip)))
=2D    (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
=2D     "This package provides a small sample of UTF-8 locales mostly usefu=
l 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))))
=20
=2D-=20
2.28.0


--=-=-=--

--==-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEEiIeExBRZrMuD5+hMY0xuiXn6vsIFAl+i0v8ACgkQY0xuiXn6
vsLvVgwAlFel35w8Arwy7EwqBEGzfory3AfNvrAPaZxXsODZISybpTpyhe0ts8U5
sBXqCJddyGdNoemqXD5YStAOyCT2SgaK4XnXTX61g0Gmm/n5izcw16TusjG1dSpg
MfjIqRZfsVjbe4WEjepfb1n0T6GAfU0tleqaXeiBQbcTjG8mOy1mNKS373LTR8LW
Vuwhhe9vyk4n5R5RRqQqpZ0QkciY9aKVSe4kkVlOMa3utFxZhb9CMcJ2W3sZ6PWY
QDD5sxgNdGle23wsp0RD0Vc2t9Akg/ERfKK5vbbqF5cFK9TzpSmzx/MUfz4vNw5L
ZDYtizs//JkKupgQxLA/8gH//0CCX0TndktDNH+kM71SR3tNfVY4uVv5pKVO4+oX
evu7CqDPx9hRtqzMo0D15Y8qUfuDjVqlm7CuJJjDVEwiDJW4hqoqFCtj8KwsRvIp
mG/fC5fInwJn3W2wZh7jkkbwTs27LK9enAHQ6y3NEFLFvIeDNvlSP7p/Fl/ayljB
TBn3+Nqa
=Oa2h
-----END PGP SIGNATURE-----
--==-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#44075; Package guix-patches. Full text available.

Message received at 44075 <at> debbugs.gnu.org:


Received: (at 44075) by debbugs.gnu.org; 21 Oct 2020 23:19:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 21 19:19:31 2020
Received: from localhost ([127.0.0.1]:50870 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kVNOF-0008WG-6x
	for submit <at> debbugs.gnu.org; Wed, 21 Oct 2020 19:19:31 -0400
Received: from mail-wm1-f65.google.com ([209.85.128.65]:38296)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rosen644835@HIDDEN>) id 1kVNOD-0008W2-Db
 for 44075 <at> debbugs.gnu.org; Wed, 21 Oct 2020 19:19:30 -0400
Received: by mail-wm1-f65.google.com with SMTP id l15so47145wmi.3
 for <44075 <at> debbugs.gnu.org>; Wed, 21 Oct 2020 16:19:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=cJ3T56q86WJh4iPMi8g+SZkxOUq3V+372P9AQKwaLks=;
 b=HmDkN0r7b1A8Z+Elgr9iBmcBb7J0mnzgPPBOgKuRfn8CYrvFUj+REjDAn2KNjsn0Gp
 UKnYdxkwY2cULIX22MQih/ltaxP4pm2cYgEVbl/65XK0qw9yN4w9kPSRNmLMFPcBbF2Q
 0IJ46m/wpL+S8X9UieV1TKVTHvc2DdZvY776Uij6LtUreA1P25IdRbNfVckpa9Tfh8av
 7Vl1F2I6PihTYOznIolalnp8/g/ucLhOR1WY3KoEgJVX3IQzgnrbeqv3hLJjr+o85wNV
 ATHfcAEn/TSlQA9L4Q4ufXIpDhyk/6iZ9b4EgVyw2qMT0RoJo7kM4QQQNH8LR5q8SXGP
 iIzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=cJ3T56q86WJh4iPMi8g+SZkxOUq3V+372P9AQKwaLks=;
 b=VfQDIBSLac02oRAD745LKKltQRc/xwH9nV1hEwyviCsDU0CZU4+b5YgWKWWAt+zsvB
 KkOmNF0hNSpT7KSUIiGLfnGRRFVStWom6I6lrSnkOsT1JUOaDNwDXlO6K6nDSlPBz0sw
 dKS+l7isnkdgA/1GuG6aF/0OKxtaS8yAJsTIBiSuVfpGDoF2jc2hhcw5EoCkkiB1W+jX
 FrYaG4iyh9kIi6S6RR+vH3+eqsZ29W9XWDWgaeMkaBBtlsJNpB/0rbaWrUhSd4ThQU+N
 kY38aaN45kMQasQ744Yx3bvzAk70f9HvYG1yHq9570rAOxbj6QDA6N5OUg2IiiS4+6ER
 X/GA==
X-Gm-Message-State: AOAM5321A3QVyY5oZPwY4qK70FWvAJeCUIMJyWHcYVrfqbpaUdxWDwla
 V9psbGMQYcGQku0SWCUAzSil/qMohMT7+g==
X-Google-Smtp-Source: ABdhPJz2Q02VWGQD9ziCvvBCn+k473UH5Wt42LN7u217Rl0yTDGldkEQyrSIQZtX0iWb/kdfCW9nYQ==
X-Received: by 2002:a1c:9cd8:: with SMTP id f207mr5445019wme.76.1603322363182; 
 Wed, 21 Oct 2020 16:19:23 -0700 (PDT)
Received: from unfall (218.139.134.37.dynamic.jazztel.es. [37.134.139.218])
 by smtp.gmail.com with ESMTPSA id q2sm6415672wrw.40.2020.10.21.16.19.20
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 21 Oct 2020 16:19:21 -0700 (PDT)
From: =?utf-8?Q?Miguel_=C3=81ngel_Arruga_Vivas?= <rosen644835@HIDDEN>
To: Efraim Flashner <efraim@HIDDEN>
Subject: Re: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection.
References: <20201019064739.4736-1-efraim@HIDDEN>
 <87tuuqnym5.fsf@HIDDEN> <20201019140236.GF9117@E5400>
 <87mu0im7r4.fsf@HIDDEN> <20201021070155.GQ9117@E5400>
Date: Thu, 22 Oct 2020 01:18:16 +0200
In-Reply-To: <20201021070155.GQ9117@E5400> (Efraim Flashner's message of "Wed, 
 21 Oct 2020 10:01:55 +0300")
Message-ID: <87blgvjhhj.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 44075
Cc: 44075 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

--=-=-=
Content-Type: text/plain

Hello,

Efraim Flashner <efraim@HIDDEN> writes:
> Your patch was what got me to actually send mine to guix-patches :)

Thanks. :-)

> That is a good point. I'll change it to something actually useful,
> mentioning that there's a convention but that people often get it wrong.

Great, the more knowledge, the easier to overcome that common
misunderstanding. :-)

> I agree it should be renamed to en-us. I have some bikeshedding to think
> about for en-us-glibc-locales vs glibc-locales-en-us. And I'll also test
> out one for glibc-locales-guile-tests.

I meant the ISO-8859-1, the locale creation should be en_EN.iso88591,
the locale name can be en_EN.88591 too...

Although in that case shouldn't be glibc-en-us-locales?  I'd like green
lights for the bike shed, please. ;-)

> I hadn't seen gnu/build/locales.scm. I'll have to see what we can do
> about using it. We normally don't allow cross-over from the build side
> to the packages side.

It is already being used in the build of glibc-locales and I guess it
would be harmless to move it to guix build if that is a problem, but I
think it can be used as it is right now, even I didn't check yet.  In
this for-each(gnu/packages/base.scm:1084), for example:
------------------------->8-------------begin----------------------
(for-each (lambda (directory)
            (let*-values (((base)
                           (basename directory))
                          ((name codeset)
                           (locale->name+codeset base))
                          ((normalized)
                           (normalize-codeset codeset)))
              (unless (string=? codeset normalized)
                (symlink base
                         (string-append (dirname directory)
                                        "/" name "."
                                        normalized)))))
          locales)
-------------------------8<--------------end-----------------------

I would write something like this in the builder code:
------------------------->8-------------begin----------------------
(define (locale-builder directory)
  (lambda (locale)
    (let-values (((name codeset)
                  (locale->name+codeset)))
      (if codeset
          (build-locale name
                        #:directory directory
                        #:codeset (normalize-codeset codeset))
          (build-locale name
                        #:directory directory
                        #:codeset "utf8")))))
(let ...
  (for-each (locale-builder localedir) '(,@locales))
  ...)
-------------------------8<--------------end-----------------------

I leave you here the function I was hacking apart (please, do not
confuse with working code ;-)) if you want to take any idea other from
it:
------------------------->8-------------begin----------------------
(define*-public (make-glibc-selected-locales
                 glibc
                 #:key
                 (suffix "-utf8-locales")
                 (locales %default-locales)
                 (alias %default-alias))
  (package
    (name (string-append (package-name glibc) suffix))
    (version (package-version glibc))
    (source #f)
    (build-system trivial-build-system)
    (arguments
     `(#:modules ((guix build utils) (gnu build locale))
       #:builder
       (begin
         (use-modules (guix build utils) (gnu build locale))
         ;; Print the common alias for locale
         (define (print-locale-alias locale)
           (let-values (((name codeset)
                         (locale->name+codeset)))
             (if codeset
                 (or (string-equal codeset (normalize-codeset codeset))
                     (format #t "~a.~a ~a.~a~%" name codeset
                             name (normalize-codeset codeset)))
                 (format #t "~a.UTF-8 ~a.utf8" name name))))

         ;; Generate a function that builds the locale into directory.
         (define (locale-builder directory)
           (lambda (locale)
             (let-values (((name codeset)
                           (locale->name+codeset)))
               (if codeset
                   (build-locale name
                                 #:directory directory
                                 #:codeset (normalize-codeset codeset))
                   (build-locale name
                                 #:directory directory
                                 #:codeset "utf8")))))

         ;; Do the job.
         (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)))
                (alias     (string-append localedir "/locale.alias"))
                (locales   '(,@locales)))

           ;; 'localedef' needs 'gzip'.
           (setenv "PATH" (string-append libc "/bin:" gzip "/bin"))

           (mkdir-p localedir)
           ;; Generate each locale provided.
           (for-each (locale-builder localedir) locales)
           ;; Generate alias file.
           (with-output-to-file alias
             (lambda ()
               (format #t "~a~%" "# Aliases for common codeset names.")
               (for-each print-locale-alias locales)
               (format #t "~a~%" "# Other aliases.")
               (for-each (lambda (line)
                           (format #t "~a~%" line))
                         '(,@alias)))))))
    (native-inputs `(("glibc" ,glibc)
                     ("gzip" ,gzip)))
    (synopsis "Configured sample of locales")
    (description
     "TODO.")
    (home-page (package-home-page glibc))
    (license (package-license glibc))))
-------------------------8<--------------end-----------------------

Happy hacking,
Miguel

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEEiIeExBRZrMuD5+hMY0xuiXn6vsIFAl+QwbgACgkQY0xuiXn6
vsIAwwv/V+iIDRtlXgmgrhnCHBkNBV8gIadbxLQxZnc1so/psQbcGDThb1whjL4J
EsAEpGvzSD5XFmahmv2vaRcoTAaeCKgYpWH/NXyXuzop00dteXctvq302WhEUB35
qVobkwJrff/Qfw+xvoHYyz+cGWLTQdKnD+v8D2RYyRxDjj528CSpOI8cDtTU2oSV
8KbzSnEtCPfLHRjyj96ZNzDPtLpbq0ROIFV2G9qqNahXE5pEDi10Bu8iiAnwn95e
GTXCSARMrtrSQtg81wnOS+A8UgpTpGiN6el3fjOVuolx64n6aZJYJQze2s64Wmtc
3z1jMFXhdvKzhdU5vjnBG9FWXc7FMZv36ry/QLh/CQpGVDp75yng9PcTzZw8IwEB
k6rJNJGz7hG4uuzQdS0OjrMNX7XhNMUGlRHkeUSm1bLGS/HymiRQG3EeLU24o85O
3xrOyI4SZspr9e3opINLUMNu0no5N0tOrhDnQhBe9OK9xGclpM2oiQ4z901nAMNh
9JZfbd7K
=X5L6
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#44075; Package guix-patches. Full text available.

Message received at 44075 <at> debbugs.gnu.org:


Received: (at 44075) by debbugs.gnu.org; 21 Oct 2020 17:09:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 21 13:09:16 2020
Received: from localhost ([127.0.0.1]:50400 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kVHbv-0007Rf-Ry
	for submit <at> debbugs.gnu.org; Wed, 21 Oct 2020 13:09:16 -0400
Received: from eggs.gnu.org ([209.51.188.92]:36874)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1kVHbu-0007RR-73
 for 44075 <at> debbugs.gnu.org; Wed, 21 Oct 2020 13:09:14 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:53642)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1kVHbo-0002QB-Um; Wed, 21 Oct 2020 13:09:08 -0400
Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=44306 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <ludo@HIDDEN>)
 id 1kVHbo-0005Cg-9O; Wed, 21 Oct 2020 13:09:08 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Efraim Flashner <efraim@HIDDEN>
Subject: Re: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection.
References: <20201019064739.4736-1-efraim@HIDDEN>
Date: Wed, 21 Oct 2020 19:09:06 +0200
In-Reply-To: <20201019064739.4736-1-efraim@HIDDEN> (Efraim Flashner's
 message of "Mon, 19 Oct 2020 09:47:39 +0300")
Message-ID: <878sbz1p71.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 44075
Cc: 44075 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi!

Efraim Flashner <efraim@HIDDEN> skribis:

> * gnu/packages/base.scm (make-glibc-locales-collection): New macro.
> (en_us-glibc-locales): New variable.

Cool!

A while back I posted the attached patch, which reuses existing code
from (gnu system locale) and (gnu packages base).  I think I used it
just to see how much space all the UTF-8 locales take, compared to all
the locales.

Would it make sense to borrow from that?

At any rate, it=E2=80=99s the kind of package that=E2=80=99ll be more usefu=
l if/when we
have parameterized packages.

Ludo=E2=80=99.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index c83775d8ee..3fc43b04da 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -53,6 +53,8 @@
   #:use-module (gnu packages python)
   #:use-module (gnu packages gettext)
   #:use-module (guix utils)
+  #:use-module (guix gexp)
+  #:use-module (guix modules)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
@@ -62,6 +64,8 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (glibc
+            %default-utf8-locales
+            make-glibc-utf8-locales
             libiconv-if-needed))
 
 ;;; Commentary:
@@ -1106,7 +1110,12 @@ 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
+  '("de_DE" "el_GR" "en_US" "fr_FR" "tr_TR"))
+
+(define* (make-glibc-utf8-locales glibc #:optional
+                                  (locales %default-utf8-locales)
+                                  (locale-file #f))
   (package
     (name "glibc-utf8-locales")
     (version (package-version glibc))
@@ -1145,10 +1154,17 @@ to the @code{share/locale} sub-directory of this package.")
 
                                ;; 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"))
+                               ,(if locale-file
+                                    `(call-with-input-file
+                                         (assoc-ref %build-inputs "locale-file")
+                                       read)
+                                    `',locales))
                      #t))))
     (native-inputs `(("glibc" ,glibc)
-                     ("gzip" ,gzip)))
+                     ("gzip" ,gzip)
+                     ,@(if locale-file
+                           `(("locale-file" ,locale-file))
+                           '())))
     (synopsis "Small sample of UTF-8 locales")
     (description
      "This package provides a small sample of UTF-8 locales mostly useful in
@@ -1169,6 +1185,40 @@ test environments.")
   (package (inherit (make-glibc-utf8-locales glibc-2.29))
            (name "glibc-utf8-locales-2.29")))
 
+(define (glibc-supported-locales libc)
+  ((module-ref (resolve-interface '(gnu system locale)) ;FIXME: hack
+               'glibc-supported-locales)
+   libc))
+
+(define* (make-glibc-utf8-locales/full #:optional (glibc glibc))
+  (define utf8-locales
+    (computed-file "glibc-supported-utf8-locales.scm"
+                   #~(begin
+                       (use-modules (srfi srfi-1)
+                                    (ice-9 match)
+                                    (ice-9 pretty-print))
+
+                       (define locales
+                         (call-with-input-file
+                             #+(glibc-supported-locales glibc)
+                           read))
+
+                       (define utf8-locales
+                         (filter-map (match-lambda
+                                       ((name . "UTF-8")
+                                        (if (string-suffix? ".UTF-8" name)
+                                            (string-drop-right name 6)
+                                            name))
+                                       (_ #f))
+                                     locales))
+
+                       (call-with-output-file #$output
+                         (lambda (port)
+                           (pretty-print utf8-locales port))))))
+
+  (make-glibc-utf8-locales glibc #:locale-file utf8-locales))
+
+
 (define-public which
   (package
     (name "which")

--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#44075; Package guix-patches. Full text available.

Message received at 44075 <at> debbugs.gnu.org:


Received: (at 44075) by debbugs.gnu.org; 21 Oct 2020 07:02:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 21 03:02:35 2020
Received: from localhost ([127.0.0.1]:47608 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kV88p-0007qT-CQ
	for submit <at> debbugs.gnu.org; Wed, 21 Oct 2020 03:02:35 -0400
Received: from flashner.co.il ([178.62.234.194]:42802)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <efraim@HIDDEN>) id 1kV88n-0007qF-SG
 for 44075 <at> debbugs.gnu.org; Wed, 21 Oct 2020 03:02:34 -0400
Received: from localhost (unknown [141.226.13.8])
 by flashner.co.il (Postfix) with ESMTPSA id 79CE74064F;
 Wed, 21 Oct 2020 07:02:27 +0000 (UTC)
Date: Wed, 21 Oct 2020 10:01:55 +0300
From: Efraim Flashner <efraim@HIDDEN>
To: Miguel =?utf-8?B?w4FuZ2Vs?= Arruga Vivas <rosen644835@HIDDEN>
Subject: Re: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection.
Message-ID: <20201021070155.GQ9117@E5400>
References: <20201019064739.4736-1-efraim@HIDDEN>
 <87tuuqnym5.fsf@HIDDEN> <20201019140236.GF9117@E5400>
 <87mu0im7r4.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature"; boundary="X9hp/qFlD/MyfJCu"
Content-Disposition: inline
In-Reply-To: <87mu0im7r4.fsf@HIDDEN>
X-PGP-Key-ID: 0x41AAE7DCCA3D8351
X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc
X-PGP-Fingerprint: A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 44075
Cc: 44075 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--X9hp/qFlD/MyfJCu
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Oct 19, 2020 at 07:43:27PM +0200, Miguel =C3=81ngel Arruga Vivas wr=
ote:
> Hello,
>=20
> Efraim Flashner <efraim@HIDDEN> writes:
> > Thanks for taking a look.
>=20
> No problem at all, I was thinking about something along these lines too,
> but then I saw your patch. :-)

Your patch was what got me to actually send mine to guix-patches :)

> > For the utf8 vs UTF-8 there are a couple of comments in the code:
> > The above phase does not install locales with names using
> > the "normalized codeset."  Thus, create symlinks like:
> > en_US.utf8 -> en_US.UTF-8
> >
> > and also:
> > For backward compatibility with Guix
> > <=3D 0.8.3, add "xx_YY.UTF-8".
>=20
> Yes, what I mean is that the comments along the code may need to be
> clarified, but adding a "nobody knows" doesn't add much information.

That is a good point. I'll change it to something actually useful,
mentioning that there's a convention but that people often get it wrong.

> The actual source[1] says that the correct value is utf8, following
> the rules for the 'normalized codeset' naming, that I copy here:
>=20
>   1. Remove all characters besides numbers and letters.
>   2. Fold letters to lowercase.
>   3. If the same only contains digits prepend the string =E2=80=98"iso"=
=E2=80=99.
>=20
> We should stick to that naming regarding libc locales (note to self),
> even though we keep the links for compatibility.  That includes the
> other locale at en_us-glibc-locales.

I agree it should be renamed to en-us. I have some bikeshedding to think
about for en-us-glibc-locales vs glibc-locales-en-us. And I'll also test
out one for glibc-locales-guile-tests.

> >> What do you think about replacing make-glibc-utf8-locales with a call =
of
> >> the new function (using that code) ensuring that the generated
> >> derivation stays the same for that case (i.e. it's optimized for the
> >> UTF-8 case)?
> >
> > This is what I originally wanted to do, but there's a glibc-locales
> > buried in the bootstrap path so it's not so easy to just swap it out.
>=20
> I guess you mean glibc-utf8-locales, if not I'm missing where that
> reference could come from.  That's why I insist on leaving exactly the
> same derivation.

I meant in commencement.scm. There's a glibc-utf8-locales-final near the
definition for %boot5-inputs.

> > I can make the change in core-updates. I'll play around with it and
> > see if I can come out with the same derivation using a different
> > function, but I'm not expecting it to turn out identical.
>=20
> The colour of my lisp-rate belt isn't even close to some you can see
> around here but I could bring you some help if you want, because I think
> it's easier to do it without any change in current packages than it
> might sound.  Not the definitions in scheme, of course, I mean the
> derivations the daemon actually sees.
>=20
> Said this, I've seen that [single-]locale-directory does mostly the
> same, and there is a build-locale function in gnu/build/locale.scm... so
> I'm starting to see as a better idea to clean up glibc-utf8-locales up
> in core-updates using the latter, as it would lead to cleaner code for
> the builder.
>=20
> Could you check that and tell if you consider feasible what I propose?

I hadn't seen gnu/build/locales.scm. I'll have to see what we can do
about using it. We normally don't allow cross-over from the build side
to the packages side.

> Happy hacking!
> Miguel
>=20
> [1] info "(libc)Using gettextized software"

--=20
Efraim Flashner   <efraim@HIDDEN>   =D7=90=D7=A4=D7=A8=D7=99=D7=9D =
=D7=A4=D7=9C=D7=A9=D7=A0=D7=A8
GPG key =3D A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

--X9hp/qFlD/MyfJCu
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl+P3OAACgkQQarn3Mo9
g1Es1Q/8CNLcoZtmwR/84oN5iZF+f+U5jqgaPAi/r9/VjnREPvhVPxiAMbwDBLlO
2vxB6kxn+iP9sDKpcafNNdNHSbOe98blIb/+xXBbG48dzw9Jncq2abN77970MJXg
5S70r1t01iX4qHl46YqttFyWhYVrMoadRj7hJrMzAnTlO8/yAimNDWhf+Z6VHv5n
qHiUpdYZXlNdnpcI851OueqIEqNCn7+FF5O9oF9g3qlfEL8F+NyuvWd0zmXAjcfg
UnmMKHjMXvopx8v/YSyo+gP+XPpJzEtvW6rD3EeAMFQE67UNU3sKJNytpubtZ4a+
5xielVXNS/ndvbOLrP/8+lESv1YJHrPWQLtiufEwqBkEfCwtJIHnL37ceODgXSWN
v9rs0MFC8F2BGqBqyHn7SSVfTc+nW/RmSv8vymbsKPwZqqTXmNWNFZxe6CmLpkCc
1NwnrMAx0VyODPCd20e7deJxScjDNz2nXGCkR2usy2/AY88wQABYVduecUO8uu8g
5Zyya3BuJ77IKzFRBovgYfK0DOSBaTt1Ly9pp/SqeLKwx5H2h9faFPKigl3CDE9P
ZJfaG0DyJBZQ3+E2JXW+gOiExwfa32OMEf+GtYYI/yVj6+Hi0n9v3MF8IMQwiA/3
7JiQiwdYSZCu6AyfqxdtCq8SLEONhxqxl1PpUEU03dLyBy9jV2s=
=eAqn
-----END PGP SIGNATURE-----

--X9hp/qFlD/MyfJCu--




Information forwarded to guix-patches@HIDDEN:
bug#44075; Package guix-patches. Full text available.

Message received at 44075 <at> debbugs.gnu.org:


Received: (at 44075) by debbugs.gnu.org; 19 Oct 2020 17:44:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 19 13:44:34 2020
Received: from localhost ([127.0.0.1]:42292 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kUZD0-00020C-A3
	for submit <at> debbugs.gnu.org; Mon, 19 Oct 2020 13:44:34 -0400
Received: from mail-wm1-f67.google.com ([209.85.128.67]:36069)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rosen644835@HIDDEN>) id 1kUZCw-0001zw-O8
 for 44075 <at> debbugs.gnu.org; Mon, 19 Oct 2020 13:44:32 -0400
Received: by mail-wm1-f67.google.com with SMTP id e2so378264wme.1
 for <44075 <at> debbugs.gnu.org>; Mon, 19 Oct 2020 10:44:30 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=b9LQTHmeg1AK9QW5vyhvTdPoeLDB+lQ1GoJrgGhdEIE=;
 b=ptmsmJ5sSdy7fNep62eeFhx41IovaihpZhnyYbYyjwVoNDN9txGQ3moCoNRqQ5T7Oa
 Sf+Paiv0MR6yEpeQp8m7Ub2lfdP18ym1AJeRvmd2IU47sIoMHPRVZib0fnkECZrzXwNo
 BW8qJjuajxkQ112CCAeiHJ2MdI9KTvp99TRz7sI0Bp/YfsWpFJGsUaAEG1Idg5W1qHye
 Wxm0goy52uAKXldnY5fvN0PKjYDlvlReJVboK5dIuTC/LK8enKJcmIgZnx+o0yVi/b0s
 epe/J6/Di46kD6GueRRJdu2E+iRwa1lQl0a8Y5SrM9ycFvILcTRcTCtNaRPByW+iQKgL
 +Orw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=b9LQTHmeg1AK9QW5vyhvTdPoeLDB+lQ1GoJrgGhdEIE=;
 b=R3Nt7DB2BjWtYoZs+OhYagPfsBwQSRYtn3i6YHCwWYC8Jj3NWZv5hL+1uwTPupvS98
 8Z1FB9gjr8Enp2iXfBqUHEF282xOgj2jZjqIU/ItCG4XJ4Lqp42NXXdZmLP3Ekz2+nbO
 OnhldRJPcu9wYp3xI7EZfuGM0W9gzv6rYwq+cAmYJex9UySQZfsLGgR77gP1Tkv0ibAd
 K3mmxaYCWqIlFRcS0uVWpIoSa0OOUiwWxqnoh1UJmnldRHV7qgeR6ZCJKffiRRt3Vwvp
 0RSDcx3+yrqu/DDF/Y2ZUrJpYrVqa44B2hVfg/WI3IJegb7vRAlze4vlwoJwAj4WXjEd
 r3ag==
X-Gm-Message-State: AOAM530FipMsRjz9+5yvDfpgfAmQ91ndPAwqetEiJq6TLTZqbGBqaIEP
 FJACto0jiDWa7RfAgqnsZkccoqkmJ3k7Pdhv
X-Google-Smtp-Source: ABdhPJzMPzzdS56eOtju2tOFjFSIEfAA2mt8vcie6zSliUw4nmVxVYGWZnUR9mu0UyvU+TmKqB5Tug==
X-Received: by 2002:a7b:c8c9:: with SMTP id f9mr369953wml.162.1603129464348;
 Mon, 19 Oct 2020 10:44:24 -0700 (PDT)
Received: from unfall (218.139.134.37.dynamic.jazztel.es. [37.134.139.218])
 by smtp.gmail.com with ESMTPSA id w4sm353128wmi.10.2020.10.19.10.44.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 19 Oct 2020 10:44:23 -0700 (PDT)
From: =?utf-8?Q?Miguel_=C3=81ngel_Arruga_Vivas?= <rosen644835@HIDDEN>
To: Efraim Flashner <efraim@HIDDEN>
Subject: Re: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection.
References: <20201019064739.4736-1-efraim@HIDDEN>
 <87tuuqnym5.fsf@HIDDEN> <20201019140236.GF9117@E5400>
Date: Mon, 19 Oct 2020 19:43:27 +0200
In-Reply-To: <20201019140236.GF9117@E5400> (Efraim Flashner's message of "Mon, 
 19 Oct 2020 17:02:36 +0300")
Message-ID: <87mu0im7r4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 44075
Cc: 44075 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Hello,

Efraim Flashner <efraim@HIDDEN> writes:
> Thanks for taking a look.

No problem at all, I was thinking about something along these lines too,
but then I saw your patch. :-)

> For the utf8 vs UTF-8 there are a couple of comments in the code:
> The above phase does not install locales with names using
> the "normalized codeset."  Thus, create symlinks like:
> en_US.utf8 -> en_US.UTF-8
>
> and also:
> For backward compatibility with Guix
> <=3D 0.8.3, add "xx_YY.UTF-8".

Yes, what I mean is that the comments along the code may need to be
clarified, but adding a "nobody knows" doesn't add much information.
The actual source[1] says that the correct value is utf8, following
the rules for the 'normalized codeset' naming, that I copy here:

  1. Remove all characters besides numbers and letters.
  2. Fold letters to lowercase.
  3. If the same only contains digits prepend the string =E2=80=98"iso"=E2=
=80=99.

We should stick to that naming regarding libc locales (note to self),
even though we keep the links for compatibility.  That includes the
other locale at en_us-glibc-locales.

>> What do you think about replacing make-glibc-utf8-locales with a call of
>> the new function (using that code) ensuring that the generated
>> derivation stays the same for that case (i.e. it's optimized for the
>> UTF-8 case)?
>
> This is what I originally wanted to do, but there's a glibc-locales
> buried in the bootstrap path so it's not so easy to just swap it out.

I guess you mean glibc-utf8-locales, if not I'm missing where that
reference could come from.  That's why I insist on leaving exactly the
same derivation.

> I can make the change in core-updates. I'll play around with it and
> see if I can come out with the same derivation using a different
> function, but I'm not expecting it to turn out identical.

The colour of my lisp-rate belt isn't even close to some you can see
around here but I could bring you some help if you want, because I think
it's easier to do it without any change in current packages than it
might sound.  Not the definitions in scheme, of course, I mean the
derivations the daemon actually sees.

Said this, I've seen that [single-]locale-directory does mostly the
same, and there is a build-locale function in gnu/build/locale.scm... so
I'm starting to see as a better idea to clean up glibc-utf8-locales up
in core-updates using the latter, as it would lead to cleaner code for
the builder.

Could you check that and tell if you consider feasible what I propose?

Happy hacking!
Miguel

[1] info "(libc)Using gettextized software"




Information forwarded to guix-patches@HIDDEN:
bug#44075; Package guix-patches. Full text available.

Message received at 44075 <at> debbugs.gnu.org:


Received: (at 44075) by debbugs.gnu.org; 19 Oct 2020 14:03:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 19 10:03:25 2020
Received: from localhost ([127.0.0.1]:41931 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kUVkv-0006ra-Uj
	for submit <at> debbugs.gnu.org; Mon, 19 Oct 2020 10:03:25 -0400
Received: from flashner.co.il ([178.62.234.194]:36580)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <efraim@HIDDEN>) id 1kUVkq-0006rI-6W
 for 44075 <at> debbugs.gnu.org; Mon, 19 Oct 2020 10:03:20 -0400
Received: from localhost (unknown [141.226.13.8])
 by flashner.co.il (Postfix) with ESMTPSA id 2944840223;
 Mon, 19 Oct 2020 14:03:09 +0000 (UTC)
Date: Mon, 19 Oct 2020 17:02:36 +0300
From: Efraim Flashner <efraim@HIDDEN>
To: Miguel =?utf-8?B?w4FuZ2Vs?= Arruga Vivas <rosen644835@HIDDEN>
Subject: Re: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection.
Message-ID: <20201019140236.GF9117@E5400>
References: <20201019064739.4736-1-efraim@HIDDEN>
 <87tuuqnym5.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature"; boundary="sClP8c1IaQxyux9v"
Content-Disposition: inline
In-Reply-To: <87tuuqnym5.fsf@HIDDEN>
X-PGP-Key-ID: 0x41AAE7DCCA3D8351
X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc
X-PGP-Fingerprint: A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 44075
Cc: 44075 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)


--sClP8c1IaQxyux9v
Content-Type: multipart/mixed; boundary="s5/bjXLgkIwAv6Hi"
Content-Disposition: inline


--s5/bjXLgkIwAv6Hi
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Oct 19, 2020 at 03:17:54PM +0200, Miguel =C3=81ngel Arruga Vivas wr=
ote:
> Hi Efraim,
>=20
> I've been taking a look into your patch.  One issue are the comments
> about utf8 and UTF-8, as the issue is already explained in
> make-glibc[-utf8]-locales.

Thanks for taking a look. For the utf8 vs UTF-8 there are a couple of
comments in the code:
The above phase does not install locales with names using
the "normalized codeset."  Thus, create symlinks like:
en_US.utf8 -> en_US.UTF-8

and also:
For backward compatibility with Guix
<=3D 0.8.3, add "xx_YY.UTF-8".

When I check on one of my Debian boxes:
$localectl list-locales
C.UTF-8
en_US.utf8

I've learned that 'C.UTF-8' isn't from upstream, Debian has a patch for
it. Having written this patch a week or so ago and returning to it I
can't tell you which is the correct one. I think it's best to offer both
so it's not confusing which is correct. That works for the logic for
accepting either in the list of locales, but I'm concerned that skipping
the symlink to the other one could cause problems.

>=20
> Other point is:
>=20
> Efraim Flashner <efraim@HIDDEN> writes:
> > +(define* (make-glibc-locales-collection
> > +           glibc
> > +           #:optional (locales
> > +                        '(list "en_US.utf8" "en_US.ISO-8859-1")))
> > (... Removed for clarity ...)
> > +             ,locales)
>=20
> I would have used list there like (list ,@locales) or '(,@locales), this
> looks a bit odd to my eyes at least.  I'd expect this kind of calling cod=
e:
>=20
> (let ((locales '("de_CH.utf8" ... "de_DE.utf8"))
>       (my-glibc ...))
>   (make-glibc-locales-collection myglibc locales))
>=20
> Enforcing an extra quotation for no real reason on the calling site, as
> strings are self-evaluating objects, and the use of the symbol list,
> whose meaning depends on other context of execution, doesn't seem
> necessary.  Even worse, my example would raise an error as "de_CH.utf8"
> is not a procedure.

My scheme-foo isn't terribly strong, sometimes I just hack at it until
the code does what I want, and this is one of those times. I've changed
it so that locales takes a list and not an item that is a list.

> What do you think about replacing make-glibc-utf8-locales with a call of
> the new function (using that code) ensuring that the generated
> derivation stays the same for that case (i.e. it's optimized for the
> UTF-8 case)?

This is what I originally wanted to do, but there's a glibc-locales
buried in the bootstrap path so it's not so easy to just swap it out. I
can make the change in core-updates. I'll play around with it and see if
I can come out with the same derivation using a different function, but
I'm not expecting it to turn out identical.

>=20
> Happy hacking!
> Miguel
>=20



--=20
Efraim Flashner   <efraim@HIDDEN>   =D7=90=D7=A4=D7=A8=D7=99=D7=9D =
=D7=A4=D7=9C=D7=A9=D7=A0=D7=A8
GPG key =3D A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

--s5/bjXLgkIwAv6Hi
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="v2-0001-gnu-Add-make-glibc-locales-collection.patch"
Content-Transfer-Encoding: quoted-printable

=46rom 3c2dfe702ad1c62b2f73a1f1036da3bcfa007c15 Mon Sep 17 00:00:00 2001
=46rom: Efraim Flashner <efraim@HIDDEN>
Date: Thu, 1 Oct 2020 22:50:32 +0300
Subject: [PATCH v2] gnu: Add make-glibc-locales-collection.

* gnu/packages/base.scm (make-glibc-locales-collection): New macro.
(en_us-glibc-locales): New variable.
---
 gnu/packages/base.scm | 73 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 72 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index c83775d8ee..4ea31c2ab6 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -62,7 +62,8 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (glibc
-            libiconv-if-needed))
+            libiconv-if-needed
+            make-custom-glibc-locales))
=20
 ;;; Commentary:
 ;;;
@@ -1106,6 +1107,69 @@ to the @code{share/locale} sub-directory of this pac=
kage.")
                                         ,(version-major+minor
                                           (package-version glibc)))))))))))
=20
+(define* (make-glibc-locales-collection
+           glibc
+           #:optional (locales
+                        (list "en_US.utf8" "en_US.ISO-8859-1")))
+                        ;; This list for testing
+                        ;(list "el_GR.UTF-8" "en_US.utf8" "he_IL.ISO-8859-=
8" "ja_JP.EUC-JP" "zh_CN.GB18030" "zh_CN.GBK" "hy_AM.ARMSCII-8")))
+  (package
+    (name "glibc-locales-collection")
+    (version (package-version glibc))
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     `(#: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"))
+
+           (mkdir-p localedir)
+           (for-each
+             (lambda (locale)
+               (let* ((contains-dot? (string-index locale #\.))
+                      (encoding-type (substring locale (1+ contains-dot?)))
+                      (raw-locale    (substring locale 0 contains-dot?))
+                      (utf8? (or (number? (string-contains locale ".utf8"))
+                                 (number? (string-contains locale ".UTF-8"=
))))
+                      (file (if utf8?
+                              (string-append localedir "/" raw-locale ".ut=
f8")
+                              (if (string-contains locale ".ISO")
+                                (string-append localedir "/" raw-locale)
+                                (string-append localedir "/" locale)))))
+
+                 (invoke "localedef" "--no-archive"
+                         "--prefix" localedir
+                         "-i" raw-locale
+                         "-f" (if (equal? "utf8" encoding-type)
+                                "UTF-8"
+                                encoding-type)
+                         file)
+
+                 ;; Is it utf8 or UTF-8? NO ONE KNOWS!
+                 (when utf8?
+                   (symlink (string-append raw-locale ".utf8")
+                            (string-append localedir "/"
+                                           raw-locale ".UTF-8")))))
+             (list ,@locales))
+           #t))))
+    (native-inputs `(("glibc" ,glibc)
+                     ("gzip" ,gzip)))
+    (synopsis "Customizable collection of locales")
+    (description
+     "This package provides a custom collection of locales useful for
+providing exactly the locales requested when size matters.")
+    (home-page (package-home-page glibc))
+    (license (package-license glibc))))
+
 (define-public (make-glibc-utf8-locales glibc)
   (package
     (name "glibc-utf8-locales")
@@ -1161,6 +1225,13 @@ test environments.")
 (define-public glibc-utf8-locales
   (make-glibc-utf8-locales glibc))
=20
+(define-public en_us-glibc-locales
+  (package
+    (inherit (make-glibc-locales-collection
+               glibc
+               (list "en_US.utf8" "en_US.ISO-8859-1")))
+    (name "en-us-glibc-locales")))
+
 ;; Packages provided to ease use of binaries linked against the previous l=
ibc.
 (define-public glibc-locales-2.29
   (package (inherit (make-glibc-locales glibc-2.29))
--=20
2.28.0


--s5/bjXLgkIwAv6Hi--

--sClP8c1IaQxyux9v
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAl+NnHwACgkQQarn3Mo9
g1Hr9w//QqDSEeBZTuHDJc7Bq75J/9U7oI5+HACp8TwyRzY2W2Rc44SQwgGeZmFb
Cu4mc2pxTaZ7/C2V1eJf794+/ACv52sVzSQAyxZCXz8xvYf7ALsHT640y99vdThf
DtMh8uPjJXkg2Lc01npUmB8oGEMriofYNMPeEcWcPnV4c3LmGTW1owvcgzVT9kBo
y1LGqbY939/kYriI4HvaEbh1+lMwuG+kQONSg9Qp1Pn+C4NlVa9BtGsNiIJ7+GXS
7LP0TCCZBtc4hKRB411P8Y5WGeB7LbC11ZW7lYzfFeTKSFthHuwAuHvLSITRJh+7
E+sjSJ0wqLzqOuGJEcc5HGtkywnm2wiYLriux7HMDTyj/NkCVpgIpuMRa8Il2jDJ
Kw0EPFuf7ov0i3+4y4Ix7VJ+T0BgVZQ285O8b+6UGNgJSISdKe90OSVSvbvwiQX4
4xWJZDnfeM5caWrxTjT36jCvXKDa7NFc/1LjWw9oFbntVrUh/N+aQmzKjsNmnZSB
A5kJvyVwC0jIv4WZGgcxbBvhIge7nl100zew+UsjKuSYUYFPASp66D3+IKKi0JYv
liUM44iHsNovns2JTgFg8li7P8z0Yp5nccO2b08At9KK9JsF8dvcEhTtia6PFfkr
BkoCG0WK7LiNW/ulPx57oLU2Ql05Gvl7M5YAywo30ZhiTaNrybI=
=Tdd4
-----END PGP SIGNATURE-----

--sClP8c1IaQxyux9v--




Information forwarded to guix-patches@HIDDEN:
bug#44075; Package guix-patches. Full text available.

Message received at 44075 <at> debbugs.gnu.org:


Received: (at 44075) by debbugs.gnu.org; 19 Oct 2020 13:19:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 19 09:19:09 2020
Received: from localhost ([127.0.0.1]:40231 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kUV49-0005C6-GB
	for submit <at> debbugs.gnu.org; Mon, 19 Oct 2020 09:19:09 -0400
Received: from mail-wr1-f68.google.com ([209.85.221.68]:34375)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rosen644835@HIDDEN>) id 1kUV46-0005BX-Eg
 for 44075 <at> debbugs.gnu.org; Mon, 19 Oct 2020 09:19:07 -0400
Received: by mail-wr1-f68.google.com with SMTP id i1so11428405wro.1
 for <44075 <at> debbugs.gnu.org>; Mon, 19 Oct 2020 06:19:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=LDPSti9WyLl7H2ORU/Pv+HgeK2bf7hJrqbFNNqqPHIE=;
 b=FGA56l3pl4j77/6FNm5g9M6vuq+22EKPraOFMqmFjblJOjnxfVNyiasLzRPSkHwVgq
 nb5SHgBtnf/Y17J39EPU5n33JmhmyKUN8BqHnW04RarX/xq6VtMEtijbE6CX87B1h6vC
 DsGk7nyL1bdj8u4tZudrFFqg5ZpTpoU0jwvULw4vNQUPr30ObKYg39ieAKL/A+3cVB8O
 IWftQPZK6TMPPYu16shrPCPbw796mibFGYIHX4lMQVZRYZ/3yQUpCRaCAo1sKt31vqxN
 /yIhMmNNVwum+3qDJ1GB5158MHlyfxbn+RO/gRGcQqhJDMn9NrbGWM2QukDGijx5JIsl
 2ecw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=LDPSti9WyLl7H2ORU/Pv+HgeK2bf7hJrqbFNNqqPHIE=;
 b=qBseB+SEB2avVPjbx4sTLmEDXnXN0gnNwVJW4hLs47y6c38SnJpM6agkLoGvc4eadZ
 mCx8JCqfz7H77xsTKIcsRmnVkMtryrYkg+P/fvMaUf5qG/amciHlPyKcDLmQ8j+IB5IE
 Czc10TqaKIsGq2S9XGN+pC4WNSpUdxgn1hMY3tuksAHavEnSdsQ1O9d22K08aNQJBvxr
 NHY8wwmIuWXvy7xVRnMVI8n7eR76fYX+UWMwpKMnBvZs+kDake63JWKdeHUVpYRjTnlu
 0inku23aLMASjpSc36+n7Dd0TEyJA3CrvQq7dtcZcCCL3tmm129o5iqAGMY24rMZysmw
 DT6w==
X-Gm-Message-State: AOAM530TogC4jLc+4tlb01iTHllPOpaXYOxECqN6ZEFcf4AbRMXoW+vd
 QMm3Oa0sur1c9F7DcYqBUL5HMZ6iy8OjBgJi
X-Google-Smtp-Source: ABdhPJx5anCdut6R1Uvo8KmBz92K3h1jex9k1cy6J1IK7vsry/UaqH/Zm7P1Xt0wpYFJ0kCArMab2Q==
X-Received: by 2002:a5d:4010:: with SMTP id n16mr18902249wrp.97.1603113540302; 
 Mon, 19 Oct 2020 06:19:00 -0700 (PDT)
Received: from unfall (218.139.134.37.dynamic.jazztel.es. [37.134.139.218])
 by smtp.gmail.com with ESMTPSA id p9sm9383wma.12.2020.10.19.06.18.58
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 19 Oct 2020 06:18:59 -0700 (PDT)
From: =?utf-8?Q?Miguel_=C3=81ngel_Arruga_Vivas?= <rosen644835@HIDDEN>
To: Efraim Flashner <efraim@HIDDEN>
Subject: Re: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection.
References: <20201019064739.4736-1-efraim@HIDDEN>
Date: Mon, 19 Oct 2020 15:17:54 +0200
In-Reply-To: <20201019064739.4736-1-efraim@HIDDEN> (Efraim Flashner's
 message of "Mon, 19 Oct 2020 09:47:39 +0300")
Message-ID: <87tuuqnym5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 44075
Cc: 44075 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

--=-=-=
Content-Type: text/plain

Hi Efraim,

I've been taking a look into your patch.  One issue are the comments
about utf8 and UTF-8, as the issue is already explained in
make-glibc[-utf8]-locales.

Other point is:

Efraim Flashner <efraim@HIDDEN> writes:
> +(define* (make-glibc-locales-collection
> +           glibc
> +           #:optional (locales
> +                        '(list "en_US.utf8" "en_US.ISO-8859-1")))
> (... Removed for clarity ...)
> +             ,locales)

I would have used list there like (list ,@locales) or '(,@locales), this
looks a bit odd to my eyes at least.  I'd expect this kind of calling code:

(let ((locales '("de_CH.utf8" ... "de_DE.utf8"))
      (my-glibc ...))
  (make-glibc-locales-collection myglibc locales))

Enforcing an extra quotation for no real reason on the calling site, as
strings are self-evaluating objects, and the use of the symbol list,
whose meaning depends on other context of execution, doesn't seem
necessary.  Even worse, my example would raise an error as "de_CH.utf8"
is not a procedure.

What do you think about replacing make-glibc-utf8-locales with a call of
the new function (using that code) ensuring that the generated
derivation stays the same for that case (i.e. it's optimized for the
UTF-8 case)?

Happy hacking!
Miguel


--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEEiIeExBRZrMuD5+hMY0xuiXn6vsIFAl+NkgIACgkQY0xuiXn6
vsIPmgv7BmwzC3IaxvbOLJbgKF5MYvOFJoZHoUQuKsJAT/6UwJZ3J9H6dZ1kNJuO
Sgm/pKuCmrTMDqOIIp5SrYulGjBnjP4vTsO8bwBEFyJ7y5cWREXDgoOp4J9vQXyH
S4Yjy72GwNO+WBK8S1ZyquNnLr0vuA1kuNGoaaTw8ACtirlOAQoLKTmSsLZNZIk1
fJQUOfz08gUwg0Y/AMzTgDGhflQA+rHMDC/Qs1uwnmB64xhxfHC2jemC8ZttklqB
edhc2Hw4AJAKoBLwnANM5d/q73vief2FL7Y3tZiP5+V/qVRVaZOhGnSQyCQd9cnF
kB9dlqLmJwC47b78oOQxK/fDicKbhoi7XJHkkRrRB/6Adf8LfJVJQ8T1iLgCu8zw
rT+1eTd2FkOyNYRV4j8FVATjUB/wabDLB23BgeOpiAaLMFj7A8QEgLV0WRlTJoBK
aqCD/zXVGmd/SDVX1jxxKmLJ7+0veD5dXgYoCoecBBWibjBhf5j07maphuttXIsq
9dNtpxXo
=o6XK
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#44075; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Oct 2020 06:48:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 19 02:48:18 2020
Received: from localhost ([127.0.0.1]:39726 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kUOxu-0000jC-2s
	for submit <at> debbugs.gnu.org; Mon, 19 Oct 2020 02:48:18 -0400
Received: from lists.gnu.org ([209.51.188.17]:52736)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <efraim@HIDDEN>) id 1kUOxs-0000j5-Hq
 for submit <at> debbugs.gnu.org; Mon, 19 Oct 2020 02:48:16 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42896)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <efraim@HIDDEN>)
 id 1kUOxs-0008Rs-8O
 for guix-patches@HIDDEN; Mon, 19 Oct 2020 02:48:16 -0400
Received: from flashner.co.il ([178.62.234.194]:34268)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <efraim@HIDDEN>) id 1kUOxq-00025P-GF
 for guix-patches@HIDDEN; Mon, 19 Oct 2020 02:48:15 -0400
Received: from localhost (unknown [141.226.13.8])
 by flashner.co.il (Postfix) with ESMTPSA id 74D4C4001D;
 Mon, 19 Oct 2020 06:48:12 +0000 (UTC)
From: Efraim Flashner <efraim@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] gnu: Add make-glibc-locales-collection.
Date: Mon, 19 Oct 2020 09:47:39 +0300
Message-Id: <20201019064739.4736-1-efraim@HIDDEN>
X-Mailer: git-send-email 2.28.0
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=178.62.234.194;
 envelope-from=efraim@HIDDEN; helo=flashner.co.il
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/19 02:48:12
X-ACL-Warn: Detected OS   = ???
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: Efraim Flashner <efraim@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

* gnu/packages/base.scm (make-glibc-locales-collection): New macro.
(en_us-glibc-locales): New variable.
---
 gnu/packages/base.scm | 73 ++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 72 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index c83775d8ee..41d3aaf865 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -62,7 +62,8 @@
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
   #:export (glibc
-            libiconv-if-needed))
+            libiconv-if-needed
+            make-custom-glibc-locales))
 
 ;;; Commentary:
 ;;;
@@ -1106,6 +1107,69 @@ to the @code{share/locale} sub-directory of this package.")
                                         ,(version-major+minor
                                           (package-version glibc)))))))))))
 
+(define* (make-glibc-locales-collection
+           glibc
+           #:optional (locales
+                        '(list "en_US.utf8" "en_US.ISO-8859-1")))
+                        ;; This list for testing
+                        ;'(list "el_GR.UTF-8" "en_US.utf8" "he_IL.ISO-8859-8" "ja_JP.EUC-JP" "zh_CN.GB18030" "zh_CN.GBK" "hy_AM.ARMSCII-8")))
+  (package
+    (name "glibc-locales-collection")
+    (version (package-version glibc))
+    (source #f)
+    (build-system trivial-build-system)
+    (arguments
+     `(#: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"))
+
+           (mkdir-p localedir)
+           (for-each
+             (lambda (locale)
+               (let* ((contains-dot? (string-index locale #\.))
+                      (encoding-type (substring locale (1+ contains-dot?)))
+                      (raw-locale    (substring locale 0 contains-dot?))
+                      (utf8? (or (number? (string-contains locale ".utf8"))
+                                 (number? (string-contains locale ".UTF-8"))))
+                      (file (if utf8?
+                              (string-append localedir "/" raw-locale ".utf8")
+                              (if (string-contains locale ".ISO")
+                                (string-append localedir "/" raw-locale)
+                                (string-append localedir "/" locale)))))
+
+                 (invoke "localedef" "--no-archive"
+                         "--prefix" localedir
+                         "-i" raw-locale
+                         "-f" (if (equal? "utf8" encoding-type)
+                                "UTF-8"
+                                encoding-type)
+                         file)
+
+                 ;; Is it utf8 or UTF-8? NO ONE KNOWS!
+                 (when utf8?
+                   (symlink (string-append raw-locale ".utf8")
+                            (string-append localedir "/"
+                                           raw-locale ".UTF-8")))))
+             ,locales)
+           #t))))
+    (native-inputs `(("glibc" ,glibc)
+                     ("gzip" ,gzip)))
+    (synopsis "Customizable collection of locales")
+    (description
+     "This package provides a custom collection of locales useful for
+providing exactly the locales requested when size matters.")
+    (home-page (package-home-page glibc))
+    (license (package-license glibc))))
+
 (define-public (make-glibc-utf8-locales glibc)
   (package
     (name "glibc-utf8-locales")
@@ -1161,6 +1225,13 @@ test environments.")
 (define-public glibc-utf8-locales
   (make-glibc-utf8-locales glibc))
 
+(define-public en_us-glibc-locales
+  (package
+    (inherit (make-glibc-locales-collection
+               glibc
+               '(list "en_US.utf8" "en_US.ISO-8859-1")))
+    (name "en-us-glibc-locales")))
+
 ;; Packages provided to ease use of binaries linked against the previous libc.
 (define-public glibc-locales-2.29
   (package (inherit (make-glibc-locales glibc-2.29))
-- 
2.28.0





Acknowledgement sent to Efraim Flashner <efraim@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#44075; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 18 Nov 2020 22:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.