guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/10: gnu: Add a 'update-mozilla-locales' helper for maintenance.


From: guix-commits
Subject: 01/10: gnu: Add a 'update-mozilla-locales' helper for maintenance.
Date: Sun, 19 Feb 2023 20:04:36 -0500 (EST)

apteryx pushed a commit to branch master
in repository guix.

commit f4a932cbd7a351b63c3bec9fa075e05d81848b5e
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Fri Feb 10 13:40:40 2023 -0500

    gnu: Add a 'update-mozilla-locales' helper for maintenance.
    
    * gnu/packages/gnuzilla.scm (update-mozilla-locales): New procedure.
---
 gnu/packages/gnuzilla.scm | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index b2e0870fea..3f0dbf938e 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -37,6 +37,7 @@
 
 (define-module (gnu packages gnuzilla)
   #:use-module ((srfi srfi-1) #:hide (zip))
+  #:use-module (ice-9 format)
   #:use-module (ice-9 match)
   #:use-module (gnu packages)
   #:use-module ((guix licenses) #:prefix license:)
@@ -91,7 +92,8 @@
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages readline)
-  #:use-module (gnu packages sqlite))
+  #:use-module (gnu packages sqlite)
+  #:autoload (json parser) (json->scm))
 
 (define-public mozjs
   (package
@@ -348,6 +350,10 @@ in C/C++.")
     (inputs
      (list icu4c readline zlib))))
 
+
+;;;
+;;; Localization helper procedures.
+;;;
 (define mozilla-compare-locales
   (origin
     (method hg-fetch)
@@ -371,6 +377,18 @@ in C/C++.")
   (list (mozilla-locale locale changeset hash-string)
         ...))
 
+(define (update-mozilla-locales changesets.json)
+  "Output a new list of Mozilla locales, to update the ALL-MOZILLA-LOCALES
+variable defined below.  It requires guile-json to be installed."
+  (match (call-with-input-file changesets.json json->scm)
+    (((lang ("revision" . revision) platforms pin) ...)
+     (let ((data (reverse (map (lambda (rev lang)
+                                 `(,(list->string (make-list 40 #\0))
+                                   ,(string-take rev 12) ,lang))
+                               revision lang))))
+       (format #t "~{~s~%~}" data)
+       data))))
+
 (define all-mozilla-locales
   (mozilla-locales
    ;;                      sha256                            changeset    
locale



reply via email to

[Prev in Thread] Current Thread [Next in Thread]