From 5d5cb73d10859c32f2b10dd89d84c59149378db2 Mon Sep 17 00:00:00 2001 From: Michael Simacek Date: Tue, 21 Mar 2017 18:05:13 +0100 Subject: [PATCH] Install with XMvn - Update upstream URL - Build from github source - Specfile cleanup --- .gitignore | 1 + hamcrest-1.3-build.patch | 64 +++++++------- hamcrest-1.3-fork-javac.patch | 16 ++-- hamcrest-1.3-javadoc.patch | 24 +++--- hamcrest-1.3-no-jarjar.patch | 36 ++++---- hamcrest-1.3-qdox-2.0.patch | 156 +++++++++++++++++----------------- hamcrest.spec | 118 +++++++------------------ sources | 9 +- 8 files changed, 180 insertions(+), 244 deletions(-) diff --git a/.gitignore b/.gitignore index 3c27dda..cd85946 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ /*.src.rpm /noarch /.build-*.log +/hamcrest-java-1.3.tar.gz diff --git a/hamcrest-1.3-build.patch b/hamcrest-1.3-build.patch index ccb08ad..877e51e 100644 --- a/hamcrest-1.3-build.patch +++ b/hamcrest-1.3-build.patch @@ -3,37 +3,37 @@ index 1cfd4fb..5a7c740 100644 --- a/build.xml +++ b/build.xml @@ -14,13 +14,13 @@ - - -+ classpath="lib/generator/qdox.jar"/> - - -- -+ - - -- -+ - - - + + ++ classpath="lib/generator/qdox.jar"/> + + +- ++ + + +- ++ + + + @@ -152,7 +152,8 @@ - - -+ windowtitle="Hamcrest" source="1.6" failonerror="yes"> -+ - - - + + ++ windowtitle="Hamcrest" source="1.6" failonerror="yes"> ++ + + + @@ -313,6 +314,7 @@ - -+ - - - + ++ + + + diff --git a/hamcrest-1.3-fork-javac.patch b/hamcrest-1.3-fork-javac.patch index 42ff689..f5a86fe 100644 --- a/hamcrest-1.3-fork-javac.patch +++ b/hamcrest-1.3-fork-javac.patch @@ -12,14 +12,14 @@ index 1cfd4fb..69acfe8 100644 --- a/build.xml +++ b/build.xml @@ -284,7 +284,7 @@ - - - -- -+ - - - + + + +- ++ + + + -- 2.9.3 diff --git a/hamcrest-1.3-javadoc.patch b/hamcrest-1.3-javadoc.patch index 6c21e7d..adaae0d 100644 --- a/hamcrest-1.3-javadoc.patch +++ b/hamcrest-1.3-javadoc.patch @@ -3,15 +3,15 @@ index ed57763..a4550cb 100644 --- a/build.xml +++ b/build.xml @@ -135,11 +135,10 @@ - - - -- -+ - - - -- - - + + +- ++ + + + +- + + - -- -- -- -- -- -- -- -- -- - - - + + + +- +- +- +- +- +- +- +- +- + + + diff --git a/hamcrest-1.3-qdox-2.0.patch b/hamcrest-1.3-qdox-2.0.patch index 750f4c5..a65f977 100644 --- a/hamcrest-1.3-qdox-2.0.patch +++ b/hamcrest-1.3-qdox-2.0.patch @@ -13,93 +13,93 @@ index efaf615..338178d 100644 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java +++ b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDox.java @@ -1,6 +1,6 @@ - package org.hamcrest.generator; - --import com.thoughtworks.qdox.JavaDocBuilder; -+import com.thoughtworks.qdox.JavaProjectBuilder; - import com.thoughtworks.qdox.model.JavaClass; - - import java.io.File; + package org.hamcrest.generator; + +-import com.thoughtworks.qdox.JavaDocBuilder; ++import com.thoughtworks.qdox.JavaProjectBuilder; + import com.thoughtworks.qdox.model.JavaClass; + + import java.io.File; @@ -16,7 +16,7 @@ import java.io.Reader; - */ - public class QDox { - -- private final JavaDocBuilder javaDocBuilder = new JavaDocBuilder(); -+ private final JavaProjectBuilder javaDocBuilder = new JavaProjectBuilder(); - - public void addSourceTree(File sourceDir) { - javaDocBuilder.addSourceTree(sourceDir); + */ + public class QDox { + +- private final JavaDocBuilder javaDocBuilder = new JavaDocBuilder(); ++ private final JavaProjectBuilder javaDocBuilder = new JavaProjectBuilder(); + + public void addSourceTree(File sourceDir) { + javaDocBuilder.addSourceTree(sourceDir); diff --git a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java index 5108140..97fce01 100644 --- a/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java +++ b/hamcrest-generator/src/main/java/org/hamcrest/generator/QDoxFactoryReader.java @@ -4,8 +4,10 @@ import com.thoughtworks.qdox.model.DocletTag; - import com.thoughtworks.qdox.model.JavaClass; - import com.thoughtworks.qdox.model.JavaMethod; - import com.thoughtworks.qdox.model.JavaParameter; --import com.thoughtworks.qdox.model.Type; -+import com.thoughtworks.qdox.model.JavaType; -+import com.thoughtworks.qdox.model.impl.DefaultJavaClass; - -+import java.util.ArrayList; - import java.util.Iterator; - import java.util.List; - import java.util.regex.Pattern; + import com.thoughtworks.qdox.model.JavaClass; + import com.thoughtworks.qdox.model.JavaMethod; + import com.thoughtworks.qdox.model.JavaParameter; +-import com.thoughtworks.qdox.model.Type; ++import com.thoughtworks.qdox.model.JavaType; ++import com.thoughtworks.qdox.model.impl.DefaultJavaClass; + ++import java.util.ArrayList; + import java.util.Iterator; + import java.util.List; + import java.util.regex.Pattern; @@ -56,15 +58,15 @@ public class QDoxFactoryReader implements Iterable { - JavaMethod methodSource = findMethodInSource(factoryMethod); - if (methodSource != null) { - factoryMethod.setJavaDoc(createJavaDocComment(methodSource)); -- JavaParameter[] parametersFromSource -+ List parametersFromSource - = methodSource.getParameters(); - List parametersFromReflection - = factoryMethod.getParameters(); - -- if (parametersFromReflection.size() == parametersFromSource.length) { -- for (int i = 0; i < parametersFromSource.length; i++) { -+ if (parametersFromReflection.size() == parametersFromSource.size()) { -+ for (int i = 0; i < parametersFromSource.size(); i++) { - parametersFromReflection.get(i).setName( -- parametersFromSource[i].getName()); -+ parametersFromSource.get(i).getName()); - } - } - } + JavaMethod methodSource = findMethodInSource(factoryMethod); + if (methodSource != null) { + factoryMethod.setJavaDoc(createJavaDocComment(methodSource)); +- JavaParameter[] parametersFromSource ++ List parametersFromSource + = methodSource.getParameters(); + List parametersFromReflection + = factoryMethod.getParameters(); + +- if (parametersFromReflection.size() == parametersFromSource.length) { +- for (int i = 0; i < parametersFromSource.length; i++) { ++ if (parametersFromReflection.size() == parametersFromSource.size()) { ++ for (int i = 0; i < parametersFromSource.size(); i++) { + parametersFromReflection.get(i).setName( +- parametersFromSource[i].getName()); ++ parametersFromSource.get(i).getName()); + } + } + } @@ -79,18 +81,18 @@ public class QDoxFactoryReader implements Iterable { - // Note, this doesn't always work - it struggles with some kinds of generics. - // This seems to cover most cases though. - List params = factoryMethod.getParameters(); -- Type[] types = new Type[params.size()]; -+ List types = new ArrayList(params.size()); - boolean varArgs = false; -- for (int i = 0; i < types.length; i++) { -+ for (int i = 0; i < params.size(); i++) { - String type = params.get(i).getType(); - varArgs = VARARGS_REGEX.matcher(type).find(); - // QDox ignores varargs and generics, so we strip them out to help QDox. - type = GENERIC_REGEX.matcher(type).replaceAll(""); - type = VARARGS_REGEX.matcher(type).replaceAll(""); -- types[i] = new Type(type); -+ types.add(new DefaultJavaClass(type)); - } -- JavaMethod[] methods = classSource.getMethodsBySignature(factoryMethod.getName(), types, false, varArgs); -- return methods.length == 1 ? methods[0] : null; -+ List methods = classSource.getMethodsBySignature(factoryMethod.getName(), types, false, varArgs); -+ return methods.size() == 1 ? methods.get(0) : null; - } - - /** + // Note, this doesn't always work - it struggles with some kinds of generics. + // This seems to cover most cases though. + List params = factoryMethod.getParameters(); +- Type[] types = new Type[params.size()]; ++ List types = new ArrayList(params.size()); + boolean varArgs = false; +- for (int i = 0; i < types.length; i++) { ++ for (int i = 0; i < params.size(); i++) { + String type = params.get(i).getType(); + varArgs = VARARGS_REGEX.matcher(type).find(); + // QDox ignores varargs and generics, so we strip them out to help QDox. + type = GENERIC_REGEX.matcher(type).replaceAll(""); + type = VARARGS_REGEX.matcher(type).replaceAll(""); +- types[i] = new Type(type); ++ types.add(new DefaultJavaClass(type)); + } +- JavaMethod[] methods = classSource.getMethodsBySignature(factoryMethod.getName(), types, false, varArgs); +- return methods.length == 1 ? methods[0] : null; ++ List methods = classSource.getMethodsBySignature(factoryMethod.getName(), types, false, varArgs); ++ return methods.size() == 1 ? methods.get(0) : null; + } + + /** @@ -98,8 +100,8 @@ public class QDoxFactoryReader implements Iterable { - */ - private static String createJavaDocComment(JavaMethod methodSource) { - String comment = methodSource.getComment(); -- DocletTag[] tags = methodSource.getTags(); -- if ((comment == null || comment.trim().length() == 0) && tags.length == 0) { -+ List tags = methodSource.getTags(); -+ if ((comment == null || comment.trim().length() == 0) && tags.size() == 0) { - return null; - } - StringBuilder result = new StringBuilder(); + */ + private static String createJavaDocComment(JavaMethod methodSource) { + String comment = methodSource.getComment(); +- DocletTag[] tags = methodSource.getTags(); +- if ((comment == null || comment.trim().length() == 0) && tags.length == 0) { ++ List tags = methodSource.getTags(); ++ if ((comment == null || comment.trim().length() == 0) && tags.size() == 0) { + return null; + } + StringBuilder result = new StringBuilder(); -- 2.9.3 diff --git a/hamcrest.spec b/hamcrest.spec index 358fdf6..30c7896 100644 --- a/hamcrest.spec +++ b/hamcrest.spec @@ -28,36 +28,14 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -%define with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}} -%define without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}} -%define bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}} -%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}} - -# This option controls jarjar on qdox -# Since bundling the qdox classes prevents upgrades, we disable it by default -%bcond_with jarjar - -# This option controls tests which requires ant-junit and testng -%bcond_with tests - Name: hamcrest Version: 1.3 -Release: 18%{?dist} +Release: 19%{?dist} Epoch: 0 Summary: Library of matchers for building test expressions License: BSD -URL: http://code.google.com/p/hamcrest/ -Group: Development/Tools -Source0: http://%{name}.googlecode.com/files/%{name}-1.3.tgz -Source1: http://repo1.maven.org/maven2/org/%{name}/%{name}-parent/%{version}/%{name}-parent-%{version}.pom -Source2: http://repo1.maven.org/maven2/org/%{name}/%{name}-library/%{version}/%{name}-library-%{version}.pom -Source3: http://repo1.maven.org/maven2/org/%{name}/%{name}-integration/%{version}/%{name}-integration-%{version}.pom -Source4: http://repo1.maven.org/maven2/org/%{name}/%{name}-generator/%{version}/%{name}-generator-%{version}.pom -Source5: http://repo1.maven.org/maven2/org/%{name}/%{name}-core/%{version}/%{name}-core-%{version}.pom -Source6: http://repo1.maven.org/maven2/org/%{name}/%{name}-all/%{version}/%{name}-all-%{version}.pom -# This file was added by the maintainer for compatibility with maven dep -# solving system -Source7: %{name}-text-%{version}.pom +URL: https://github.com/hamcrest/JavaHamcrest +Source0: https://github.com/hamcrest/JavaHamcrest/archive/hamcrest-java-%{version}.tar.gz Source8: hamcrest-core-MANIFEST.MF Source9: hamcrest-library-MANIFEST.MF @@ -71,25 +49,17 @@ Patch3: %{name}-%{version}-javadoc.patch Patch4: %{name}-%{version}-qdox-2.0.patch Patch5: %{name}-%{version}-fork-javac.patch -Requires: java-headless >= 1:1.6.0 Requires: qdox Requires: easymock >= 3.0 Requires: %{name}-core = %{epoch}:%{version}-%{release} -BuildRequires: jpackage-utils >= 0:1.7.4 -BuildRequires: java-devel >= 1:1.6.0 -BuildRequires: ant >= 0:1.6.5 +BuildRequires: javapackages-local +BuildRequires: ant BuildRequires: ant-junit -BuildRequires: zip -BuildRequires: easymock >= 3.0 -%if %with jarjar -BuildRequires: jarjar -%endif +BuildRequires: easymock BuildRequires: junit BuildRequires: qdox -%if %with tests BuildRequires: testng -%endif BuildArch: noarch @@ -108,34 +78,27 @@ The core API of hamcrest matcher framework to be used by third-party framework p This includes the a foundation set of matcher implementations for common operations. %package javadoc -Group: Documentation Summary: Javadoc for %{name} %description javadoc Javadoc for %{name}. %package demo -Group: Development/Libraries Summary: Demos for %{name} Requires: %{name} = %{epoch}:%{version}-%{release} Requires: junit -%if %with tests Requires: testng -%endif %description demo Demonstrations and samples for %{name}. %prep -%setup -q +%setup -q -n JavaHamcrest-%{name}-java-%{version} + find . -type f -name "*.jar" | xargs -t rm rm -fr hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java rm -fr hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java rm -fr hamcrest-unit-test/src/main/java/org/hamcrest/integration/JMock1AdapterTest.java -# BUILD/hamcrest-%{version}/lib/generator/jarjar-1.0rc3.jar.no -%if %with jarjar -ln -sf $(build-classpath jarjar) lib/generator/ -%endif # BUILD/hamcrest-1.1/lib/generator/qdox-1.6.1.jar.no ln -sf $(build-classpath qdox) lib/generator/ # BUILD/hamcrest-1.1/lib/integration/easymock-2.2.jar.no @@ -143,13 +106,10 @@ ln -sf $(build-classpath easymock3) lib/integration/ # BUILD/hamcrest-1.1/lib/integration/jmock-1.10RC1.jar.no ln -sf $(build-classpath jmock) lib/integration/ # BUILD/hamcrest-1.1/lib/integration/testng-4.6-jdk15.jar.no -%if %with tests ln -sf $(build-classpath testng-jdk15) lib/integration/ -%endif + %patch0 -p1 -%if %without jarjar %patch1 -p1 -%endif %patch3 -p1 %patch4 -p1 %patch5 -p1 @@ -194,64 +154,46 @@ touch META-INF/MANIFEST.MF zip -u build/%{name}-generator-%{version}.jar META-INF/MANIFEST.MF %install -# jars -install -d -m 755 $RPM_BUILD_ROOT%{_javadir}/%{name} -install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir} -install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-parent.pom -%add_maven_depmap JPP.%{name}-parent.pom -f core +sed -i 's/@VERSION@/%{version}/g' pom/*.pom -install -m 644 build/%{name}-all-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/all.jar -install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-all.pom -%add_maven_depmap JPP.%{name}-all.pom %{name}/all.jar +%mvn_artifact pom/hamcrest-parent.pom -install -m 644 build/%{name}-core-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/core.jar -install -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-core.pom -%add_maven_depmap JPP.%{name}-core.pom %{name}/core.jar -f core +for mod in all core generator library integration; do + %mvn_artifact pom/hamcrest-$mod.pom build/%{name}-all-%{version}.jar +done -install -m 644 build/%{name}-generator-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/generator.jar -install -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-generator.pom -%add_maven_depmap JPP.%{name}-generator.pom %{name}/generator.jar +# hamcrest-text doesn't have a pom +%mvn_artifact org.hamcrest:hamcrest-text:%{version} build/%{name}-text-%{version}.jar -install -m 644 build/%{name}-library-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/library.jar -install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-library.pom -%add_maven_depmap JPP.%{name}-library.pom %{name}/library.jar +%mvn_package :hamcrest-parent core +%mvn_package :hamcrest-core core -install -m 644 build/%{name}-integration-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/integration.jar -install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-integration.pom -%add_maven_depmap JPP.%{name}-integration.pom %{name}/integration.jar - -install -m 644 build/%{name}-text-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/text.jar -install -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-text.pom -%add_maven_depmap JPP.%{name}-text.pom %{name}/text.jar - -%if %with tests -install -m 644 build/%{name}-unit-test-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/unit-test.jar -%endif - -# javadoc -install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name} -cp -pr build/temp/hamcrest-all-1.3-javadoc.jar.contents/* $RPM_BUILD_ROOT%{_javadocdir}/%{name} +%mvn_file ':hamcrest-{*}' %{name}/@1 # demo install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name} cp -pr %{name}-examples $RPM_BUILD_ROOT%{_datadir}/%{name}/ +%mvn_install -J build/temp/hamcrest-all-1.3-javadoc.jar.contents/ + %files -f .mfiles -%doc LICENSE.txt -%dir %{_javadir}/%{name} -%if %with tests -%{_javadir}/%{name}/unit-test.jar -%endif %files core -f .mfiles-core +%license LICENSE.txt -%files javadoc -%{_javadocdir}/%{name} +%files javadoc -f .mfiles-javadoc +%license LICENSE.txt %files demo %{_datadir}/%{name} %changelog +* Tue Mar 21 2017 Michael Simacek - 0:1.3-19 +- Install with XMvn +- Update upstream URL +- Build from github source +- Specfile cleanup + * Fri Feb 10 2017 Fedora Release Engineering - 0:1.3-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild diff --git a/sources b/sources index e8580dc..7930287 100644 --- a/sources +++ b/sources @@ -1,8 +1 @@ -29b18baac02244a9b7568d5bd5bb1c42 hamcrest-all-1.3.pom -7cd680c223f3807e1ef353466b9a4b25 hamcrest-core-1.3.pom -ba3c980bbf7d7b91d63d99da503aa3f4 hamcrest-generator-1.3.pom -442fa9ad7a4dfbd6a2ab5fca6e9b36c1 hamcrest-integration-1.3.pom -f09e58cd2a1ea76816c17141db41b2e1 hamcrest-library-1.3.pom -7591ddb3581de8684c17e51741a7461d hamcrest-parent-1.3.pom -de8c4213de11a0c2f83821bb700ac5eb hamcrest-text-1.3.pom -92e91c2754d44e49b72d70c10a04cb08 hamcrest-1.3.tgz +SHA512 (hamcrest-java-1.3.tar.gz) = 4356df7b5b78f821847fde027b416b49b8456e84ab2ec98c2982adf54e2bdc01a5ca2c2b5425620c5ee34bfe3f95ea43c77190504f76ddc9f8b93b137a4ca54b