Bootstrap Maven as non-modular packages

Resolves: rhbz#1951482
This commit is contained in:
Mikolaj Izdebski 2021-06-08 20:17:56 +02:00
parent 9e5e790420
commit 51c26dc853
5 changed files with 154 additions and 19 deletions

1
.gitignore vendored
View File

@ -9,4 +9,5 @@
/easymock-3.4.tar.gz
/easymock-3.5.tar.gz
/easymock-3.6.tar.gz
/easymock-4.0.2.tar.gz
/easymock-4.2.tar.gz

View File

@ -0,0 +1,75 @@
From 5393d71f7bf9de06efd763c501486bf14413ab4a Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Thu, 29 Aug 2019 15:18:53 +0200
Subject: [PATCH] Port to hamcrest 2.1
---
.../tests2/EasyMockSupportClassTest.java | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/core/src/test/java/org/easymock/tests2/EasyMockSupportClassTest.java b/core/src/test/java/org/easymock/tests2/EasyMockSupportClassTest.java
index c5dd63b..b8be307 100644
--- a/core/src/test/java/org/easymock/tests2/EasyMockSupportClassTest.java
+++ b/core/src/test/java/org/easymock/tests2/EasyMockSupportClassTest.java
@@ -48,49 +48,49 @@ public class EasyMockSupportClassTest extends EasyMockSupport {
@Test
public void testCreateStrictControl() {
IMocksControl ctrl = createStrictControl();
- assertThat(ctrl.createMock(ToMock.class), is(ToMock.class));
+ assertThat(ctrl.createMock(ToMock.class), org.hamcrest.core.Is.isA(ToMock.class));
}
@Test
public void testCreateControl() {
IMocksControl ctrl = createControl();
- assertThat(ctrl.createMock(ToMock.class), is(ToMock.class));
+ assertThat(ctrl.createMock(ToMock.class), org.hamcrest.core.Is.isA(ToMock.class));
}
@Test
public void testCreateNiceControl() {
IMocksControl ctrl = createNiceControl();
- assertThat(ctrl.createMock(ToMock.class), is(ToMock.class));
+ assertThat(ctrl.createMock(ToMock.class), org.hamcrest.core.Is.isA(ToMock.class));
}
@Test
public void testCreateStrictMockClassOfT() {
- assertThat(createStrictMock(ToMock.class), is(ToMock.class));
+ assertThat(createStrictMock(ToMock.class), org.hamcrest.core.Is.isA(ToMock.class));
}
@Test
public void testCreateStrictMockStringClassOfT() {
- assertThat(createStrictMock("myMock", ToMock.class), is(ToMock.class));
+ assertThat(createStrictMock("myMock", ToMock.class), org.hamcrest.core.Is.isA(ToMock.class));
}
@Test
public void testCreateMockClassOfT() {
- assertThat(createMock(ToMock.class), is(ToMock.class));
+ assertThat(createMock(ToMock.class), org.hamcrest.core.Is.isA(ToMock.class));
}
@Test
public void testCreateMockStringClassOfT() {
- assertThat(createMock("myMock", ToMock.class), is(ToMock.class));
+ assertThat(createMock("myMock", ToMock.class), org.hamcrest.core.Is.isA(ToMock.class));
}
@Test
public void testCreateNiceMockClassOfT() {
- assertThat(createNiceMock(ToMock.class), is(ToMock.class));
+ assertThat(createNiceMock(ToMock.class), org.hamcrest.core.Is.isA(ToMock.class));
}
@Test
public void testCreateNiceMockStringClassOfT() {
- assertThat(createNiceMock("myMock", ToMock.class), is(ToMock.class));
+ assertThat(createNiceMock("myMock", ToMock.class), org.hamcrest.core.Is.isA(ToMock.class));
}
@Test
--
2.21.0

View File

@ -1,19 +1,32 @@
# Workaround for rhbz#1969370: __bootstrap macro is not defined in
# CentOS Stream, See https://bugzilla.redhat.com/1969370
%global __bootstrap ~bootstrap
%bcond_without bootstrap
Name: easymock
Version: 4.2
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Easy mock objects
License: ASL 2.0
URL: http://www.easymock.org
Source0: https://github.com/easymock/easymock/archive/easymock-%{version}.tar.gz
# ./generate-tarball.sh
Source0: %{name}-%{version}.tar.gz
# Remove bundled binaries which cannot be easily verified for licensing
Source1: generate-tarball.sh
Patch1: 0001-Disable-android-support.patch
Patch2: 0002-Unshade-cglib-and-asm.patch
Patch3: 0003-Fix-OSGi-manifest.patch
Patch4: 0004-Port-to-hamcrest-2.1.patch
BuildArch: noarch
BuildRequires: maven-local
%if %{with bootstrap}
BuildRequires: javapackages-bootstrap
%else
BuildRequires: mvn(cglib:cglib)
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
@ -26,12 +39,14 @@ BuildRequires: mvn(org.junit.vintage:junit-vintage-engine)
BuildRequires: mvn(org.objenesis:objenesis)
BuildRequires: mvn(org.ow2.asm:asm)
BuildRequires: mvn(org.testng:testng)
%endif
# xmvn-builddep misses this:
%if %{without bootstrap}
BuildRequires: mvn(org.apache:apache-jar-resource-bundle)
%endif
Obsoletes: %{name}3 < 3.4
Provides: %{name}3 = %{version}-%{release}
Obsoletes: %{name}2 < 2.5.2-10
%description
EasyMock provides Mock Objects for interfaces in JUnit tests by generating
@ -39,28 +54,28 @@ them on the fly using Java's proxy mechanism. Due to EasyMock's unique style
of recording expectations, most refactorings will not affect the Mock Objects.
So EasyMock is a perfect fit for Test-Driven Development.
%package javadoc
Summary: Javadoc for %{name}
%description javadoc
Javadoc for %{name}.
%prep
%setup -q -n %{name}-%{name}-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
# disable unnecessary maven plugins
%pom_remove_plugin :animal-sniffer-maven-plugin . core
%pom_remove_plugin :license-maven-plugin
%pom_remove_plugin :maven-enforcer-plugin
%pom_remove_plugin :maven-gpg-plugin test-java8 test-junit5 test-testng
%pom_remove_plugin :maven-timestamp-plugin
%pom_remove_plugin :versions-maven-plugin
%pom_remove_plugin :animal-sniffer-maven-plugin
%pom_remove_plugin :animal-sniffer-maven-plugin core
%pom_remove_plugin :maven-gpg-plugin test-testng
%pom_remove_plugin :maven-gpg-plugin test-java8
%pom_remove_plugin :maven-gpg-plugin test-junit5
# remove android support
rm core/src/main/java/org/easymock/internal/Android*.java
@ -76,31 +91,41 @@ rm core/src/test/java/org/easymock/tests2/ClassExtensionHelperTest.java
%pom_disable_module test-integration
%pom_disable_module test-osgi
# remove some warning caused by unavailable plugin
%pom_remove_plugin org.codehaus.mojo:versions-maven-plugin
# retired
%pom_remove_plugin :maven-timestamp-plugin
# For compatibility reasons
%mvn_file ":easymock{*}" easymock@1 easymock3@1
# ssh not needed during our builds
%pom_xpath_remove pom:extensions
# Force Surefire to run tests with JUnit, not with TestNG
%pom_xpath_inject "pom:plugin[pom:artifactId='maven-surefire-plugin']" \
"<configuration><testNGArtifactName>none:none</testNGArtifactName></configuration>" core
%build
%mvn_build
%install
%mvn_install
%files -f .mfiles
%license core/LICENSE.txt
%files javadoc -f .mfiles-javadoc
%license core/LICENSE.txt
%changelog
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 4.2-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jun 08 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.2-4
- Bootstrap Maven for CentOS Stream 9
* Mon May 17 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.2-3
- Bootstrap build
- Non-bootstrap build
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
@ -114,12 +139,24 @@ rm core/src/test/java/org/easymock/tests2/ClassExtensionHelperTest.java
* Fri Jul 10 2020 Jiri Vanek <jvanek@redhat.com> - 3.6-6
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
* Wed Mar 04 2020 Marian Koncek <mkoncek@redhat.com> - 4.2-1
- Update to upstream version 4.2
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.0.2-2
- Mass rebuild for javapackages-tools 201902
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jul 18 2019 Marian Koncek <mkoncek@redhat.com> - 4.0.2-1
- Update to upstream version 4.0.2
* Fri May 24 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.5-5
- Mass rebuild for javapackages-tools 201901
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
@ -271,4 +308,3 @@ rm core/src/test/java/org/easymock/tests2/ClassExtensionHelperTest.java
* Mon Oct 04 2004 Ralph Apel <r.apel at r-apel.de> - 0:1.1-1jpp
- First JPackage release

23
generate-tarball.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
name=easymock
version="$(sed -n 's/Version:\s*//p' *.spec)"
# RETRIEVE
wget "https://github.com/${name}/${name}/archive/${name}-${version}.tar.gz" -O "${name}-${version}.orig.tar.gz"
rm -rf tarball-tmp
mkdir tarball-tmp
pushd tarball-tmp
tar xf "../${name}-${version}.orig.tar.gz"
# CLEAN TARBALL
find -name '*.jar' -delete
find -name '*.class' -delete
# Contains minified js of uncertain origin
rm -r */website
tar -czf "../${name}-${version}.tar.gz" *
popd
rm -r tarball-tmp "${name}-${version}.orig.tar.gz"

View File

@ -1 +1 @@
SHA512 (easymock-4.2.tar.gz) = c0cdd3b11fd2ae9acddeb69b7393593bb7e7452e60cc88c8ec9725887a7597410705f170a0d733b7abc80207c28cd5827c41e0921bb432a93669d09f8e0d30c4
SHA512 (easymock-4.2.tar.gz) = f5bb5cf7a99ac8819c9b8ac9ab587a4526ce7febd442d128241c8a2c6ace5e47226881e42f492db98617ee6c2a8e3edf588f6595142b93fec512f9ba5e972dca