[PATCH] gnu: Add java-commons-text

  • Done
  • quality assurance status badge
Details
2 participants
  • Julien Lepiller
  • Artyom V. Poptsov
Owner
unassigned
Submitted by
Artyom V. Poptsov
Severity
normal

Debbugs page

Artyom V. Poptsov wrote 3 years ago
(address . guix-patches@gnu.org)
87edzrw0e7.fsf@gmail.com
Hello,

here's the patch that adds 'java-commons-text'. [1]

Unfortunately I had to disable tests as they require JUnit5 (which is
missing from GNU Guix at the moment.)

Also many thanks to Julien Lepiller who helped me to update
'java-commons-lang3' to 3.12.0, which in turn was required to package
'java-commons-text'.

- Artyom

References:
From a3c835fb370930a6bc99ae872bc7f4c541587189 Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Mon, 13 Jun 2022 06:54:25 +0300
Subject: [PATCH] gnu: Add java-commons-text

* gnu/packages/java.scm (java-commons-text): New variable.
---
gnu/packages/java.scm | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)

Toggle diff (51 lines)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index d2fbf840a0..1750dc662b 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -7893,6 +7893,44 @@ Commons CLI supports different types of options:
@item long options with single hyphen (ie. ant -projecthelp)
@end itemize
+This is a part of the Apache Commons Project.")
+ (license license:asl2.0)))
+
+(define-public java-commons-text
+ (package
+ (name "java-commons-text")
+ (version "1.9")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://apache/commons/text/source/"
+ "commons-text-" version "-src.tar.gz"))
+ (sha256
+ (base32
+ "1k99ib2dxlqxb5y94kpzf4ix8xgxz1j3n9kq3ddssqqcccsp5ik2"))))
+ (build-system ant-build-system)
+ (arguments
+ (list #:jar-name
+ "java-commons-text.jar"
+ #:source-dir
+ "src/main/java"
+ #:test-dir
+ "src/test"
+ ;; XXX: Tests require JUnit5, namely 'org.junit.jupiter.api' module
+ ;; from JUnit5.
+ #:tests?
+ #f))
+ (inputs (list java-commons-lang3 java-commons-io))
+ ;; XXX: These are dependencies required for running the tests (which are
+ ;; disable until JUnit5 is available.)
+ ;; (native-inputs
+ ;; (list java-assertj
+ ;; java-junit))
+ (propagated-inputs (list apache-commons-parent-pom-52))
+ (home-page "https://commons.apache.org/text/")
+ (synopsis "Library focused on algorithms working on strings")
+ (description "Apache Commons Text is a library focused on algorithms
+working on strings.
+
This is a part of the Apache Commons Project.")
(license license:asl2.0)))
--
2.25.1
--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmKo1wAACgkQ6cWi2QiY
oC+3Ogf/XxJCo23x5FtcMOA0ilHEemwuTAiDpYgeWejdjofjx5RnjCA6XzB+62or
USXwFrb3YDLD51gOu+Cp2+K2bRVZJaOXF9VpJTSGhZFBPvsH3Pz7rkIRKnfxpqsc
Gb3gOlfg4y4Uac9CSft4nYnYbXPMi6QyAAMg8GnQIlZcF2BU4ZkOtHMdBjuoE15Q
NRpmG+Heyc0AReyxz5PTd/T26ciRojIzIpWnC/76h/ZjdFpI9NtiE70dpa9A4OSY
f1SrZXLuH1M1oybXuxY9C5uWqrL5nPZW57KkF/UwChZ6c0ow5sPvwjnLKktLbcYT
2h2GFJdhPr4yz5ryB5XQPkqn1D8iAw==
=xvYy
-----END PGP SIGNATURE-----

Julien Lepiller wrote 3 years ago
FDA94F10-C239-45C3-B1EA-EFACCFC9C66C@lepiller.eu
Hi!

The patch looks good to me. I would just change some things for style: no need for a new line between a keyword and it value in the arguments list, and use a quote or semi-quote instead of list. I think the comments are a bit too much, but I'm not sure what's the riggt amount. If it were me, I would only add a comment to #:tests? saying it depends on junit5 which is not packaged.

Maybe more important, you say it's a dependency for maven-plugin-plugin. In that case, we need to install it with its pom file, to lib/m2. This is done by install-from-pom.

Maybe at this point we should mandate using it for java packages? We can always go back and fix them when needed, but it's much less work to do the right thing from the start.

Just thinking out load, maybe we could add a #:pom argument to the ant-build-system, so we don't have to modify the phases all the time?


On June 14, 2022 8:44:16 PM GMT+02:00, "Artyom V. Poptsov" <poptsov.artyom@gmail.com> wrote:
Toggle quote (16 lines)
>Hello,
>
>here's the patch that adds 'java-commons-text'. [1]
>
>Unfortunately I had to disable tests as they require JUnit5 (which is
>missing from GNU Guix at the moment.)
>
>Also many thanks to Julien Lepiller who helped me to update
>'java-commons-lang3' to 3.12.0, which in turn was required to package
>'java-commons-text'.
>
>- Artyom
>
>References:
>1. https://commons.apache.org/proper/commons-text/
>
Attachment: file
Julien Lepiller wrote 3 years ago
E4BCCF50-196E-4D25-93DF-26CDE616FA20@lepiller.eu
Hi!

The patch looks good to me. I would just change some things for style: no need for a new line between a keyword and it value in the arguments list, and use a quote or semi-quote instead of list. I think the comments are a bit too much, but I'm not sure what's the riggt amount. If it were me, I would only add a comment to #:tests? saying it depends on junit5 which is not packaged.

Maybe more important, you say it's a dependency for maven-plugin-plugin. In that case, we need to install it with its pom file, to lib/m2. This is done by install-from-pom.

Maybe at this point we should mandate using it for java packages? We can always go back and fix them when needed, but it's much less work to do the right thing from the start.

Just thinking out load, maybe we could add a #:pom argument to the ant-build-system, so we don't have to modify the phases all the time?

On June 14, 2022 8:44:16 PM GMT+02:00, "Artyom V. Poptsov" <poptsov.artyom@gmail.com> wrote:
Toggle quote (16 lines)
>Hello,
>
>here's the patch that adds 'java-commons-text'. [1]
>
>Unfortunately I had to disable tests as they require JUnit5 (which is
>missing from GNU Guix at the moment.)
>
>Also many thanks to Julien Lepiller who helped me to update
>'java-commons-lang3' to 3.12.0, which in turn was required to package
>'java-commons-text'.
>
>- Artyom
>
>References:
>1. https://commons.apache.org/proper/commons-text/
>
Attachment: file
Artyom V. Poptsov wrote 3 years ago
(name . Julien Lepiller)(address . julien@lepiller.eu)
871qvmvszq.fsf@gmail.com
Hello Julien,

I've updated the patch according to your suggestions. Could you please
take a look?
From aaafb87ce534f5ae337988f6b540704facfd11ee Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Mon, 13 Jun 2022 06:54:25 +0300
Subject: [PATCH] gnu: Add java-commons-text

* gnu/packages/java.scm (java-commons-text): New variable.
---
gnu/packages/java.scm | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

Toggle diff (48 lines)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index d2fbf840a0..25d2377c0d 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -7893,6 +7893,41 @@ Commons CLI supports different types of options:
@item long options with single hyphen (ie. ant -projecthelp)
@end itemize
+This is a part of the Apache Commons Project.")
+ (license license:asl2.0)))
+
+(define-public java-commons-text
+ (package
+ (name "java-commons-text")
+ (version "1.9")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://apache/commons/text/source/"
+ "commons-text-" version "-src.tar.gz"))
+ (sha256
+ (base32
+ "1k99ib2dxlqxb5y94kpzf4ix8xgxz1j3n9kq3ddssqqcccsp5ik2"))))
+ (build-system ant-build-system)
+ (arguments
+ (list #:jar-name "java-commons-text.jar"
+ #:source-dir "src/main/java"
+ #:test-dir "src/test"
+ ;; XXX: Tests require JUnit5, namely 'org.junit.jupiter.api' module
+ ;; from JUnit5.
+ #:tests? #f
+ #:phases #~(modify-phases %standard-phases
+ (replace 'install
+ (install-from-pom "pom.xml")))))
+ (inputs
+ (list java-commons-lang3
+ java-commons-io))
+ (propagated-inputs
+ (list apache-commons-parent-pom-52))
+ (home-page "https://commons.apache.org/text/")
+ (synopsis "Library focused on algorithms working on strings")
+ (description "Apache Commons Text is a library focused on algorithms
+working on strings.
+
This is a part of the Apache Commons Project.")
(license license:asl2.0)))
--
2.25.1
Thanks!

- Artyom

--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmKt/HkACgkQ6cWi2QiY
oC9UfAgAouAqGBOPwCDiCqADtnnNKTCavueGc+eL4OcNAM23BM0Aa0buKzq1XZL8
cdmkao6ocMztObzKu0M2UNEpp4HDVbn4mQkHJJFtcZTMQ6O6rOfjNGpzKiAWhvh5
8OZxAsFtiW+4smCbKxbIt3FdcQF3FRDZWhq6vkyAHbeYplj9mARfdkEXWhAkwhNp
HSCQKjveH1d6d2ACAROWhjFnu+OGwWjZKrysdnhe2EmINntVnFVE0xg6qxAjobFB
Dx27TwpHylt1VksotN6C2GUlfJdObgYYIa6/PMKzE5gjXX5M7rLRt6bC2MeuNzfe
4YN9b0L0kKWYmYdwLJCLR4CeovI5ZA==
=hYp4
-----END PGP SIGNATURE-----

Julien Lepiller wrote 3 years ago
(name . Artyom V. Poptsov)(address . poptsov.artyom@gmail.com)(address . 55979@debbugs.gnu.org)
20220618214159.07a3cff6@sybil.lepiller.eu
Le Sat, 18 Jun 2022 19:25:29 +0300,
"Artyom V. Poptsov" <poptsov.artyom@gmail.com> a écrit :

Toggle quote (9 lines)
> + (build-system ant-build-system)
> + (arguments
> + (list #:jar-name "java-commons-text.jar"
> + #:source-dir "src/main/java"
> + #:test-dir "src/test"
> + ;; XXX: Tests require JUnit5, namely
> 'org.junit.jupiter.api' module
> + ;; from JUnit5.

I think ;; tests require junit5
is enough here :)

Toggle quote (5 lines)
> + #:tests? #f
> + #:phases #~(modify-phases %standard-phases
> + (replace 'install
> + (install-from-pom "pom.xml")))))

great :)

Toggle quote (6 lines)
> + (inputs
> + (list java-commons-lang3
> + java-commons-io))
> + (propagated-inputs
> + (list apache-commons-parent-pom-52))

So this is an error, because apache-commons-parent-pom-52 is not the
parent of this package's pom file. Here's the content of the pom file
(btw you can view it easily with "guix build -S java-commons-text"):

<parent>
<groupId>org.apache.commons</groupId>
<artifactId>commons-parent</artifactId>
<version>51</version>
</parent>

so the parent is apache-commons-parent-pom-51 (note the version number).

Also in the list of dependencies from that file I see
java-commons-lang3, so it needs to be propagated, otherwise maven might
not be able to find it.

Toggle quote (2 lines)
> + (synopsis "Library focused on algorithms working on strings")
Artyom V. Poptsov wrote 3 years ago
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 55979@debbugs.gnu.org)
87mte73yj9.fsf@gmail.com
Hello,

here's an updated version of the patch. I've added
'apache-commons-parent-pom-51' in the same patch, not sure if it's right
though.
From 0b3f5533d2c97c333b201da307f31cca9deb6a1a Mon Sep 17 00:00:00 2001
From: "Artyom V. Poptsov" <poptsov.artyom@gmail.com>
Date: Mon, 13 Jun 2022 06:54:25 +0300
Subject: [PATCH] gnu: Add java-commons-text

* gnu/packages/java.scm (java-commons-text): New variable.
* gnu/packages/maven-parent-pom.scm (apache-commons-parent-pom-51): New
variable, required for 'java-commons-text'.
---
gnu/packages/java.scm | 33 +++++++++++++++++++++++++++++++
gnu/packages/maven-parent-pom.scm | 5 +++++
2 files changed, 38 insertions(+)

Toggle diff (62 lines)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index d2fbf840a0..4ac1e52f67 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -7893,6 +7893,39 @@ Commons CLI supports different types of options:
@item long options with single hyphen (ie. ant -projecthelp)
@end itemize
+This is a part of the Apache Commons Project.")
+ (license license:asl2.0)))
+
+(define-public java-commons-text
+ (package
+ (name "java-commons-text")
+ (version "1.9")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://apache/commons/text/source/"
+ "commons-text-" version "-src.tar.gz"))
+ (sha256
+ (base32
+ "1k99ib2dxlqxb5y94kpzf4ix8xgxz1j3n9kq3ddssqqcccsp5ik2"))))
+ (build-system ant-build-system)
+ (arguments
+ (list #:jar-name "java-commons-text.jar"
+ #:source-dir "src/main/java"
+ #:test-dir "src/test"
+ #:tests? #f ; Tests require JUnit5.
+ #:phases #~(modify-phases %standard-phases
+ (replace 'install
+ (install-from-pom "pom.xml")))))
+ (inputs
+ (list java-commons-io))
+ (propagated-inputs
+ (list java-commons-lang3
+ apache-commons-parent-pom-51))
+ (home-page "https://commons.apache.org/text/")
+ (synopsis "Library focused on algorithms working on strings")
+ (description "Apache Commons Text is a library focused on algorithms
+working on strings.
+
This is a part of the Apache Commons Project.")
(license license:asl2.0)))
diff --git a/gnu/packages/maven-parent-pom.scm b/gnu/packages/maven-parent-pom.scm
index cf48be86a2..bb5e97e6e2 100644
--- a/gnu/packages/maven-parent-pom.scm
+++ b/gnu/packages/maven-parent-pom.scm
@@ -143,6 +143,11 @@
"50" "0ki8px35dan51ashblpw6rdl27c2fq62slazhslhq3lr4fwlpvxs"
apache-parent-pom-21))
+(define-public apache-commons-parent-pom-51
+ (make-apache-commons-parent-pom
+ "51" "05najrpys26jymla2p5jdz4mf4fjp525h6mnr0jfx55lp03xi939"
+ apache-parent-pom-21))
+
(define-public apache-commons-parent-pom-52
(make-apache-commons-parent-pom
"52" "0fb6id9cs9944fjlirjc07bf234bwi96i642px09m9nrfj338n5d"
--
2.25.1
Thanks!

- Artyom

--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmKwz2oACgkQ6cWi2QiY
oC97fwf/d86/xdyPa3EuhCfUfXEaOOREI6h+4M0XeWYjzcg37nmd8kIhYNrUIzTD
o54rjyHkrZOqVc4b2gkNFEsV19tdH3OzDVMtWRKw+mBGRLweU8GYYdeuDi0jC7Wo
ks6VQJNhH/bRLsdIXJ3kF6B/8SVCSxvINr4EEzjX0VfTt7sv9fEcgHS8cFU/oklw
lrmT4c8g5ypNocZoP0wFPksV9l1sxcnV2VyflQXJozkfW8GVXH+4YobMjztLbKIr
7Skqc3hha+avxMWRIWg82NXHOHhUF9IzyTMnkEwpFmkDFXgJ+HUp47mJlYy85wlc
g7962YG3HrVICSO96ukF3wg49XANdQ==
=wlkt
-----END PGP SIGNATURE-----

Artyom V. Poptsov wrote 3 years ago
(name . Julien Lepiller)(address . julien@lepiller.eu)(address . 55979@debbugs.gnu.org)
87edzf43s2.fsf@gmail.com
Hello,

have you had any chance to review my patch?

Thanks!

- Artyom

--
Artyom "avp" Poptsov <poptsov.artyom@gmail.com>
CADR Hackerspace co-founder: https://cadrspace.ru/
GPG: D0C2 EAC1 3310 822D 98DE B57C E9C5 A2D9 0898 A02F
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEE0MLqwTMQgi2Y3rV86cWi2QiYoC8FAmK0tN0ACgkQ6cWi2QiY
oC/l4wf+OnVXB2FpzuNQirgOjIU4K71QLmS2fQSAjnZz4OXl2eB1fLlqOn7a7KPU
IGG0y/5AQtkdM8JONq4+O1qMMDPQp1Rq7bh82aCGE0doUjNV6RxyXRdjsG3BGfmO
WmJ9OAkkAwRVshSVLaTNyrJMHQmwI+fJriuF10muQyhk7czx32nvIcStf7FxJbZ+
yd5OU9TAP6cZkkp//D73htl0JXtntfgZDESVBNH3kjlSUGTUPHBi3gyNzqzdSSWX
8giUTz85AIcUCQfcIrCI1Sy7KjBtXSFFMNQYwzfjMvhhizGQMtcJOpgaxAQsPpF0
WG09Q3IKQYXELnAKRPymCoR9QHI0VA==
=aMQ2
-----END PGP SIGNATURE-----

Julien Lepiller wrote 3 years ago
(name . Artyom V. Poptsov)(address . poptsov.artyom@gmail.com)(address . 55979-done@debbugs.gnu.org)
20220625113929.7dfa8abb@sybil.lepiller.eu
I split the patch in two commits (one per package) and pushed to master
as 583537f2d6b8e5cd7f4b2f6cc7a6d7d2c9aeae7a and
2f8929482acf709d36e89ba8aca9d281b8cf6831.

I changed the propagated input of apache-commons-parent-pom-51 to
apache-parent-pom-23 instead of apache-parent-pom-21, because that's
what the pom file contains. I added a full stop at the end of the
commit message.

Thank you!
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 55979@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 55979
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help