summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-02-10 13:40:40 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-02-19 20:03:33 -0500
commitf4a932cbd7a351b63c3bec9fa075e05d81848b5e (patch)
tree58a7f1fd071d9bae2378ac38160b0e2354fbd4fe
parent636b771536b95d15a2fd68b468deeebac97d6bee (diff)
gnu: Add a 'update-mozilla-locales' helper for maintenance.
* gnu/packages/gnuzilla.scm (update-mozilla-locales): New procedure.
-rw-r--r--gnu/packages/gnuzilla.scm20
1 files changed, 19 insertions, 1 deletions
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