File apache-commons-logging.spec of Package apache-commons-logging

#
# spec file for package apache-commons-logging
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2007, JPackage Project
#
# 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/
#


%define base_name  logging
%define short_name commons-%{base_name}
%bcond_with java_bootstrap
Name:           apache-%{short_name}
Version:        1.1.3
Release:        0
Summary:        Apache Commons Logging
License:        Apache-2.0
Group:          Development/Libraries/Java
Url:            http://commons.apache.org/%{base_name}
Source0:        http://www.apache.org/dist/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.gz
Source1:        http://www.apache.org/dist/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.gz.asc
Source2:        apache-commons-logging.keyring
Source3:        http://mirrors.ibiblio.org/pub/mirrors/maven2/%{short_name}/%{short_name}-api/1.1/%{short_name}-api-1.1.pom
Patch0:         commons-logging-1.1.3-src-junit.diff
BuildRequires:  ant
BuildRequires:  apache-commons-parent
BuildRequires:  java-devel >= 1.6.0
BuildRequires:  javapackages-tools
BuildRequires:  junit
BuildRequires:  log4j-mini >= 1.2
BuildRequires:  servletapi5
Requires:       java >= 1.6.0
Requires:       javapackages-tools
Requires(post): javapackages-tools
Requires(postun): javapackages-tools
Provides:       jakarta-%{short_name} = %{version}-%{release}
Obsoletes:      jakarta-%{short_name} < %{version}
Provides:       %{short_name} = %{version}-%{release}
Obsoletes:      %{short_name} < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%if !%{with java_bootstrap}
BuildRequires:  ant-junit
%endif

%description
The commons-logging package provides a simple, component oriented
interface (org.apache.commons.logging.Log) together with wrappers for
logging systems. The user can choose at runtime which system they want
to use. In addition, a small number of basic implementations are
provided to allow users to use the package standalone.
commons-logging was heavily influenced by Avalon's Logkit and Log4J. The
commons-logging abstraction is meant to minimize the differences between
the two, and to allow a developer to not tie himself to a particular
logging implementation.

%prep
%setup -q -n %{short_name}-%{version}-src
%patch0 -p1

# Sent upstream https://issues.apache.org/jira/browse/LOGGING-143
%pom_remove_dep :avalon-framework
%pom_add_dep avalon-framework:avalon-framework-api:4.3
%pom_add_dep avalon-framework:avalon-framework-impl:4.3:test

sed -i 's/\r//' RELEASE-NOTES.txt LICENSE.txt

#FIXME
rm ./src/test/java/org/apache/commons/logging/servlet/BasicServletTestCase.java

%build
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
mkdir -p $MAVEN_REPO_LOCAL

export CLASSPATH=$(build-classpath \
                   plexus/ \
                   junit \
                  ):target/classes:target/test-classes
ant -Dmaven.mode.offline=true -Dlog4j12.jar=%{_javadir}/log4j.jar dist \
    -lib %{_javadir}

%install
# jars
install -d -m 755 %{buildroot}%{_javadir}
install -p -m 644 target/%{short_name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
install -p -m 644 target/%{short_name}-api-%{version}.jar %{buildroot}%{_javadir}/%{name}-api.jar
install -p -m 644 target/%{short_name}-adapters-%{version}.jar %{buildroot}%{_javadir}/%{name}-adapters.jar

pushd %{buildroot}%{_javadir}
for jar in %{name}*; do
    ln -sf ${jar} `echo $jar| sed "s|apache-||g"`
done
popd

# pom
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -pm 644 pom.xml %{buildroot}/%{_mavenpomdir}/JPP-%{short_name}.pom
install -pm 644 %{SOURCE3} %{buildroot}/%{_mavenpomdir}/JPP-%{short_name}-api.pom

%add_maven_depmap JPP-%{short_name}.pom %{short_name}.jar -a "org.apache.commons:commons-logging"
%add_maven_depmap JPP-%{short_name}-api.pom %{short_name}-api.jar -a "org.apache.commons:commons-logging-api"

%files
%defattr(0644,root,root,0755)
%doc PROPOSAL.html LICENSE.txt RELEASE-NOTES.txt NOTICE.txt
%{_javadir}/*
%{_mavenpomdir}/JPP-%{short_name}.pom
%{_mavenpomdir}/JPP-%{short_name}-api.pom
%config %{_mavendepmapfragdir}/*

%changelog
openSUSE Build Service is sponsored by