From 4213781c4df4ccf5f77243e194321057e1ee2498 Mon Sep 17 00:00:00 2001 From: Severin Gehwolf Date: Fri, 31 Aug 2012 17:45:18 +0200 Subject: [PATCH] Make mockito an OSGi bundle using upstream bnd config. --- fix-bnd-config.patch | 27 +++++++++++++++++++++++++++ make-mockito-sourcetarball.sh | 14 ++++++++++---- mockito.spec | 15 +++++++++++++-- sources | 2 +- 4 files changed, 51 insertions(+), 7 deletions(-) create mode 100644 fix-bnd-config.patch diff --git a/fix-bnd-config.patch b/fix-bnd-config.patch new file mode 100644 index 0000000..cec2269 --- /dev/null +++ b/fix-bnd-config.patch @@ -0,0 +1,27 @@ +--- conf/mockito-core.bnd.orig 2012-08-31 17:38:35.605728658 +0200 ++++ conf/mockito-core.bnd 2012-08-31 17:39:06.490980938 +0200 +@@ -1,8 +1,3 @@ +--classpath= lib/run/com.springsource.org.junit-4.5.0.jar, \ +- lib/run/com.springsource.org.hamcrest.core-1.1.0.jar, \ +- lib/run/com.springsource.org.objenesis-1.0.0.jar +--versionpolicy=[${version;==;${@}},${version;+;${@}}) +- + Bundle-Name= Mockito Mock Library for Java. Core bundle requires Hamcrest-core and Objenesis. + Bundle-SymbolicName= org.mockito.mockito-core + Bundle-Version= 1.9.0 +@@ -10,7 +5,7 @@ + Export-Package= !org.mockito.asm.*, \ + !org.mockito.cglib.*, \ + !org.mockito.internal.*, \ +- org.mockito.*;version=${version} ++ org.mockito.* + + Import-Package= junit.*;resolution:=optional, \ + org.junit.*;resolution:=optional, \ +@@ -21,4 +16,4 @@ + + Private-Package: org.mockito.* + +--removeheaders: Private-Package +\ No newline at end of file ++-removeheaders: Private-Package diff --git a/make-mockito-sourcetarball.sh b/make-mockito-sourcetarball.sh index 54d1d6e..224d629 100644 --- a/make-mockito-sourcetarball.sh +++ b/make-mockito-sourcetarball.sh @@ -4,10 +4,16 @@ VERSION=1.9.0 SRCDIR=mockito-${VERSION} hg clone https://code.google.com/p/mockito/ ${SRCDIR} -cd $SRCDIR -hg update ${VERSION} -rm -rf `find -name *.jar` build.gradle cglib-and-asm conf doc gradle gradlew gradlew.bat +pushd $SRCDIR +hg archive --prefix ${SRCDIR} -t tar -r ${VERSION} ../${SRCDIR}.tar +popd + +rm -rf ${SRCDIR} + +tar -xf ${SRCDIR}.tar +pushd ${SRCDIR} +rm -rf `find -name *.jar` build.gradle cglib-and-asm doc gradle gradlew gradlew.bat dos2unix `find -name *.java` -cd .. +popd tar -cvJf mockito-${VERSION}.tar.xz ${SRCDIR} diff --git a/mockito.spec b/mockito.spec index 45f8b41..fcd1a07 100644 --- a/mockito.spec +++ b/mockito.spec @@ -1,6 +1,6 @@ Name: mockito Version: 1.9.0 -Release: 7%{?dist} +Release: 8%{?dist} Summary: A Java mocking framework License: MIT @@ -10,6 +10,7 @@ Source1: make-mockito-sourcetarball.sh Patch0: fixup-ant-script.patch Patch1: fix-cglib-refs.patch Patch2: maven-cglib-dependency.patch +Patch3: fix-bnd-config.patch BuildArch: noarch BuildRequires: jpackage-utils @@ -46,14 +47,21 @@ This package contains the API documentation for %{name}. %patch0 -p1 %patch1 -p1 %patch2 -p1 +# Set Bundle-Version properly +sed -i 's/Bundle-Version= ${version}/Bundle-Version= %{version}/' conf/mockito-core.bnd +%patch3 %build ant jar javadoc +# Convert to OSGi bundle +pushd target +java -jar $(build-classpath aqute-bnd) wrap -output mockito-core-%{version}.bar -properties ../conf/mockito-core.bnd mockito-core-%{version}.jar +popd %install mkdir -p $RPM_BUILD_ROOT%{_javadir} sed -i -e "s|@version@|%{version}|g" maven/mockito-core.pom -cp -p target/mockito-core-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar +cp -p target/mockito-core-%{version}.bar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir} install -pm 644 maven/mockito-core.pom \ @@ -77,6 +85,9 @@ cp -rp target/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name} %doc NOTICE %changelog +* Mon Aug 27 2012 Severin Gehwolf 1.9.0-8 +- Add aqute bnd instructions for OSGi metadata + * Fri Jul 20 2012 Fedora Release Engineering - 1.9.0-7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild diff --git a/sources b/sources index 8ab5632..3d148e8 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c358a9b514bee558dd78eaaa5d18cc15 mockito-1.9.0.tar.xz +1c8f7d570579d7fbaa2a45fdeaf3e3e1 mockito-1.9.0.tar.xz