From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8seh-0000ym-LA for guix-patches@gnu.org; Wed, 18 Apr 2018 15:22:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8sef-0004Vp-AG for guix-patches@gnu.org; Wed, 18 Apr 2018 15:22:11 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:51745) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f8sef-0004Vl-5r for guix-patches@gnu.org; Wed, 18 Apr 2018 15:22:09 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1f8sed-0001HZ-Cq for guix-patches@gnu.org; Wed, 18 Apr 2018 15:22:08 -0400 Subject: [bug#31212] [PATCH 9/9] gnu: Add java-apache-ivy. Resent-Message-ID: From: Julien Lepiller Date: Wed, 18 Apr 2018 21:21:20 +0200 Message-Id: <20180418192120.11603-9-julien@lepiller.eu> In-Reply-To: <20180418192120.11603-1-julien@lepiller.eu> References: <20180418210458.306490ed@lepiller.eu> <20180418192120.11603-1-julien@lepiller.eu> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 31212@debbugs.gnu.org * gnu/package/java.scm (java-apache-ivy): New variable. * gnu/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/java.scm | 101 ++++++++++++++++++ ...ache-ivy-port-to-latest-bouncycastle.patch | 81 ++++++++++++++ 3 files changed, 183 insertions(+) create mode 100644 gnu/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch diff --git a/gnu/local.mk b/gnu/local.mk index 639dd943d..53443a352 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -793,6 +793,7 @@ dist_patch_DATA = \ %D%/packages/patches/intltool-perl-compatibility.patch \ %D%/packages/patches/isl-0.11.1-aarch64-support.patch \ %D%/packages/patches/jacal-fix-texinfo.patch \ + %D%/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch \ %D%/packages/patches/java-jeromq-fix-tests.patch \ %D%/packages/patches/java-powermock-fix-java-files.patch \ %D%/packages/patches/java-simple-xml-fix-tests.patch \ diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index a63d9707f..90fd07c59 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -9705,3 +9705,104 @@ and Pageant included in Putty. This component contains a connector factory."))) (description "jsch-agent-proxy is a proxy program to OpenSSH's ssh-agent and Pageant included in Putty. This component contains a library to use jsch-agent-proxy with JSch."))) + +(define-public java-apache-ivy + (package + (name "java-apache-ivy") + (version "2.4.0") + (source (origin + (method url-fetch) + (uri (string-append "mirror://apache//ant/ivy/" version + "/apache-ivy-" version "-src.tar.gz")) + (sha256 + (base32 + "1xkfn57g2m7l6y0xdq75x5rnrgk52m9jx2xah70g3ggl8750hbr0")) + (patches + (search-patches + "java-apache-ivy-port-to-latest-bouncycastle.patch")))) + (build-system ant-build-system) + (arguments + `(#:jar-name "ivy.jar" + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-before 'build 'remove-example + (lambda _ + (delete-file-recursively "src/example") + #t)) + (add-before 'build 'copy-resources + (lambda _ + (with-directory-excursion "src/java" + (for-each (lambda (file) + (install-file file (string-append "../../build/classes/" (dirname file)))) + (append + (find-files "." ".*.css") + (find-files "." ".*.ent") + (find-files "." ".*.html") + (find-files "." ".*.properties") + (find-files "." ".*.xsd") + (find-files "." ".*.xsl") + (find-files "." ".*.xml")))))) + (add-before 'build 'fix-vfs + (lambda _ + (substitute* + '("src/java/org/apache/ivy/plugins/repository/vfs/VfsRepository.java" + "src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java") + (("import org.apache.commons.vfs") "import org.apache.commons.vfs2")) + #t)) + (add-before 'install 'copy-manifest + (lambda _ + (install-file "META-INF/MANIFEST.MF" "build/classes/META-INF") + #t)) + (add-before 'install 'repack + (lambda _ + (invoke "jar" "-cmf" "build/classes/META-INF/MANIFEST.MF" "build/jar/ivy.jar" + "-C" "build/classes" ".") + #t)) + (add-after 'install 'install-bin + (lambda* (#:key outputs #:allow-other-keys) + (let* ((bin (string-append (assoc-ref outputs "out") "/bin")) + (ivy (string-append bin "/ivy")) + (jar (string-append (assoc-ref outputs "out") "/share/java/ivy.jar"))) + (mkdir-p bin) + (with-output-to-file ivy + (lambda _ + (display (string-append + "#!" (which "sh") "\n" + "if [[ -z $CLASSPATH ]]; then\n" + " cp=\"" (getenv "CLASSPATH") ":" jar "\"\n" + "else\n" + " cp=\"" (getenv "CLASSPATH") ":" jar ":$CLASSPATH\"\n" + "fi\n" + (which "java") " -cp $cp org.apache.ivy.Main $@\n")))) + (chmod ivy #o755) + #t)))))) + (inputs + `(("java-bouncycastle" ,java-bouncycastle) + ("java-commons-cli" ,java-commons-cli) + ("java-commons-collections" ,java-commons-collections) + ("java-commons-httpclient" ,java-commons-httpclient) + ("java-commons-lang" ,java-commons-lang) + ("java-commons-vfs" ,java-commons-vfs) + ("java-jakarta-oro" ,java-jakarta-oro) + ("java-jsch" ,java-jsch) + ("java-jsch-agentproxy-core" ,java-jsch-agentproxy-core) + ("java-jsch-agentproxy-connector-factory" ,java-jsch-agentproxy-connector-factory) + ("java-jsch-agentproxy-jsch" ,java-jsch-agentproxy-jsch) + ("java-junit" ,java-junit))) + (home-page "https://ant.apache.org/ivy") + (synopsis "Dependency manager for the Java programming language") + (description "Ivy is a tool for managing (recording, tracking, resolving +and reporting) project dependencies. It is characterized by the following: + +@itemize +@item flexibility and configurability - Ivy is essentially process agnostic + and is not tied to any methodology or structure. Instead it provides the + necessary flexibility and configurability to be adapted to a broad range + of dependency management and build processes. +@item tight integration with Apache Ant - while available as a standalone tool, + Ivy works particularly well with Apache Ant providing a number of + powerful Ant tasks ranging from dependency resolution to dependency + reporting and publication. +@end itemize") + (license license:asl2.0))) diff --git a/gnu/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch b/gnu/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch new file mode 100644 index 000000000..506de833d --- /dev/null +++ b/gnu/packages/patches/java-apache-ivy-port-to-latest-bouncycastle.patch @@ -0,0 +1,81 @@ +From 29055a825af5405e44ffcd59a776f8952bdc7203 Mon Sep 17 00:00:00 2001 +From: Julien Lepiller +Date: Fri, 15 Dec 2017 16:03:23 +0100 +Subject: [PATCH] Port to latest bouncycastle. + +--- + .../bouncycastle/OpenPGPSignatureGenerator.java | 34 ++++++++++------------ + 1 file changed, 16 insertions(+), 18 deletions(-) + +diff --git a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java +index af7beae..34c204f 100644 +--- a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java ++++ b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java +@@ -41,6 +41,11 @@ import org.bouncycastle.openpgp.PGPSecretKeyRingCollection; + import org.bouncycastle.openpgp.PGPSignature; + import org.bouncycastle.openpgp.PGPSignatureGenerator; + import org.bouncycastle.openpgp.PGPUtil; ++import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor; ++import org.bouncycastle.openpgp.operator.bc.BcPBESecretKeyDecryptorBuilder; ++import org.bouncycastle.openpgp.operator.bc.BcPGPDigestCalculatorProvider; ++import org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder; ++import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator; + + public class OpenPGPSignatureGenerator implements SignatureGenerator { + +@@ -101,11 +106,15 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator { + pgpSec = readSecretKey(keyIn); + } + +- PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(password.toCharArray(), +- BouncyCastleProvider.PROVIDER_NAME); +- PGPSignatureGenerator sGen = new PGPSignatureGenerator(pgpSec.getPublicKey() +- .getAlgorithm(), PGPUtil.SHA1, BouncyCastleProvider.PROVIDER_NAME); +- sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey); ++ PBESecretKeyDecryptor decryptor = ++ new BcPBESecretKeyDecryptorBuilder(new BcPGPDigestCalculatorProvider()) ++ .build(password.toCharArray()); ++ PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(decryptor); ++ BcPGPContentSignerBuilder builder = new BcPGPContentSignerBuilder( ++ pgpSec.getPublicKey().getAlgorithm(), PGPUtil.SHA1); ++ ++ PGPSignatureGenerator sGen = new PGPSignatureGenerator(builder); ++ sGen.init(PGPSignature.BINARY_DOCUMENT, pgpPrivKey); + + in = new FileInputStream(src); + out = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(dest))); +@@ -116,22 +125,10 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator { + } + + sGen.generate().encode(out); +- } catch (SignatureException e) { +- IOException ioexc = new IOException(); +- ioexc.initCause(e); +- throw ioexc; + } catch (PGPException e) { + IOException ioexc = new IOException(); + ioexc.initCause(e); + throw ioexc; +- } catch (NoSuchAlgorithmException e) { +- IOException ioexc = new IOException(); +- ioexc.initCause(e); +- throw ioexc; +- } catch (NoSuchProviderException e) { +- IOException ioexc = new IOException(); +- ioexc.initCause(e); +- throw ioexc; + } finally { + if (out != null) { + try { +@@ -156,7 +153,8 @@ public class OpenPGPSignatureGenerator implements SignatureGenerator { + + private PGPSecretKey readSecretKey(InputStream in) throws IOException, PGPException { + in = PGPUtil.getDecoderStream(in); +- PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in); ++ PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in, ++ new BcKeyFingerprintCalculator()); + + PGPSecretKey key = null; + for (Iterator it = pgpSec.getKeyRings(); key == null && it.hasNext();) { +-- +2.15.1 -- 2.17.0