diff mbox series

[bug#60976,v3,1/4] gnu: Add java-jericho-html

Message ID 63faa821.170a0220.bf499.2f6f@mx.google.com
State New
Headers show
Series [bug#60976,v3,1/4] gnu: Add java-jericho-html | expand

Commit Message

Frank Pursel Jan. 26, 2023, 4:46 p.m. UTC
---
The main point here is to give us ditaa but we also want the ziggaraut
to be fully guix maintainable.  Hence here I submit another complete
patch set providing all that preceeded plus changes to java-jericho-html
that, in hindsight, I wish I had put in there in the first place.
Better late than never.

Regards,
Frank Pursel

 gnu/packages/java-xml.scm | 79 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)


base-commit: 0e480ca7b60428a62fc4681d7aca6c7c067add42

Comments

Julien Lepiller Feb. 26, 2023, 7:47 a.m. UTC | #1
Hi!

Since you're introducing jericho-html in this series, why don't you merge the first and fourth patch, to introduce the correct version immediately?

Note that phases do not need to end with #t anymore.

Usually, synopsis is put before description. The description should be a full sentence, it cannot start with "A". Maybe "This library is a…" or "This Java library allows analysing…"

I'm not a fan of having the hash and version outside the package dehinition with a let when it's not necessary. You can put the hash directly where it belongs, since it's used only once, and the version in the version fiild. You can refer to the version field in all subsequent fields, which is how we do it usually. Same with internal name, it won't change, so I would just use a string directly.

I'd also sort inputs in alphabetic order (even chough most packages in java.scm don't…)

Le 26 janvier 2023 17:46:25 GMT+01:00, Frank Pursel <frank.pursel@gmail.com> a écrit :
>---
>The main point here is to give us ditaa but we also want the ziggaraut
>to be fully guix maintainable.  Hence here I submit another complete
>patch set providing all that preceeded plus changes to java-jericho-html
>that, in hindsight, I wish I had put in there in the first place.
>Better late than never.
>
>Regards,
>Frank Pursel
>
> gnu/packages/java-xml.scm | 79 +++++++++++++++++++++++++++++++++++++++
> 1 file changed, 79 insertions(+)
>
>diff --git a/gnu/packages/java-xml.scm b/gnu/packages/java-xml.scm
>index 5b16806e27..9cf256549b 100644
>--- a/gnu/packages/java-xml.scm
>+++ b/gnu/packages/java-xml.scm
>@@ -6,6 +6,7 @@
> ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
> ;;; Copyright © 2021 Léo Le Bouter <lle-bout@zaclys.net>
> ;;; Copyright © 2022 Christopher Baines <mail@cbaines.net>
>+;;; Copyright © 2023 Frank Pursel <frank.pursel@gmail.com>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
>@@ -37,6 +38,84 @@ (define-module (gnu packages java-xml)
>   #:use-module (guix build-system ant)
>   #:use-module (guix utils))
> 
>+(define-public java-jericho-html
>+  (let ((ver "3.4")
>+        (hash "1i7z3b8yamgkm7p3pv9qzv8l2kw15ccxy1aj9mpbf66kzkkds51i")
>+        (internal-name "jericho-html"))
>+    (package
>+      (name "java-jericho-html")
>+      (version ver)
>+      (source (origin
>+                (method url-fetch/zipbomb)
>+                (uri (string-append
>+                      "https://sourceforge.net/projects/jerichohtml"
>+                      "/files/jericho-html/3.4/jericho-html-3.4.zip/download"))
>+                (sha256
>+                 (base32
>+                  hash))
>+                (modules '((guix build utils)))
>+                (snippet '(begin
>+                            (format #t "~%~a~%" "Removing sourced jar files.")
>+                            (for-each (lambda (jarf)
>+                                        (delete-file jarf)
>+                                        (format #t "Deleted: ~a~%" jarf))
>+                                      (find-files "." "\\.jar$"))))))
>+      (build-system ant-build-system)
>+      (arguments
>+       `(#:jar-name (string-append ,name ".jar")
>+         #:source-dir (string-append ,internal-name "-"
>+                                     ,ver "/src/")
>+         #:test-dir (string-append ,internal-name "-"
>+                                   ,ver "/test/")
>+         #:test-exclude (list "**/StAXTest.java"
>+			      "**/NodeIteratorTest.java"
>+			      "**/ScriptTest.java"
>+			      "**/SegmentGetStyleURISegmentsTest.java"
>+			      "**/SegmentTest.java"
>+			      "**/StreamedSourceTest.java"
>+			      "**/HTMLSanitiserTest.java")
>+         #:phases (modify-phases %standard-phases
>+                    (add-before 'build 'add-ant-env-options
>+                      (lambda* _
>+                        (setenv "ANT_OPTS" "-Dfile.encoding=iso-8859-1") #t))
>+                    (add-after 'build 'check-prep
>+                      (lambda* (#:key source #:allow-other-keys)
>+                        (let* ((cwd (getcwd))
>+			       (jericho-test (string-append cwd "/" ,internal-name
>+						    "-" ,ver "/test"))
>+			       (test (string-append jericho-test "/test"))
>+			       (test-data (string-append jericho-test "/data"))
>+			       (test-src (string-append jericho-test "/src"))
>+			       (test-src-data (string-append test-src "/data")))
>+                          (format #t "~%Check Prep dir: ~s\n" cwd)
>+                          (substitute* "build.xml"
>+                            (("\\$\\{test\\.home\\}/java")
>+                             "${test.home}/src"))
>+                          (mkdir-p (string-append cwd "/build/test-classes"))
>+                          (copy-recursively (string-append cwd
>+                                      "/"
>+                                      ,internal-name
>+                                      "-"
>+                                      ,ver
>+                                      "/samples/console/classes")
>+                                     (string-append cwd
>+                                      "/build/test-classes/"))
>+			  (mkdir-p test-src-data)
>+			  (copy-recursively test-data
>+					    test-src-data))
>+                        #t)))))
>+      (native-inputs (list java-junit java-slf4j-api java-log4j-api
>+                           java-commons-logging-minimal))
>+      (home-page "http://jericho.htmlparser.net/docs/index.html")
>+      (description
>+       "A java library allowing analysis and manipulation of
>+parts of an HTML document, including server-side tags, while
>+reproducing verbatim any unrecognised or invalid HTML.  It also
>+provides high-level HTML form manipulation functions.  
>+")
>+      (synopsis "Java HTML Parser library")
>+      (license (list license:lgpl2.1+ license:asl2.0 license:epl1.0)))))
>+
> (define-public java-simple-xml
>   (package
>     (name "java-simple-xml")
>
>base-commit: 0e480ca7b60428a62fc4681d7aca6c7c067add42
diff mbox series

Patch

diff --git a/gnu/packages/java-xml.scm b/gnu/packages/java-xml.scm
index 5b16806e27..9cf256549b 100644
--- a/gnu/packages/java-xml.scm
+++ b/gnu/packages/java-xml.scm
@@ -6,6 +6,7 @@ 
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
 ;;; Copyright © 2021 Léo Le Bouter <lle-bout@zaclys.net>
 ;;; Copyright © 2022 Christopher Baines <mail@cbaines.net>
+;;; Copyright © 2023 Frank Pursel <frank.pursel@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,6 +38,84 @@  (define-module (gnu packages java-xml)
   #:use-module (guix build-system ant)
   #:use-module (guix utils))
 
+(define-public java-jericho-html
+  (let ((ver "3.4")
+        (hash "1i7z3b8yamgkm7p3pv9qzv8l2kw15ccxy1aj9mpbf66kzkkds51i")
+        (internal-name "jericho-html"))
+    (package
+      (name "java-jericho-html")
+      (version ver)
+      (source (origin
+                (method url-fetch/zipbomb)
+                (uri (string-append
+                      "https://sourceforge.net/projects/jerichohtml"
+                      "/files/jericho-html/3.4/jericho-html-3.4.zip/download"))
+                (sha256
+                 (base32
+                  hash))
+                (modules '((guix build utils)))
+                (snippet '(begin
+                            (format #t "~%~a~%" "Removing sourced jar files.")
+                            (for-each (lambda (jarf)
+                                        (delete-file jarf)
+                                        (format #t "Deleted: ~a~%" jarf))
+                                      (find-files "." "\\.jar$"))))))
+      (build-system ant-build-system)
+      (arguments
+       `(#:jar-name (string-append ,name ".jar")
+         #:source-dir (string-append ,internal-name "-"
+                                     ,ver "/src/")
+         #:test-dir (string-append ,internal-name "-"
+                                   ,ver "/test/")
+         #:test-exclude (list "**/StAXTest.java"
+			      "**/NodeIteratorTest.java"
+			      "**/ScriptTest.java"
+			      "**/SegmentGetStyleURISegmentsTest.java"
+			      "**/SegmentTest.java"
+			      "**/StreamedSourceTest.java"
+			      "**/HTMLSanitiserTest.java")
+         #:phases (modify-phases %standard-phases
+                    (add-before 'build 'add-ant-env-options
+                      (lambda* _
+                        (setenv "ANT_OPTS" "-Dfile.encoding=iso-8859-1") #t))
+                    (add-after 'build 'check-prep
+                      (lambda* (#:key source #:allow-other-keys)
+                        (let* ((cwd (getcwd))
+			       (jericho-test (string-append cwd "/" ,internal-name
+						    "-" ,ver "/test"))
+			       (test (string-append jericho-test "/test"))
+			       (test-data (string-append jericho-test "/data"))
+			       (test-src (string-append jericho-test "/src"))
+			       (test-src-data (string-append test-src "/data")))
+                          (format #t "~%Check Prep dir: ~s\n" cwd)
+                          (substitute* "build.xml"
+                            (("\\$\\{test\\.home\\}/java")
+                             "${test.home}/src"))
+                          (mkdir-p (string-append cwd "/build/test-classes"))
+                          (copy-recursively (string-append cwd
+                                      "/"
+                                      ,internal-name
+                                      "-"
+                                      ,ver
+                                      "/samples/console/classes")
+                                     (string-append cwd
+                                      "/build/test-classes/"))
+			  (mkdir-p test-src-data)
+			  (copy-recursively test-data
+					    test-src-data))
+                        #t)))))
+      (native-inputs (list java-junit java-slf4j-api java-log4j-api
+                           java-commons-logging-minimal))
+      (home-page "http://jericho.htmlparser.net/docs/index.html")
+      (description
+       "A java library allowing analysis and manipulation of
+parts of an HTML document, including server-side tags, while
+reproducing verbatim any unrecognised or invalid HTML.  It also
+provides high-level HTML form manipulation functions.  
+")
+      (synopsis "Java HTML Parser library")
+      (license (list license:lgpl2.1+ license:asl2.0 license:epl1.0)))))
+
 (define-public java-simple-xml
   (package
     (name "java-simple-xml")