File junit4.spec of Package junit4

#
# spec file for package junit4
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           junit4
Version:        4.10
Release:        0
Summary:        Java regression test package
License:        CPL-1.0
Group:          Development/Libraries/Java
Url:            http://www.junit.org/
# git clone https://github.com/KentBeck/junit.git
# cd junit
# git archive --format=tar --prefix=junit-4.10/ r4.10 |xz -9 > ../junit-4.10.tar.xz
Source0:        junit-4.10.tar.xz
Source1:        junit-4.10.pom
# backport cb69050a45f1688ad8c6e817cc511cfa67401f63, that fixes an occasional failure in ParentRunnerTest.useChildHarvester
Patch1:         jdk7-testfailure.patch
Requires(post): jpackage-utils >= 1.7.4
Requires(postun): jpackage-utils >= 1.7.4
Requires:       hamcrest
Requires:       java >= 1.5.0
BuildRequires:  ant
BuildRequires:  hamcrest
BuildRequires:  java-devel >= 1.5.0
BuildRequires:  jpackage-utils >= 1.7.4
BuildRequires:  xz
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
JUnit is a regression testing framework written by Erich Gamma and Kent
Beck. It is used by the developer who implements unit tests in Java.
JUnit is Open Source Software, released under the Common Public License
Version 1.0 and JUnit is Open Source Software, released under the IBM
Public License and hosted on SourceForge.



%package manual
Summary:        Java regression test package
Group:          Development/Libraries/Java

%description manual
JUnit is a regression testing framework written by Erich Gamma and Kent
Beck. It is used by the developer who implements unit tests in Java.
JUnit is Open Source Software, released under the Common Public License
Version 1.0 and JUnit is Open Source Software, released under the IBM
Public License and hosted on SourceForge.



%package javadoc
Summary:        Java regression test package
Group:          Development/Libraries/Java

%description javadoc
JUnit is a regression testing framework written by Erich Gamma and Kent
Beck. It is used by the developer who implements unit tests in Java.
JUnit is Open Source Software, released under the Common Public License
Version 1.0 and JUnit is Open Source Software, released under the IBM
Public License and hosted on SourceForge.



%package demo
Summary:        Java regression test package
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}-%{release}

%description demo
JUnit is a regression testing framework written by Erich Gamma and Kent
Beck. It is used by the developer who implements unit tests in Java.
JUnit is Open Source Software, released under the Common Public License
Version 1.0 and JUnit is Open Source Software, released under the IBM
Public License and hosted on SourceForge.



%prep
%setup -q -n junit-%{version}
find . -type f -name "*.jar" | xargs -t rm
ln -s $(build-classpath hamcrest/core) lib/hamcrest-core-1.1.jar
perl -pi -e 's/\r$//g' stylesheet.css
%patch1 -p0

%build
export CLASSPATH=
export OPT_JAR_LIST=:
ant -Dant.build.javac.source=1.5 dist

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 junit%{version}/junit-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
pushd $RPM_BUILD_ROOT%{_javadir} 
ln -sf %{name}-%{version}.jar %{name}.jar
popd
# pom
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP-%{name}.pom
%add_to_maven_depmap junit junit %{version} JPP %{name}
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr junit%{version}/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
# demo
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/demo/junit # Not using % name for last part because it is 
                                                                # part of package name
cp -pr junit%{version}/junit/* $RPM_BUILD_ROOT%{_datadir}/%{name}/demo/junit

%clean
rm -rf $RPM_BUILD_ROOT

%post
%update_maven_depmap

%postun
%update_maven_depmap

%files
%defattr(0644,root,root,0755)
%doc cpl-v10.html README.html
%{_javadir}/%{name}.jar
%{_javadir}/%{name}-%{version}.jar
%{_datadir}/maven2/*
%config %{_mavendepmapfragdir}/*

%files demo
%defattr(0644,root,root,0755)
%{_datadir}/%{name}

%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-%{version}
%{_javadocdir}/%{name}

%files manual
%defattr(0644,root,root,0755)
%doc junit%{version}/doc/*

%changelog
openSUSE Build Service is sponsored by