Gentoo Archives: gentoo-commits

From: Florian Schmaus <flow@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-java/bcprov/
Date: Mon, 06 Jun 2022 07:42:35
Message-Id: 1654501343.75c1d546674404faca44134967e34837ce2b40d1.flow@gentoo
1 commit: 75c1d546674404faca44134967e34837ce2b40d1
2 Author: Volkmar W. Pogatzki <gentoo <AT> pogatzki <DOT> net>
3 AuthorDate: Sun Jun 5 11:46:52 2022 +0000
4 Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
5 CommitDate: Mon Jun 6 07:42:23 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75c1d546
7
8 dev-java/bcprov: add java-pkg-2_pkg_setup
9
10 Bug: https://bugs.gentoo.org/847592
11 Closes: https://bugs.gentoo.org/849299
12 Closes: https://bugs.gentoo.org/847454
13 Signed-off-by: Volkmar W. Pogatzki <gentoo <AT> pogatzki.net>
14 Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
15
16 dev-java/bcprov/bcprov-1.71-r1.ebuild | 111 ++++++++++++++++++++++++++++++++++
17 1 file changed, 111 insertions(+)
18
19 diff --git a/dev-java/bcprov/bcprov-1.71-r1.ebuild b/dev-java/bcprov/bcprov-1.71-r1.ebuild
20 new file mode 100644
21 index 000000000000..6863a4a66716
22 --- /dev/null
23 +++ b/dev-java/bcprov/bcprov-1.71-r1.ebuild
24 @@ -0,0 +1,111 @@
25 +# Copyright 1999-2022 Gentoo Authors
26 +# Distributed under the terms of the GNU General Public License v2
27 +
28 +EAPI=8
29 +
30 +JAVA_PKG_IUSE="doc source test"
31 +MAVEN_ID="org.bouncycastle:bcprov-jdk18on:1.71"
32 +JAVA_TESTING_FRAMEWORKS="junit-4"
33 +
34 +inherit java-pkg-2 java-pkg-simple check-reqs
35 +
36 +DESCRIPTION="Java cryptography APIs"
37 +HOMEPAGE="https://www.bouncycastle.org/java.html"
38 +SRC_URI="https://github.com/bcgit/bc-java/archive/r${PV/./rv}.tar.gz -> bc-java-r${PV/./rv}.tar.gz"
39 +
40 +LICENSE="BSD"
41 +SLOT="0"
42 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
43 +
44 +DEPEND=">=virtual/jdk-11:*"
45 +RDEPEND=">=virtual/jre-1.8:*"
46 +BDEPEND="app-arch/zip"
47 +
48 +DOCS=( ../{README,SECURITY}.md )
49 +HTML_DOCS=( ../{CONTRIBUTORS,index}.html )
50 +
51 +S="${WORKDIR}/bc-java-r${PV/./rv}/prov"
52 +
53 +JAVA_SRC_DIR=(
54 + "src/main/java"
55 + "../core/src/main/java" # package org.bouncycastle.asn1 does not exist
56 + "src/main/jdk1.9" # https://bugs.gentoo.org/797634
57 +)
58 +JAVA_RESOURCE_DIRS="src/main/resources"
59 +
60 +JAVA_TEST_GENTOO_CLASSPATH="junit-4"
61 +JAVA_TEST_SRC_DIR=( "src/test/java" "../core/src/test/java" )
62 +JAVA_TEST_RESOURCE_DIRS=( "src/test/resources" "../core/src/test/resources" )
63 +
64 +JAVA_TEST_EXTRA_ARGS="-Dbc.test.data.home=${S}/../core/src/test/data"
65 +
66 +# Depending on vm_version 11 or 17 there are 2 different errrors
67 +# 1) testJCE(org.bouncycastle.jce.provider.test.SimpleTestTest)
68 +# junit.framework.AssertionFailedError: index 29 KeyStore: Exception: java.security.KeyStoreException: BKS-V1 not found
69 +# at junit.framework.Assert.fail(Assert.java:57)
70 +# at junit.framework.TestCase.fail(TestCase.java:223)
71 +# at org.bouncycastle.jce.provider.test.SimpleTestTest.testJCE(SimpleTestTest.java:26)
72 +#
73 +# 1) testJCE(org.bouncycastle.jce.provider.test.SimpleTestTest)
74 +# junit.framework.AssertionFailedError: index 9 BlockCipher: IDEA/PGPCFB/NoPadding failed encryption - java.io.IOException: javax.crypto.ShortBufferException: output buffer too short for input.
75 +# at junit.framework.Assert.fail(Assert.java:57)
76 +# at junit.framework.TestCase.fail(TestCase.java:223)
77 +# at org.bouncycastle.jce.provider.test.SimpleTestTest.testJCE(SimpleTestTest.java:26)
78 +JAVA_TEST_RUN_ONLY=(
79 + "org.bouncycastle.asn1.test.AllTests"
80 + "org.bouncycastle.crypto.agreement.test.AllTests"
81 + "org.bouncycastle.crypto.ec.test.AllTests"
82 + "org.bouncycastle.crypto.prng.test.AllTests"
83 + "org.bouncycastle.crypto.test.AllTests"
84 + "org.bouncycastle.jcajce.provider.test.AllTests"
85 +# "org.bouncycastle.jce.provider.test.AllTests" # bug #827146
86 + "org.bouncycastle.jce.provider.test.nist.AllTests"
87 + "org.bouncycastle.jce.provider.test.rsa3.AllTests"
88 + "org.bouncycastle.pqc.crypto.lms.AllTests"
89 + "org.bouncycastle.pqc.crypto.test.AllTests"
90 + "org.bouncycastle.pqc.jcajce.provider.test.AllTests"
91 + "org.bouncycastle.util.encoders.test.AllTests"
92 +)
93 +
94 +check_env() {
95 + if use test; then
96 + # this is needed only for tests
97 + CHECKREQS_MEMORY="2048M"
98 + check-reqs_pkg_pretend
99 + fi
100 +}
101 +
102 +pkg_pretend() {
103 + check_env
104 +}
105 +
106 +pkg_setup() {
107 + check_env
108 + java-pkg-2_pkg_setup
109 +}
110 +
111 +src_prepare() {
112 + default
113 + java-pkg_clean ..
114 +}
115 +
116 +src_test() {
117 + JAVA_TEST_EXTRA_ARGS+=" -Xmx${CHECKREQS_MEMORY}"
118 + java-pkg-simple_src_test
119 +}
120 +
121 +src_install() {
122 + default
123 + einstalldocs
124 + docinto html
125 + dodoc -r ../docs
126 +
127 + # These files are not present in the upstream jar but are used for tests
128 + # Removing them from the jar file after testing
129 + zip --delete "${S}"/bcprov.jar \
130 + "org/bouncycastle/pqc/crypto/ntru/*" \
131 + "org/bouncycastle/pqc/math/ntru/*" \
132 + || die "cleaning after tests failed"
133 +
134 + java-pkg-simple_src_install
135 +}