GNU bug report logs - #67026
[PATCH] gnu: josm: Reduce closure size.

Previous Next

Package: guix-patches;

Reported by: Julien Lepiller <julien <at> lepiller.eu>

Date: Thu, 9 Nov 2023 18:59:02 UTC

Severity: normal

Tags: patch

Done: Julien Lepiller <julien <at> lepiller.eu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67026 in the body.
You can then email your comments to 67026 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#67026; Package guix-patches. (Thu, 09 Nov 2023 18:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Julien Lepiller <julien <at> lepiller.eu>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 09 Nov 2023 18:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: josm: Reduce closure size.
Date: Thu, 9 Nov 2023 19:57:55 +0100
Hi Guix!

This small patchset reduces josm's (the Java OSM editor) closure size
from 1.781MB to 544MB (1.2GB reduction!).

This is mostly due to no longer referencing two JDKs.




Information forwarded to guix-patches <at> gnu.org:
bug#67026; Package guix-patches. (Thu, 09 Nov 2023 19:15:01 GMT) Full text and rfc822 format available.

Message #8 received at 67026 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 67026 <at> debbugs.gnu.org
Subject: [PATCH 1/3] gnu: javacc: Do not reference a jdk.
Date: Thu,  9 Nov 2023 20:13:07 +0100
The jdk provides java and javac, while a jre only provides the necessary
java, reducing the closure size by 350MB.

* gnu/packages/java.scm (javacc): Remove #t at end of phases.
[inputs]: Add icedtea-8 as the jre.
[arguments]: Use it instead of the jdk.

Change-Id: Icb218c40915550b7ff1db96a48a3c48fa6ef52b4
---
 gnu/packages/java.scm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 7c8c4e0a36..eded386a03 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2465,8 +2465,7 @@ (define-public javacc
        (modules '((guix build utils)))
        ;; Delete bundled jars.
        (snippet '(begin (for-each delete-file-recursively
-                                  '("bootstrap" "lib"))
-                        #t))))
+                                  '("bootstrap" "lib"))))))
     (arguments
      `(#:make-flags                     ; bootstrap from javacc-4
        ,#~(list (string-append "-Dbootstrap-jar="
@@ -2487,17 +2486,16 @@ (define-public javacc
                  (lambda _
                    (display
                      (string-append "#!/bin/sh\n"
-                                    (assoc-ref inputs "jdk") "/bin/java"
+                                    (assoc-ref inputs "icedtea") "/bin/java"
                                     " -cp " dir "/javacc.jar" " `basename $0`" " $*"))))
                (chmod javacc #o755)
                ;; symlink to different names to affect the first argument and
                ;; change the behavior of the jar file.
                (symlink javacc (string-append bin "/jjdoc"))
-               (symlink javacc (string-append bin "/jjtree"))
-               #t))))))
-
+               (symlink javacc (string-append bin "/jjtree"))))))))
     (native-inputs
-     (list javacc-4))))
+     (list javacc-4))
+    (inputs (list icedtea-8))))
 
 (define-public java-ecj
   (package
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#67026; Package guix-patches. (Thu, 09 Nov 2023 19:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 67026 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 67026 <at> debbugs.gnu.org
Subject: [PATCH 3/3] gnu: josm: Reduce closure size.
Date: Thu,  9 Nov 2023 20:13:09 +0100
This saves 240MB of closure size.

* gnu/packages/geo.scm (josm)[inputs]: Add openjdk11.
[arguments]: Filter native inputs out of CLASSPATH.  Use `java' from
openjdk11 instead of the JDK.

Change-Id: Ifa03b5cd033c5866d22e7557119284be0ea25a0e
---
 gnu/packages/geo.scm | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index dbc8440141..746b22a082 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -1970,7 +1970,8 @@ (define-public josm
            java-openjfx-media
            java-parsson ; runtime dependency
            java-signpost-core
-           java-svg-salamander))
+           java-svg-salamander
+           openjdk11))
     (arguments
      `(#:tests? #f
        #:jar-name "josm.jar"
@@ -2070,9 +2071,16 @@ (define-public josm
                  (lambda _
                    (display
                      (string-append "#!/bin/sh\n"
-                                    (assoc-ref inputs "jdk") "/bin/java"
+                                    (assoc-ref inputs "openjdk") "/bin/java"
                                     " -cp " out "/share/java/josm.jar:"
-                                    (getenv "CLASSPATH")
+                                    ;; CLASSPATH, but remove native inputs
+                                    (string-join
+                                      (filter
+                                        (lambda (jar)
+                                          (and (not (string-contains jar "-jdk/"))
+                                               (not (string-contains jar "-javacc-"))))
+                                        (string-split (getenv "CLASSPATH") #\:))
+                                      ":")
                                     " org.openstreetmap.josm.gui.MainApplication"))))
                (chmod (string-append bin "/josm") #o755))
              #t)))))
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#67026; Package guix-patches. (Thu, 09 Nov 2023 19:15:02 GMT) Full text and rfc822 format available.

Message #14 received at 67026 <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: 67026 <at> debbugs.gnu.org
Subject: [PATCH 2/3] gnu: java-openjfx-graphics: Make java-swt optional.
Date: Thu,  9 Nov 2023 20:13:08 +0100
It is used for an optional part of openjfx and not used by current
packages in Guix. Swt has a reference to a library in the JDK and has a
huge closure size because of that.  This reduces closure by 1GB for this
package and dependents (including josm).

* gnu/packages/java.scm (java-openjfx-graphics)[native-inputs]: Move java-swt...
[inputs]: ...to here.

Change-Id: I7d8cb14569d5a9f451944695225a2dff143bf190
---
 gnu/packages/java.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index eded386a03..d73550c042 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -2311,7 +2311,9 @@ (define-public java-openjfx-graphics
                                         (string-append target new-name))))
                          (find-files "netbeans" "\\.so$"))))))))
     (propagated-inputs
-     (list java-openjfx-base java-swt))
+     (list java-openjfx-base))
+    (inputs
+     (list java-swt))
     ;; XXX: for unknown reasons
     ;; modules/graphics/src/main/native-prism-sw/JNativeSurface.c is missing
     ;; in this revision.
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#67026; Package guix-patches. (Sat, 02 Dec 2023 10:22:02 GMT) Full text and rfc822 format available.

Message #17 received at 67026 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Julien Lepiller <julien <at> lepiller.eu>
Cc: 67026 <at> debbugs.gnu.org
Subject: Re: [bug#67026] [PATCH] gnu: josm: Reduce closure size.
Date: Sat, 02 Dec 2023 11:21:19 +0100
Hi Julien,

Julien Lepiller <julien <at> lepiller.eu> skribis:

> This small patchset reduces josm's (the Java OSM editor) closure size
> from 1.781MB to 544MB (1.2GB reduction!).

Wo0t, well done!

> This is mostly due to no longer referencing two JDKs.

Heh.

LGTM!

Ludo’.




Reply sent to Julien Lepiller <julien <at> lepiller.eu>:
You have taken responsibility. (Sat, 02 Dec 2023 18:11:01 GMT) Full text and rfc822 format available.

Notification sent to Julien Lepiller <julien <at> lepiller.eu>:
bug acknowledged by developer. (Sat, 02 Dec 2023 18:11:01 GMT) Full text and rfc822 format available.

Message #22 received at 67026-done <at> debbugs.gnu.org (full text, mbox):

From: Julien Lepiller <julien <at> lepiller.eu>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 67026-done <at> debbugs.gnu.org
Subject: Re: [bug#67026] [PATCH] gnu: josm: Reduce closure size.
Date: Sat, 2 Dec 2023 19:10:00 +0100
Le Sat, 02 Dec 2023 11:21:19 +0100,
Ludovic Courtès <ludo <at> gnu.org> a écrit :

> Hi Julien,
> 
> Julien Lepiller <julien <at> lepiller.eu> skribis:
> 
> > This small patchset reduces josm's (the Java OSM editor) closure
> > size from 1.781MB to 544MB (1.2GB reduction!).  
> 
> Wo0t, well done!
> 
> > This is mostly due to no longer referencing two JDKs.  
> 
> Heh.
> 
> LGTM!
> 
> Ludo’.

Thanks, pushed to master as 406e46a15965bcb9e68e7c0bf09f14b9c72c6498 -
06ebc45e15f2a1bd4526a5a716eed657c902a0c1




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 31 Dec 2023 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 130 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.