diff mbox series

[bug#39146] gnu: icecat: Remove about:buildconfig store references.

Message ID 20200122013406.3476-1-me@tobias.gr
State Accepted
Headers show
Series [bug#39146] gnu: icecat: Remove about:buildconfig store references. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

ashish.is--- via Guix-patches" via Jan. 22, 2020, 1:34 a.m. UTC
* gnu/packages/gnuzilla.scm (icecat)[arguments]:
New ‘neutralise-store-references’ phase.

Reported-by: Jakub Kądziołka <kuba@kadziolka.net>
---

Jakub, IceCats,

What do you think of this attempt at robustness?  Any drawbacks I've missed?

Kind regards,

T G-R

 gnu/packages/gnuzilla.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Maja Kądziołka Jan. 22, 2020, 2:39 p.m. UTC | #1
On Wed, Jan 22, 2020 at 03:19:06PM +0100, Tobias Geerinckx-Rice wrote:
> Jakub,
> 
> Did you mean to send this off-list?  Either's fine by me.
Whoops, not at all. I need to configure mutt to default to
reply-to-all... adding the list back into CC.

> Jakub Kądziołka 写道:
> > Firstly, note that /gnu/store/ is not guaranteed to be the store path,
> > since this parameter can be changed by passing --with-store-dir to
> > ./configure.
> 
> Er, whoops, of course.  I was going to replace that after testing. By the
> time they'd finished I'd forgot.
> 
> > I assume you tested this patch? When I tried to do my substitutions
> > after the expansion is done, but before the files are packaged into
> > a zip-like file, I couldn't find a good place to hook in the build.
> 
> Indeed.  The result is stored in lib/icecat/omni.ja, which is an
> uncompressed (so GC works) zip file.
> 
> > Also, there's already some code to help with removing references in
> > guix/build/utils.scm (remove-store-references), but the result you get
> > with what you're proposing seems much more user-friendly.
> 
> Heh, thank you!  That's intentional.  :-)
> 
> Remove-store-references' length-preservation is great in some cases
> (compiled executables, binary data, weird code, …) but this wasn't a good
> fit.
> 
> Thanks for taking a look; I'll test & send a (%store-directory) fix.  Thanks
> for your enthousiastic contributions to Guix in general.

A short while after switching to Guix, I read this on Reddit:
| If you're looking to just use one of these distros without actively
| contributing back, I'd go with NixOS right now. If you're an enthusiast
| that wants to contribute to one of these two projects, GuixSD needs more
| help to reach critical mass.
( -- https://www.reddit.com/r/NixOS/comments/9zwiee/nixos_vs_guixsd/eb6zqcu/)
This, together with the fact that Guix is quite easy to hack on, has
inspired me to contribute.

> > Looks like you haven't updated your git in a while ;)
> 
> Nope, just other people's.
> 
> My Guix sqlite DB was corrupted beyond repair in December, I've been limping
> along using ‘guix pack’s from my build farm ever since, because it was never
> the ‘right time’ to reinstall…
>
> I blame Guix for making that even possible and relatively painless.
>
> Kind regards,
> 
> T G-R
>
diff mbox series

Patch

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index ae0c58eedb..d4a793971c 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -11,6 +11,7 @@ 
 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
+;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1067,6 +1068,15 @@  from forcing GEXP-PROMISE."
                                 (force-output)
                                 (retry (- remaining-attempts 1))))
                        (apply build args)))))))
+         (add-after 'build 'neutralise-store-references
+           (lambda _
+             ;; Mangle the store references to compilers & other build tools in
+             ;; about:buildconfig, reducing IceCat's closure by 1 GiB on x86-64.
+             (substitute*
+                 "dist/bin/chrome/toolkit/content/global/buildconfig.html"
+               (("(/gnu/store/)([0-9a-z]{32})" all store hash)
+                (string-append store (string-take hash 8) "…")))
+             #t))
          (add-before 'configure 'install-desktop-entry
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Install the '.desktop' file.