all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 32026@debbugs.gnu.org
Cc: mhw@netris.org, ludo@gnu.org,
	Jonathan Brielmaier <jonathan.brielmaier@web.de>,
	Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: bug#32026: [PATCH v4 2/9] gnu: icedove: Compute a self-contained source.
Date: Sun, 19 Feb 2023 14:23:58 -0500	[thread overview]
Message-ID: <20230219192405.26549-2-maxim.cournoyer@gmail.com> (raw)
In-Reply-To: <20230219192405.26549-1-maxim.cournoyer@gmail.com>

This refactoring work is to prepare for adding a icedove-l10n package, which
will reuse that source.

* gnu/packages/gnuzilla.scm (comm-source->locales+changset): New procedure.
(thunderbird-source): Rename to...
(thunderbird-comm-source): ... here.
(icedove-source): New variable.
(icedove) [source]: Use it.
[phases]: Remove the prepare-thunderbird-sources and rename-to-icedove phases.

---

(no changes since v2)

Changes in v2:
- Fix typo in comm-source->locales+changset
- Reword comment

 gnu/packages/gnuzilla.scm | 210 +++++++++++++++++++++++++-------------
 1 file changed, 140 insertions(+), 70 deletions(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index 16e2208426..3a742d06c6 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -47,6 +47,7 @@ (define-module (gnu packages gnuzilla)
   #:use-module (guix hg-download)
   #:use-module (guix gexp)
   #:use-module (guix store)
+  #:use-module (guix modules)
   #:use-module (guix monads)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
@@ -1119,7 +1120,7 @@ (define %icedove-version "102.7.2")
 
 ;; Provides the "comm" folder which is inserted into the icecat source.
 ;; Avoids the duplication of Icecat's source tarball.
-(define thunderbird-source
+(define thunderbird-comm-source
   (origin
     (method hg-fetch)
     (uri (hg-reference
@@ -1130,11 +1131,148 @@ (define thunderbird-source
      (base32
       "071q0pcfvfpzx741ly1sl8anlmzx02h17w4ylfnrkwrpaclq3p6p"))))
 
+(define (comm-source->locales+changeset source)
+  "Given SOURCE, a checkout of the Thunderbird 'comm' component, return the
+list of languages supported as well as the currently used changeset."
+  (match (update-mozilla-locales
+          (string-append source "/mail/locales/l10n-changesets.json"))
+    (((_ changeset locale) ...)
+     (values locale (first changeset)))))
+
+;;; To find out which changeset to use for the comm-l10n repo, use the
+;;; 'comm-source->locales+changeset' procedure on the thunderbird-comm-source
+;;; checkout directory.  The complete localization data should be released as
+;;; a tarball in the next release (see:
+;;; https://bugzilla.mozilla.org/show_bug.cgi?id=1817086).  When this tarball
+;;; is available, it should replace the complete 'l10n' directory at the root
+;;; of the IceCat source, instead of only the 'calendar', chat and mail
+;;; directories that it provides.
+(define thunderbird-comm-l10n
+  (let* ((changeset "5b6788295358")
+         (version (git-version %icedove-version "0" changeset)))
+    (origin
+      (method hg-fetch)
+      (uri (hg-reference
+            (url "https://hg.mozilla.org/projects/comm-l10n")
+            (changeset changeset)))
+      (file-name (git-file-name "comm-l10n" version))
+      (sha256
+       (base32
+        "1jrsmkscjjllcfawi3788vwm53wn25inbhdis5nk4vfpr7wk5ill")))))
+
+(define icedove-source
+  (let ((name (string-append "icedove-" %icedove-version)))
+    (origin
+      (method computed-origin-method)
+      (file-name (string-append name ".tar.xz"))
+      (sha256 #f)
+      (uri
+       (delay
+         (with-imported-modules (source-module-closure '((guix build utils)))
+           #~(begin
+               (use-modules (guix build utils)
+                            (sxml simple))
+
+               (set-path-environment-variable
+                "PATH" '("bin")
+                (list #+(canonical-package tar)
+                      #+(canonical-package xz)))
+
+               ;; Extract the base Icecat tarball, renaming its top-level
+               ;; directory.
+               (invoke "tar" "--transform" (string-append "s,[^/]*," #$name ",")
+                       "-xf" #$icecat-source)
+               (chdir #$name)
+
+               ;; Merge the Thunderdbird localization data.
+               (copy-recursively #$thunderbird-comm-l10n "l10n")
+
+               ;; Add the Thunderbird-specific "comm" directory..
+               (mkdir "comm")
+               (copy-recursively #$thunderbird-comm-source "comm")
+               (delete-file "sourcestamp.txt")
+
+               ;; Adjust the application name.
+               (substitute* "comm/mail/confvars.sh"
+                 (("MOZ_APP_NAME=thunderbird")
+                  "MOZ_APP_NAME=icedove")
+                 (("MOZ_UPDATER=1")
+                  "MOZ_UPDATER=0"))
+
+               ;; Remove branding to comply with Mozilla's trademark policy
+               (with-directory-excursion "comm/mail/branding/nightly"
+                 (delete-file "content/about-wordmark.svg")
+                 (call-with-output-file "content/about-wordmark.svg"
+                   (lambda (port)
+                     (sxml->xml '(svg (@ (xmlns "http://www.w3.org/2000/svg")
+                                         (viewBox "0 0 789.1 90.78")
+                                         (width "333")
+                                         (height "48")
+                                         (fill "#fff"))
+                                      (text (@ (x "400") (y "70")
+                                               (text-anchor "middle")
+                                               (font-size "90"))
+                                            "Icedove Daily"))
+                                port)))
+                 (substitute* '("locales/en-US/brand.properties"
+                                "locales/en-US/brand.ftl"
+                                "locales/en-US/brand.dtd"
+                                "configure.sh")
+                   (("Thunderbird") "Icedove")
+                   (("mozilla.org") "guix.gnu.org")))
+               ;; Remove other mentions of Thunderbird in user-visible text.
+               (with-directory-excursion "comm/mail/base/content"
+                 (substitute* '("overrides/app-license-name.html")
+                   (("Thunderbird") "Icedove")))
+               (with-directory-excursion "comm/mail/components/"
+                 (substitute* '("MailGlue.jsm"
+                                "extensions/schemas/addressBook.json"
+                                "extensions/schemas/tabs.json"
+                                "extensions/schemas/cloudFile.json"
+                                "extensions/schemas/chrome_settings_overrides.json"
+                                "extensions/schemas/windows.json"
+                                "extensions/parent/ext-mail.js"
+                                "im/messages/mail/Info.plist"
+                                "enterprisepolicies/moz.build"
+                                "enterprisepolicies/helpers/moz.build"
+                                "enterprisepolicies/schemas/moz.build")
+                   (("Thunderbird") "Icedove")))
+               (substitute* '("comm/mailnews/base/prefs/content/accountUtils.js"
+                              "comm/mail/base/content/customizeToolbar.js"
+                              "comm/suite/components/customizeToolbar.js")
+                 (("AppConstants.MOZ_APP_NAME (.)= \"thunderbird" _ e)
+                  (format #f "AppConstants.MOZ_APP_NAME ~a= \"icedove" e)))
+
+               ;; Override addon URLs and settings
+               (substitute* "comm/mail/app/profile/all-thunderbird.js"
+                 (("(pref\\(\"extensions.webservice.discoverURL\").*" _ m)
+                  (string-append m ", \"https://directory.fsf.org/wiki/Icedove\");"))
+                 (("(pref\\(\"extensions.getAddons.search.url\").*" _ m)
+                  (string-append m ", \"https://guix.gnu.org/packages\");"))
+                 (("(pref\\(\"extensions.update.enabled\").*" _ m)
+                  (string-append m ", false);"))
+                 (("(pref\\(\"extensions.systemAddon.update.enabled\").*" _ m)
+                  (string-append m ", false);"))
+                 (("(pref\\(\"lightweightThemes.update.enabled\").*" _ m)
+                  (string-append m ", false);")))
+
+               ;; Step out of the directory and create the tarball.
+               (chdir "..")
+               (format #t "Packing Icedove source tarball...~%")
+               (force-output)
+               (setenv "XZ_DEFAULTS" (string-join (%xz-parallel-args)))
+               (invoke "tar" "cfa" #$output
+                       "--mtime=@315619200" ;1980-01-02 UTC
+                       "--owner=root:0"
+                       "--group=root:0"
+                       "--sort=name"
+                       #$name))))))))
+
 (define-public icedove
   (package
     (name "icedove")
     (version %icedove-version)
-    (source icecat-source)
+    (source icedove-source)
     (properties
      `((cpe-name . "thunderbird_esr")))
     (build-system gnu-build-system)
@@ -1148,11 +1286,6 @@ (define-public icedove
                   ,@%gnu-build-system-modules)
       #:phases
       #~(modify-phases %standard-phases
-          (add-after 'unpack 'prepare-thunderbird-sources
-            (lambda _
-              (mkdir "comm")
-              (copy-recursively #$thunderbird-source "comm")
-              (delete-file "sourcestamp.txt")))
           (add-after 'patch-source-shebangs 'patch-cargo-checksums
             (lambda _
               (use-modules (guix build cargo-utils))
@@ -1182,69 +1315,6 @@ (define-public icedove
               (substitute* "comm/mail/moz.configure"
                 (("MOZ_DEDICATED_PROFILES, True")
                  "MOZ_DEDICATED_PROFILES, False"))))
-          (add-after 'prepare-thunderbird-sources 'rename-to-icedove
-            (lambda _
-              (substitute* "comm/mail/confvars.sh"
-                (("MOZ_APP_NAME=thunderbird")
-                 "MOZ_APP_NAME=icedove")
-                (("MOZ_UPDATER=1")
-                 "MOZ_UPDATER=0"))
-              ;; Remove branding to comply with Mozilla's trademark policy
-              (with-directory-excursion "comm/mail/branding/nightly"
-                (delete-file "content/about-wordmark.svg")
-                (call-with-output-file "content/about-wordmark.svg"
-                  (lambda (port)
-                    (sxml->xml '(svg (@ (xmlns "http://www.w3.org/2000/svg")
-                                        (viewBox "0 0 789.1 90.78")
-                                        (width "333")
-                                        (height "48")
-                                        (fill "#fff"))
-                                     (text (@ (x "400") (y "70")
-                                              (text-anchor "middle")
-                                              (font-size "90"))
-                                           "Icedove Daily"))
-                               port)))
-                (substitute* '("locales/en-US/brand.properties"
-                               "locales/en-US/brand.ftl"
-                               "locales/en-US/brand.dtd"
-                               "configure.sh")
-                  (("Thunderbird") "Icedove")
-                  (("mozilla.org") "guix.gnu.org")))
-              ;; Remove other mentions of Thunderbird in user-visible text.
-              (with-directory-excursion "comm/mail/base/content"
-                (substitute* '("overrides/app-license-name.html")
-                  (("Thunderbird") "Icedove")))
-              (with-directory-excursion "comm/mail/components/"
-                (substitute* '("MailGlue.jsm"
-                               "extensions/schemas/addressBook.json"
-                               "extensions/schemas/tabs.json"
-                               "extensions/schemas/cloudFile.json"
-                               "extensions/schemas/chrome_settings_overrides.json"
-                               "extensions/schemas/windows.json"
-                               "extensions/parent/ext-mail.js"
-                               "im/messages/mail/Info.plist"
-                               "enterprisepolicies/moz.build"
-                               "enterprisepolicies/helpers/moz.build"
-                               "enterprisepolicies/schemas/moz.build")
-                  (("Thunderbird") "Icedove")))
-              (substitute* '("comm/mailnews/base/prefs/content/accountUtils.js"
-                             "comm/mail/base/content/customizeToolbar.js"
-                             "comm/suite/components/customizeToolbar.js")
-                (("AppConstants.MOZ_APP_NAME (.)= \"thunderbird" _ e)
-                 (format #f "AppConstants.MOZ_APP_NAME ~a= \"icedove" e)))
-
-              ;; Override addon URLs and settings
-              (substitute* "comm/mail/app/profile/all-thunderbird.js"
-                (("(pref\\(\"extensions.webservice.discoverURL\").*" _ m)
-                 (string-append m ", \"https://directory.fsf.org/wiki/Icedove\");"))
-                (("(pref\\(\"extensions.getAddons.search.url\").*" _ m)
-                 (string-append m ", \"https://guix.gnu.org/packages\");"))
-                (("(pref\\(\"extensions.update.enabled\").*" _ m)
-                 (string-append m ", false);"))
-                (("(pref\\(\"extensions.systemAddon.update.enabled\").*" _ m)
-                 (string-append m ", false);"))
-                (("(pref\\(\"lightweightThemes.update.enabled\").*" _ m)
-                 (string-append m ", false);")))))
           (add-after 'build 'neutralize-store-references
             (lambda _
               ;; Mangle the store references to compilers & other build tools in
-- 
2.39.1





  reply	other threads:[~2023-02-19 19:27 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-01 20:23 bug#32026: IceCat locales are missing? Ludovic Courtès
2023-02-14  1:55 ` bug#32026: [PATCH 00/10] Add proper locale support to IceCat and Icedove Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 01/10] gnu: Add a 'update-mozilla-locales' helper for maintenance Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 02/10] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-14 21:32     ` Jonathan Brielmaier
2023-02-16  0:55       ` Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 03/10] gnu: Define UPSTREAM-FIREFOX-SOURCE at the top level Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 04/10] gnu: icecat: Update the "ach" locale Maxim Cournoyer
2023-02-15  6:39     ` Mark H Weaver
2023-02-14  1:55   ` bug#32026: [PATCH 05/10] gnu: icecat: Add a patch that makes building language packs reproducible Maxim Cournoyer
2023-02-14  7:58     ` Mark H Weaver
2023-02-14 13:58       ` Maxim Cournoyer
2023-02-14 21:06         ` Mark H Weaver
2023-02-15 21:32           ` Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 06/10] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 07/10] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 08/10] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 09/10] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-14  1:55   ` bug#32026: [PATCH 10/10] gnu: icecat: " Maxim Cournoyer
2023-02-14  9:23     ` Mark H Weaver
2023-02-14 14:00       ` Maxim Cournoyer
2023-02-16  4:36 ` bug#32026: [PATCH 01/10] gnu: Add a 'update-mozilla-locales' helper for maintenance Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 02/10] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 03/10] gnu: Define UPSTREAM-FIREFOX-SOURCE at the top level Maxim Cournoyer
2023-02-16 22:26     ` Mark H Weaver
2023-02-17  2:55       ` Maxim Cournoyer
2023-02-18 20:46         ` Mark H Weaver
2023-02-19 17:43           ` Maxim Cournoyer
2023-02-20  1:06           ` Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 04/10] gnu: icecat: Make language packs reproducible Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 05/10] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-16 22:45     ` Mark H Weaver
2023-02-17  3:37       ` Maxim Cournoyer
2023-02-18 20:22         ` Mark H Weaver
2023-02-18 20:42           ` Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 06/10] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 07/10] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 08/10] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-16  4:36   ` bug#32026: [PATCH 09/10] gnu: icecat: Remove gtk+-2 input Maxim Cournoyer
2023-02-16 22:50     ` Mark H Weaver
2023-02-16  4:36   ` bug#32026: [PATCH 10/10] gnu: icecat: Unbundle nss and nspr Maxim Cournoyer
2023-02-16 22:14     ` Mark H Weaver
2023-02-17 19:44       ` Maxim Cournoyer
2023-02-18  1:02         ` Mark H Weaver
2023-02-18 14:09           ` Maxim Cournoyer
2023-02-16 22:05   ` bug#32026: [PATCH 01/10] gnu: Add a 'update-mozilla-locales' helper for maintenance Mark H Weaver
2023-02-17  2:25     ` Maxim Cournoyer
2023-02-17 12:55 ` bug#32026: [PATCH v3 01/11] " Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 02/11] gnu: icedove: Compute a self-contained source Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 03/11] gnu: Define UPSTREAM-FIREFOX-SOURCE at the top level Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 04/11] gnu: icecat: Make language packs reproducible Maxim Cournoyer
2023-02-18 21:02     ` Mark H Weaver
2023-02-19 17:35       ` Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 05/11] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 06/11] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 07/11] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 08/11] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 09/11] gnu: icecat: Remove gtk+-2 input Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 10/11] gnu: nss-next: Update to 3.88.1 [fixes CVE-2023-0767] Maxim Cournoyer
2023-02-17 21:38     ` Mark H Weaver
2023-02-18 17:27       ` Maxim Cournoyer
2023-02-18 19:49         ` Tobias Geerinckx-Rice via Bug reports for GNU Guix
2023-02-18 20:45           ` Maxim Cournoyer
2023-02-17 12:55   ` bug#32026: [PATCH v3 11/11] gnu: icecat: Unbundle nss and nspr Maxim Cournoyer
2023-02-19 19:23 ` bug#32026: [PATCH v4 1/9] gnu: Add a 'update-mozilla-locales' helper for maintenance Maxim Cournoyer
2023-02-19 19:23   ` Maxim Cournoyer [this message]
2023-02-19 19:23   ` bug#32026: [PATCH v4 3/9] gnu: Define %icecat-base-version at the top level Maxim Cournoyer
2023-02-19 20:13     ` Mark H Weaver
2023-02-19 22:14       ` Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 4/9] gnu: Add icecat-l10n and icedove-l10n Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 5/9] gnu: icedove: Automatically load system-provided extensions Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 6/9] gnu: Add language packs to icecat and icedove Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 7/9] gnu: icedove: Use the locale of the system Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 8/9] gnu: icecat: Remove gtk+-2 input Maxim Cournoyer
2023-02-19 19:24   ` bug#32026: [PATCH v4 9/9] gnu: icecat: Unbundle nss and nspr Maxim Cournoyer
2023-02-19 20:17   ` bug#32026: [PATCH v4 1/9] gnu: Add a 'update-mozilla-locales' helper for maintenance Mark H Weaver
2023-02-19 23:17     ` Maxim Cournoyer
2023-02-20 11:06   ` Ludovic Courtès
2023-02-20 15:35     ` Maxim Cournoyer
2023-02-22  9:19       ` bug#32026: LibreOffice locales Ludovic Courtès

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230219192405.26549-2-maxim.cournoyer@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=32026@debbugs.gnu.org \
    --cc=jonathan.brielmaier@web.de \
    --cc=ludo@gnu.org \
    --cc=mhw@netris.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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.