* [bug#66879] [PATCH] gnu: josm: Update to 18822.
@ 2023-11-01 12:53 Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 1/5] gnu: openjdk9: Install default certificates Julien Lepiller
0 siblings, 1 reply; 8+ messages in thread
From: Julien Lepiller @ 2023-11-01 12:53 UTC (permalink / raw)
To: 66879
Hi Guix!
This small patch series updates josm to the latest version. Some
issues I stumbled upon:
josm now uses a different library for json parsing, which is added in
the series. This library uses Java modules (introduced with java 9), so
I had to fix the build system to allow modules, but not by default
since we still use the old java 8 by default.
Then, it built, but it had troubles validating SSL certificates at
runtime, which is fixed in the series by using a similar phase to the
one in icedtea to generate a key store from nss-certs. I managed to
build a few JDK versions after OpenJDK 11, but I'll let CI tell us if
I broke anything :)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [bug#66879] [PATCH v2 1/5] gnu: openjdk9: Install default certificates.
2023-11-01 12:53 [bug#66879] [PATCH] gnu: josm: Update to 18822 Julien Lepiller
@ 2023-11-02 6:50 ` Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 2/5] guix: ant: Optionally build with java modules Julien Lepiller
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Julien Lepiller @ 2023-11-02 6:50 UTC (permalink / raw)
To: 66879; +Cc: Björn Höfling, Julien Lepiller
* gnu/packages/java.scm (openjdk9)[arguments]: Add a phase to install
certificates from nss-certs to the expected location.
(openjdk10, openjdk11): Adapt to also install the certificates.
Change-Id: I6ef626324386419e84a9c0eace5a278ca11c573c
---
gnu/packages/java.scm | 87 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 86 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index f482c4c16d..567fb05f77 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -878,7 +878,14 @@ (define-public openjdk9
(build-system gnu-build-system)
(outputs '("out" "jdk" "doc"))
(arguments
- `(#:tests? #f; require jtreg
+ `(#:imported-modules
+ ((guix build ant-build-system)
+ ,@%gnu-build-system-modules)
+ #:modules
+ ((guix build utils)
+ (guix build gnu-build-system)
+ (ice-9 popen))
+ #:tests? #f; require jtreg
#:make-flags '("all")
#:disallowed-references ,(list (gexp-input icedtea-8)
(gexp-input icedtea-8 "jdk"))
@@ -971,6 +978,80 @@ (define-public openjdk9
(find-files "."
"\\.c$|\\.h$"))
#t)))
+ ;; By default OpenJDK only generates an empty keystore. In order to
+ ;; be able to use certificates in Java programs we need to generate a
+ ;; keystore from a set of certificates. For convenience we use the
+ ;; certificates from the nss-certs package.
+ (add-after 'install 'install-keystore
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (use-modules (ice-9 rdelim))
+ (let* ((keystore "cacerts")
+ (certs-dir (search-input-directory inputs
+ "etc/ssl/certs"))
+ (keytool (string-append (assoc-ref outputs "jdk")
+ "/bin/keytool")))
+ (define (extract-cert file target)
+ (call-with-input-file file
+ (lambda (in)
+ (call-with-output-file target
+ (lambda (out)
+ (let loop ((line (read-line in 'concat))
+ (copying? #f))
+ (cond
+ ((eof-object? line) #t)
+ ((string-prefix? "-----BEGIN" line)
+ (display line out)
+ (loop (read-line in 'concat) #t))
+ ((string-prefix? "-----END" line)
+ (display line out)
+ #t)
+ (else
+ (when copying? (display line out))
+ (loop (read-line in 'concat) copying?)))))))))
+ (define (import-cert cert)
+ (format #t "Importing certificate ~a\n" (basename cert))
+ (let ((temp "tmpcert"))
+ (extract-cert cert temp)
+ (let ((port (open-pipe* OPEN_WRITE keytool
+ "-import"
+ "-alias" (basename cert)
+ "-keystore" keystore
+ "-storepass" "changeit"
+ "-file" temp)))
+ (display "yes\n" port)
+ (when (not (zero? (status:exit-val (close-pipe port))))
+ (format #t "failed to import ~a\n" cert)))
+ (delete-file temp)))
+
+ ;; This is necessary because the certificate directory contains
+ ;; files with non-ASCII characters in their names.
+ (setlocale LC_ALL "en_US.utf8")
+ (setenv "LC_ALL" "en_US.utf8")
+
+ (copy-file (string-append (assoc-ref outputs "out")
+ "/lib/security/cacerts")
+ keystore)
+ (chmod keystore #o644)
+ (for-each import-cert (find-files certs-dir "\\.pem$"))
+ (mkdir-p (string-append (assoc-ref outputs "out")
+ "/lib/security"))
+ (mkdir-p (string-append (assoc-ref outputs "jdk")
+ "/lib/security"))
+
+ ;; The cacerts files we are going to overwrite are chmod'ed as
+ ;; read-only (444) in icedtea-8 (which derives from this
+ ;; package). We have to change this so we can overwrite them.
+ (chmod (string-append (assoc-ref outputs "out")
+ "/lib/security/" keystore) #o644)
+ (chmod (string-append (assoc-ref outputs "jdk")
+ "/lib/security/" keystore) #o644)
+
+ (install-file keystore
+ (string-append (assoc-ref outputs "out")
+ "/lib/security"))
+ (install-file keystore
+ (string-append (assoc-ref outputs "jdk")
+ "/lib/security")))))
;; Some of the libraries in the lib/ folder link to libjvm.so.
;; But that shared object is located in the server/ folder, so it
;; cannot be found. This phase creates a symbolic link in the
@@ -1044,6 +1125,7 @@ (define-public openjdk9
("icedtea-8:jdk" ,icedtea-8 "jdk")
;; XXX: The build system fails with newer versions of GNU Make.
("make@4.2" ,gnu-make-4.2)
+ ("nss-certs" ,nss-certs)
("unzip" ,unzip)
("which" ,which)
("zip" ,zip)))
@@ -1126,6 +1208,7 @@ (define-public openjdk10
`(("openjdk9" ,openjdk9)
("openjdk9:jdk" ,openjdk9 "jdk")
("make@4.2" ,gnu-make-4.2)
+ ("nss-certs" ,nss-certs)
("unzip" ,unzip)
("which" ,which)
("zip" ,zip)))))
@@ -1152,6 +1235,7 @@ (define-public openjdk11
#:modules `((guix build gnu-build-system)
(guix build utils)
(ice-9 match)
+ (ice-9 popen)
(srfi srfi-1)
(srfi srfi-26))
#:disallowed-references (list (gexp-input openjdk10)
@@ -1394,6 +1478,7 @@ (define-public openjdk11
openjdk10
`(,openjdk10 "jdk")
gnu-make-4.2
+ nss-certs
pkg-config
unzip
which
base-commit: c95104c2e96f660d482e603c497c1e01968788d3
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#66879] [PATCH v2 2/5] guix: ant: Optionally build with java modules.
2023-11-02 6:50 ` [bug#66879] [PATCH v2 1/5] gnu: openjdk9: Install default certificates Julien Lepiller
@ 2023-11-02 6:50 ` Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 3/5] gnu: Add java-jakarta-json Julien Lepiller
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Julien Lepiller @ 2023-11-02 6:50 UTC (permalink / raw)
To: 66879; +Cc: Björn Höfling, Julien Lepiller
Modules were introduced in Java 9 and are not supported by the default
icedtea compiler, so this feature is disabled by default.
* guix/build-system/ant.scm (ant-build): Add use-java-modules?
parameter.
* guix/build/ant-build-system.scm (default-build.xml)
(configure): Use it.
Change-Id: I3b99238e4cd262332fa5c818be1af5477c7374fd
---
guix/build-system/ant.scm | 2 ++
guix/build/ant-build-system.scm | 31 +++++++++++++++++++++++--------
2 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/guix/build-system/ant.scm b/guix/build-system/ant.scm
index e191fd3c99..84bf951fab 100644
--- a/guix/build-system/ant.scm
+++ b/guix/build-system/ant.scm
@@ -103,6 +103,7 @@ (define* (ant-build name inputs
(build-target "jar")
(jar-name #f)
(main-class #f)
+ (use-java-modules? #f)
(test-include (list "**/*Test.java"))
(test-exclude (list "**/Abstract*.java"))
(source-dir "src")
@@ -131,6 +132,7 @@ (define* (ant-build name inputs
#:build-target #$build-target
#:jar-name #$jar-name
#:main-class #$main-class
+ #:use-java-modules? #$use-java-modules?
#:test-include (list #$@test-include)
#:test-exclude (list #$@test-exclude)
#:source-dir #$source-dir
diff --git a/guix/build/ant-build-system.scm b/guix/build/ant-build-system.scm
index d29912bf59..ced34177f4 100644
--- a/guix/build/ant-build-system.scm
+++ b/guix/build/ant-build-system.scm
@@ -37,6 +37,7 @@ (define-module (guix build ant-build-system)
(define* (default-build.xml jar-name prefix #:optional
(source-dir ".") (test-dir "./test") (main-class #f)
+ (use-java-modules? #f)
(test-include '("**/*Test.java"))
(test-exclude '("**/Abstract*Test.java")))
"Create a simple build.xml with standard targets for Ant."
@@ -65,7 +66,7 @@ (define* (default-build.xml jar-name prefix #:optional
(value "first")))
(property (@ (environment "env")))
(path (@ (id "classpath"))
- (pathelement (@ (location "${env.CLASSPATH}"))))
+ (pathelement (@ (path "${env.CLASSPATH}"))))
(target (@ (name "manifest"))
(mkdir (@ (dir "${manifest.dir}")))
@@ -79,18 +80,30 @@ (define* (default-build.xml jar-name prefix #:optional
(mkdir (@ (dir "${classes.dir}")))
(javac (@ (includeantruntime "false")
(srcdir ,source-dir)
- (destdir "${classes.dir}")
- (classpath (@ (refid "classpath"))))))
+ (destdir "${classes.dir}"))
+ ,(if use-java-modules?
+ `((modulepath (@ (refid "classpath"))))
+ '())
+ (classpath (@ (refid "classpath")))))
(target (@ (name "compile-tests"))
(mkdir (@ (dir "${test.classes.dir}")))
(javac (@ (includeantruntime "false")
(srcdir ,test-dir)
(destdir "${test.classes.dir}"))
- (classpath
- (pathelement (@ (path "${env.CLASSPATH}")))
- (pathelement (@ (location "${classes.dir}")))
- (pathelement (@ (location "${test.classes.dir}"))))))
+ ,(if use-java-modules?
+ `((classpath
+ (pathelement
+ (@ (path "${env.CLASSPATH}")))
+ (pathelement
+ (@ (location "${classes.dir}")))
+ (pathelement
+ (@ (location "${test.classes.dir}")))))
+ '())
+ (classpath
+ (pathelement (@ (path "${env.CLASSPATH}")))
+ (pathelement (@ (location "${classes.dir}")))
+ (pathelement (@ (location "${test.classes.dir}"))))))
(target (@ (name "check")
(depends "compile-tests"))
@@ -156,13 +169,15 @@ (define* (configure #:key inputs outputs (jar-name #f)
(source-dir "src")
(test-dir "src/test")
(main-class #f)
+ (use-java-modules? #f)
(test-include '("**/*Test.java"))
(test-exclude '("**/Abstract*.java")) #:allow-other-keys)
(when jar-name
(default-build.xml jar-name
(string-append (assoc-ref outputs "out")
"/share/java")
- source-dir test-dir main-class test-include test-exclude))
+ source-dir test-dir main-class use-java-modules?
+ test-include test-exclude))
(setenv "JAVA_HOME" (assoc-ref inputs "jdk"))
(setenv "CLASSPATH" (generate-classpath inputs))
#t)
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#66879] [PATCH v2 3/5] gnu: Add java-jakarta-json.
2023-11-02 6:50 ` [bug#66879] [PATCH v2 1/5] gnu: openjdk9: Install default certificates Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 2/5] guix: ant: Optionally build with java modules Julien Lepiller
@ 2023-11-02 6:50 ` Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 4/5] gnu: Add java-parsson Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 5/5] gnu: josm: Update to 18822 Julien Lepiller
3 siblings, 0 replies; 8+ messages in thread
From: Julien Lepiller @ 2023-11-02 6:50 UTC (permalink / raw)
To: 66879; +Cc: Björn Höfling, Julien Lepiller
* gnu/packages/java.scm (java-jakarta-json): New variable.
Change-Id: I2c123710f9d31bf71e8fb86ff0d336b6fcfa9674
---
gnu/packages/java.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 567fb05f77..d80e0e9be8 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -13653,6 +13653,33 @@ (define-public java-jsonp-impl
parse, generate, transform and query) JSON messages. This package contains
a reference implementation of that API.")))
+(define-public java-jakarta-json
+ (package
+ (name "java-jakarta-json")
+ (version "2.1.3")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/jakartaee/jsonp-api")
+ (commit (string-append version "-RELEASE"))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1q600harqfhlf763l75j4fx7ai7ybp7ga06aiky2a2hg8mhz0s5f"))))
+ (build-system ant-build-system)
+ (arguments
+ `(#:jar-name "jakarta-json.jar"
+ #:source-dir "api/src/main/java"
+ #:tests? #f; no tests
+ #:jdk ,openjdk11))
+ (home-page "https://github.com/jakartaee/jsonp-api")
+ (synopsis "Portable API for JSON handling in Java")
+ (description "This project contains API and Compatible Implementation of
+Jakarta JSON Processing specification. Jakarta JSON Processing provides
+portable APIs to parse, generate, transform, and query JSON documents.")
+ ;; with classpath exception
+ (license license:epl2.0)))
+
(define-public java-xmp
(package
(name "java-xmp")
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#66879] [PATCH v2 4/5] gnu: Add java-parsson.
2023-11-02 6:50 ` [bug#66879] [PATCH v2 1/5] gnu: openjdk9: Install default certificates Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 2/5] guix: ant: Optionally build with java modules Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 3/5] gnu: Add java-jakarta-json Julien Lepiller
@ 2023-11-02 6:50 ` Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 5/5] gnu: josm: Update to 18822 Julien Lepiller
3 siblings, 0 replies; 8+ messages in thread
From: Julien Lepiller @ 2023-11-02 6:50 UTC (permalink / raw)
To: 66879; +Cc: Björn Höfling, Julien Lepiller
* gnu/packages/java.scm (java-parsson): New variable.
Change-Id: Ie564924329e4e0a866e6ed5fe9135c841fb66ae8
---
gnu/packages/java.scm | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index d80e0e9be8..13b5961c3c 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -13680,6 +13680,43 @@ (define-public java-jakarta-json
;; with classpath exception
(license license:epl2.0)))
+(define-public java-parsson
+ (package
+ (name "java-parsson")
+ (version "1.1.5")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/eclipse-ee4j/parsson")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "06vvr6qv1ihnk212gdxg4x0sd61lgxk7wf062s7gym5k2h7fms0p"))))
+ (build-system ant-build-system)
+ (arguments
+ `(#:jar-name "parsson.jar"
+ #:source-dir "impl/src/main/java"
+ #:test-dir "impl/src/test"
+ #:use-java-modules? #t
+ #:jdk ,openjdk11
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'copy-resources
+ (lambda _
+ (copy-recursively "impl/src/main/resources"
+ "build/classes"))))))
+ (inputs
+ (list java-jakarta-json))
+ (native-inputs
+ (list java-junit))
+ (home-page "https://github.com/eclipse-ee4j/parsson")
+ (synopsis "Implementation of Jakarta JSON API")
+ (description "Eclipse Parsson is an implementation of the Jakarta JSON
+Processing specification.")
+ ;; with classpath exception
+ (license license:epl2.0)))
+
(define-public java-xmp
(package
(name "java-xmp")
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#66879] [PATCH v2 5/5] gnu: josm: Update to 18822.
2023-11-02 6:50 ` [bug#66879] [PATCH v2 1/5] gnu: openjdk9: Install default certificates Julien Lepiller
` (2 preceding siblings ...)
2023-11-02 6:50 ` [bug#66879] [PATCH v2 4/5] gnu: Add java-parsson Julien Lepiller
@ 2023-11-02 6:50 ` Julien Lepiller
2023-11-02 10:00 ` Andreas Enge
3 siblings, 1 reply; 8+ messages in thread
From: Julien Lepiller @ 2023-11-02 6:50 UTC (permalink / raw)
To: 66879; +Cc: Andreas Enge, Efraim Flashner, Eric Bavier
* gnu/packages/geo.scm (josm): Update to 18822.
[inputs]: Use new json implementation.
[arguments]: Use openjdk11 to prevent warning at startup.
Change-Id: I393e0ed765d1d0da7870595d2eccefae17836eb9
---
gnu/packages/geo.scm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/gnu/packages/geo.scm b/gnu/packages/geo.scm
index a33d446201..dbc8440141 100644
--- a/gnu/packages/geo.scm
+++ b/gnu/packages/geo.scm
@@ -1940,7 +1940,7 @@ (define-public java-opening-hours-parser
(define-public josm
(package
(name "josm")
- (version "18646")
+ (version "18822")
(source (origin
(method svn-fetch)
(uri (svn-reference
@@ -1949,7 +1949,7 @@ (define-public josm
(recursive? #f)))
(sha256
(base32
- "0zr3p1i39wi0f29lgb3xrnv6lijrq5ia8jxn4wnq1yz0xdlbg98i"))
+ "0b4q6n3jbqrh7dsfmcf2g0xdd1wjj62sjq8lwvggvrpqlk1fyn1b"))
(file-name (string-append name "-" version "-checkout"))
(modules '((guix build utils)))
(snippet
@@ -1963,17 +1963,18 @@ (define-public josm
(list java-commons-jcs
java-commons-compress
java-jmapviewer
- java-jsonp-api
- java-jsonp-impl ; runtime dependency
+ java-jakarta-json
java-jsr305
java-metadata-extractor
java-opening-hours-parser
java-openjfx-media
+ java-parsson ; runtime dependency
java-signpost-core
java-svg-salamander))
(arguments
`(#:tests? #f
#:jar-name "josm.jar"
+ #:jdk ,openjdk11
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'rm-build.xml
--
2.41.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [bug#66879] [PATCH v2 5/5] gnu: josm: Update to 18822.
2023-11-02 6:50 ` [bug#66879] [PATCH v2 5/5] gnu: josm: Update to 18822 Julien Lepiller
@ 2023-11-02 10:00 ` Andreas Enge
2023-11-09 18:10 ` bug#66879: " Julien Lepiller
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Enge @ 2023-11-02 10:00 UTC (permalink / raw)
To: Julien Lepiller; +Cc: Eric Bavier, Efraim Flashner, 66879
Am Thu, Nov 02, 2023 at 07:50:13AM +0100 schrieb Julien Lepiller:
> * gnu/packages/geo.scm (josm): Update to 18822.
> [inputs]: Use new json implementation.
> [arguments]: Use openjdk11 to prevent warning at startup.
Looks good!
Andreas
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#66879: [PATCH v2 5/5] gnu: josm: Update to 18822.
2023-11-02 10:00 ` Andreas Enge
@ 2023-11-09 18:10 ` Julien Lepiller
0 siblings, 0 replies; 8+ messages in thread
From: Julien Lepiller @ 2023-11-09 18:10 UTC (permalink / raw)
To: Andreas Enge; +Cc: 66879-done, Efraim Flashner, Eric Bavier
Le Thu, 2 Nov 2023 11:00:16 +0100,
Andreas Enge <andreas@enge.fr> a écrit :
> Am Thu, Nov 02, 2023 at 07:50:13AM +0100 schrieb Julien Lepiller:
> > * gnu/packages/geo.scm (josm): Update to 18822.
> > [inputs]: Use new json implementation.
> > [arguments]: Use openjdk11 to prevent warning at startup.
>
> Looks good!
>
> Andreas
>
Pushed to master as 5392d9db46d6f931233be2f25688481181622bb4 to
71d54f3ac451527d3c741bc1209f6b03329f8571.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-11-09 18:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-01 12:53 [bug#66879] [PATCH] gnu: josm: Update to 18822 Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 1/5] gnu: openjdk9: Install default certificates Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 2/5] guix: ant: Optionally build with java modules Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 3/5] gnu: Add java-jakarta-json Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 4/5] gnu: Add java-parsson Julien Lepiller
2023-11-02 6:50 ` [bug#66879] [PATCH v2 5/5] gnu: josm: Update to 18822 Julien Lepiller
2023-11-02 10:00 ` Andreas Enge
2023-11-09 18:10 ` bug#66879: " Julien Lepiller
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.