diff --git a/0001-Update-bouncycastle-to-1.52.patch b/0001-Update-bouncycastle-to-1.52.patch new file mode 100644 index 0000000000000000000000000000000000000000..0bdddab3c8d7211c0be80d39218b5c989e577cb7 --- /dev/null +++ b/0001-Update-bouncycastle-to-1.52.patch @@ -0,0 +1,93 @@ +diff --git a/ivy.xml b/ivy.xml +index d448897..7d8896a 100644 +--- a/ivy.xml ++++ b/ivy.xml +@@ -50,8 +50,8 @@ + + + +- +- ++ ++ + + + +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..bec8ae4 100644 +--- a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java ++++ b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java +@@ -23,16 +23,18 @@ import java.io.FileOutputStream; + import java.io.IOException; + import java.io.InputStream; + import java.io.OutputStream; +-import java.security.NoSuchAlgorithmException; +-import java.security.NoSuchProviderException; + import java.security.Security; +-import java.security.SignatureException; + import java.util.Iterator; + + import org.apache.ivy.plugins.signer.SignatureGenerator; + import org.bouncycastle.bcpg.ArmoredOutputStream; + import org.bouncycastle.bcpg.BCPGOutputStream; + import org.bouncycastle.jce.provider.BouncyCastleProvider; ++import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor; ++import org.bouncycastle.openpgp.operator.bc.BcKeyFingerprintCalculator; ++import org.bouncycastle.openpgp.operator.bc.BcPBESecretKeyDecryptorBuilder; ++import org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder; ++import org.bouncycastle.openpgp.operator.bc.BcPGPDigestCalculatorProvider; + import org.bouncycastle.openpgp.PGPException; + import org.bouncycastle.openpgp.PGPPrivateKey; + import org.bouncycastle.openpgp.PGPSecretKey; +@@ -101,11 +103,13 @@ 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); ++ PGPSignatureGenerator sGen = new PGPSignatureGenerator( ++ new BcPGPContentSignerBuilder(pgpSec.getPublicKey() ++ .getAlgorithm(), PGPUtil.SHA1)); ++ sGen.init(PGPSignature.BINARY_DOCUMENT, pgpPrivKey); + + in = new FileInputStream(src); + out = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(dest))); +@@ -116,22 +120,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 +148,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();) { diff --git a/apache-ivy-2.4.0-src.tar.gz b/apache-ivy-2.4.0-src.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..c4464feb9b2001022f7e5f4579ea3e260c8b8a90 Binary files /dev/null and b/apache-ivy-2.4.0-src.tar.gz differ diff --git a/apache-ivy.spec b/apache-ivy.spec new file mode 100644 index 0000000000000000000000000000000000000000..08aa23f4648b741f952c4142d6e2c48562c2e734 --- /dev/null +++ b/apache-ivy.spec @@ -0,0 +1,63 @@ +Name: apache-ivy +Version: 2.4.0 +Release: 16 +Summary: Java-based dependency manager +License: ASL 2.0 +URL: https://ant.apache.org/ivy/ +Source0: http://mirrors.tuna.tsinghua.edu.cn/apache//ant/ivy/%{version}/%{name}-%{version}-src.tar.gz + +Patch0: 0001-Update-bouncycastle-to-1.52.patch + +BuildArch: noarch +BuildRequires: ant ant-contrib ant-testutil apache-commons-lang jakarta-commons-httpclient jsch +BuildRequires: jakarta-oro apache-commons-parent sonatype-oss-parent apache-parent ivy-local >= 4 +BuildRequires: jsch-agent-proxy-jsch jsch-agent-proxy-core jsch-agent-proxy-connector-factory +BuildRequires: apache-commons-vfs bouncycastle bouncycastle-pg + +Provides: %{name}-javadoc = %{version}-%{release} +Obsoletes: %{name}-javadoc < %{version}-%{release} + +%description +Apache Ivy is a popular dependency manager focusing on flexibility and simplicity. + +%package_help + +%prep +%autosetup -n %{name}-%{version} -p1 + +sed -i 's:/etc/ivy/:%{_sysconfdir}/ivy/:' src/java/org/apache/ivy/ant/IvyAntSettings.java + +%mvn_alias : jayasoft:ivy +%mvn_file : %{name}/ivy ivy + +sed -i s/ant-trax/ant/ ivy.xml +sed -i /bouncycastle/s/jdk14/jdk16/ ivy.xml +sed -i "s/commons.vfs/&2/" src/java/org/apache/ivy/plugins/repository/vfs/* +sed -i /ivy:publish/s/local/xmvn/ build.xml + +%build +%ant -Divy.mode=local -Dtarget.ivy.bundle.version=%{version} -Dtarget.ivy.bundle.version.qualifier= -Dtarget.ivy.version=%{version} jar javadoc publish-local + +%install +%mvn_install -J build/doc/reports/api + +mkdir -p %{buildroot}%{_sysconfdir}/ant.d +echo "apache-ivy/ivy" > %{buildroot}%{_sysconfdir}/ant.d/%{name} + +%files +%defattr(-,root,root) +%license LICENSE +%{_sysconfdir}/ant.d/apache-ivy +%{_datadir}/java/* +%{_datadir}/ivy-xmls +%{_datadir}/javadoc/* +%{_datadir}/maven-poms/* +%{_datadir}/maven-metadata/* + +%files help +%defattr(-,root,root) +%doc README NOTICE + +%changelog +* Thu Jan 16 2020 Jiangping Hu - 2.4.0-16 +- Package init