From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id SHZVCqFskF9aOAAA0tVLHw (envelope-from ) for ; Wed, 21 Oct 2020 17:15:13 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id EEErBqFskF9RLgAAbx9fmQ (envelope-from ) for ; Wed, 21 Oct 2020 17:15:13 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 720379403C9 for ; Wed, 21 Oct 2020 17:15:12 +0000 (UTC) Received: from localhost ([::1]:60804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVHhe-0007k1-01 for larch@yhetil.org; Wed, 21 Oct 2020 13:15:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVHcg-0002U3-1k for guix-patches@gnu.org; Wed, 21 Oct 2020 13:10:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38854) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVHcf-0002Sv-Ou for guix-patches@gnu.org; Wed, 21 Oct 2020 13:10:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kVHcf-0007T3-Js for guix-patches@gnu.org; Wed, 21 Oct 2020 13:10:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#44075] [PATCH] gnu: Add make-glibc-locales-collection. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 21 Oct 2020 17:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44075 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Efraim Flashner Cc: 44075@debbugs.gnu.org Received: via spool by 44075-submit@debbugs.gnu.org id=B44075.160330015628627 (code B ref 44075); Wed, 21 Oct 2020 17:10:01 +0000 Received: (at 44075) by debbugs.gnu.org; 21 Oct 2020 17:09:16 +0000 Received: from localhost ([127.0.0.1]:50400 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kVHbv-0007Rf-Ry for submit@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 ) id 1kVHbu-0007RR-73 for 44075@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 ) 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 ) id 1kVHbo-0005Cg-9O; Wed, 21 Oct 2020 13:09:08 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20201019064739.4736-1-efraim@flashner.co.il> Date: Wed, 21 Oct 2020 19:09:06 +0200 In-Reply-To: <20201019064739.4736-1-efraim@flashner.co.il> (Efraim Flashner's message of "Mon, 19 Oct 2020 09:47:39 +0300") Message-ID: <878sbz1p71.fsf@gnu.org> 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.41 X-TUID: I6PbVbNcSIfS --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi! Efraim Flashner 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") --=-=-=--