File jakarta-commons-dbcp.spec of Package jakarta-commons-dbcp
#
# spec file for package jakarta-commons-dbcp (Version 1.2.2)
#
# Copyright (c) 2008 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/
#
# norootforbuild
# icecream 0
%define with_maven 0
%define base_name dbcp
%define short_name commons-%{base_name}
%define section free
Name: jakarta-commons-dbcp
Version: 1.2.2
Release: 88
Summary: Jakarta Commons DataBase Pooling Package
License: The Apache Software License
Group: Development/Libraries/Java
Source0: http://www.apache.org/dist/commons/dbcp/source/commons-dbcp-1.2.2-src.tar.bz2
Source1: pom-maven2jpp-depcat.xsl
Source2: pom-maven2jpp-newdepmap.xsl
Source3: pom-maven2jpp-mapdeps.xsl
Source4: %{base_name}-%{version}-jpp-depmap.xml
Source5: commons-build.tar.bz2
Source6: dbcp-tomcat5-build.xml
Source7: commons-dbcp-1.2.2.pom
Patch0: commons-dbcp-1.2.2-project_xml.patch
#improved from https://issues.apache.org/jira/browse/DBCP-191
Patch1: java6-compatibility.patch
Patch2: %{name}-target15.patch
Url: http://jakarta.apache.org/commons/dbcp/
BuildRequires: ant >= 1.6.5
BuildRequires: jpackage-utils > 1.7.2
BuildRequires: jakarta-commons-pool >= 1.3
BuildRequires: jakarta-commons-logging
BuildRequires: jdbc-stdext >= 2.0
BuildRequires: xerces-j2
BuildRequires: junit >= 3.8.1
BuildRequires: jakarta-commons-pool-tomcat5
BuildRequires: jakarta-commons-collections-tomcat5
BuildRequires: tomcat6-lib
BuildRequires: java-devel
#!BuildIgnore: jakarta-commons-dbcp-tomcat5
%if %{with_maven}
BuildRequires: maven >= 1.1
BuildRequires: maven-plugins-base
BuildRequires: maven-plugin-artifact
BuildRequires: maven-plugin-checkstyle
BuildRequires: sf-cobertura-maven-plugin
BuildRequires: sf-findbugs-maven-plugin
BuildRequires: maven-plugin-pmd
BuildRequires: maven-plugin-xdoc
BuildRequires: maven-plugin-test
BuildRequires: maven-plugin-license
BuildRequires: maven-plugin-changes
BuildRequires: saxon
BuildRequires: saxon-scripts
%endif
Requires(post): /usr/sbin/update-alternatives
Requires(preun): /usr/sbin/update-alternatives
Requires: jakarta-commons-collections >= 3.2
Requires: jakarta-commons-pool >= 1.3
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: %{short_name}
Provides: hibernate_jdbc_cache
Obsoletes: %{short_name}
Requires(post): jpackage-utils >= 1.7.2
Requires(postun): jpackage-utils >= 1.7.2
%description
The DBCP package creates and maintains a database connection pool
package written in the Java language to be distributed under the ASF
license. The package is available as a pseudo-JDBC driver and via a
DataSource interface. The package also supports multiple logins to
multiple database systems, reclamation of stale or dead connections,
testing for valid connections, PreparedStatement pooling, and other
features.
%package javadoc
License: The Apache Software License
Summary: Javadoc for jakarta-commons-dbcp
Group: Development/Libraries/Java
Requires(post): /bin/rm,/bin/ln
Requires(postun): /bin/rm
%description javadoc
This package contains the javadoc documentation for the DBCP package.
The DBCP package shall create and maintain a database connection pool
package written in the Java language to be distributed under the ASF
license. The package shall be available as a pseudo-JDBC driver and via
a DataSource interface. The package shall also support multiple logins
to multiple database systems, reclamation of stale or dead connections,
testing for valid connections, PreparedStatement pooling, and other
features.
%package tomcat5
License: The Apache Software License
Summary: Jakarta Commons DataBase Pooling Package
Group: Development/Libraries/Java
%description tomcat5
The DBCP package creates and maintains a database connection pool
package written in the Java language to be distributed under the ASF
license. The package is available as a pseudo-JDBC driver and via a
DataSource interface. The package also supports multiple logins to
multiple database systems, reclamation of stale or dead connections,
testing for valid connections, PreparedStatement pooling, and other
features.
%if %{with_maven}
%package manual
Summary: Documents for %{name}
Group: Development/Documentation
%description manual
This package contains the documentation for the DBCP package.
The DBCP package shall create and maintain a database connection pool
package written in the Java language to be distributed under the ASF
license. The package shall be available as a pseudo-JDBC driver and via
a DataSource interface. The package shall also support multiple logins
to multiple database systems, reclamation of stale or dead connections,
testing for valid connections, PreparedStatement pooling, and other
features.
%endif
%prep
%setup -q -n %{short_name}-%{version}-src
# quick hack
cp LICENSE.txt ../LICENSE
# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;
bzip2 -dc %{SOURCE5} | tar xf -
cp %{SOURCE6} .
%patch0 -b .sav
# patch only for javac 1.6.0
if [[ "$(javac -version 2>&1 | grep '1\.6\.0')" != "" ]]; then
%patch1 -b .sav1
fi
%patch2 -b .target15
if [ ! -f %{SOURCE4} ]; then
export DEPCAT=$(pwd)/%{base_name}-%{version}-depcat.new.xml
echo '<?xml version="1.0" standalone="yes"?>' > $DEPCAT
echo '<depset>' >> $DEPCAT
for p in $(find . -name project.xml); do
pushd $(dirname $p)
/usr/bin/saxon project.xml %{SOURCE1} >> $DEPCAT
popd
done
echo >> $DEPCAT
echo '</depset>' >> $DEPCAT
/usr/bin/saxon $DEPCAT %{SOURCE2} > %{base_name}-%{version}-depmap.new.xml
fi
%build
%if %{with_maven}
for p in $(find . -name project.xml); do
pushd $(dirname $p)
cp project.xml project.xml.orig
/usr/bin/saxon -o project.xml project.xml.orig %{SOURCE3} map=%{SOURCE4}
popd
done
mkdir -p .maven/repository/JPP/jars
pushd .maven/repository/JPP/jars
ln -sf $(build-classpath jdbc-stdext) jdbc.jar
popd
maven \
-Dmaven.repo.remote=file:/usr/share/maven/repository \
-Dmaven.home.local=$(pwd)/.maven \
jar javadoc xdoc:transform
%else
ant \
-Dcommons-pool.jar=$(build-classpath commons-pool) \
-Djdbc20ext.jar=$(build-classpath jdbc-stdext) \
-Djunit.jar=$(build-classpath junit) \
-Dxerces.jar=$(build-classpath xerces-j2) \
-Dxml-apis.jar=$(build-classpath xml-commons-jaxp-1.3-apis) \
-Dnaming-common.jar=$(build-classpath tomcat6/catalina) \
-Dnaming-java.jar=$(build-classpath tomcat6/catalina) \
-Dlogging.jar=$(build-classpath commons-logging) \
-Djava.io.tmpdir=. \
dist test
%endif
export CLASSPATH=$(build-classpath jdbc-stdext xerces-j2 commons-collections-tomcat5 commons-pool-tomcat5)
ant -f dbcp-tomcat5-build.xml
%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
%if %{with_maven}
install -m 644 target/%{short_name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
%else
install -m 644 dist/%{short_name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
%endif
#tomcat5 jars
install -m 644 dbcp-tomcat5/%{short_name}-tomcat5.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-tomcat5-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|jakarta-||g"`; done)
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
%add_to_maven_depmap commons-dbcp commons-dbcp %{version} JPP %{name}
# pom
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms
install -pm 644 %{SOURCE7} \
$RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP-%{name}.pom
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
%if %{with_maven}
cp -pr target/docs/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
rm -rf target/docs/apidocs
%else
cp -pr dist/docs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
%endif
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%if %{with_maven}
# manual
install -d -m 755 $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr target/docs/* $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%endif
# quick hack clean up
rm ../LICENSE
# hibernate_jdbc_cache ghost symlink
ln -s %{_sysconfdir}/alternatives \
$RPM_BUILD_ROOT%{_javadir}/hibernate_jdbc_cache.jar
%clean
rm -rf $RPM_BUILD_ROOT
%post
update-alternatives --install %{_javadir}/hibernate_jdbc_cache.jar \
hibernate_jdbc_cache %{_javadir}/%{name}.jar 60
%update_maven_depmap
%postun
%update_maven_depmap
%preun
{
[ $1 -eq 0 ] || exit 0
update-alternatives --remove hibernate_jdbc_cache %{_javadir}/%{name}.jar
} >/dev/null 2>&1 || :
%files
%defattr(-,root,root)
%doc LICENSE.txt
%{_javadir}/%{name}.jar
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{short_name}.jar
%{_javadir}/%{short_name}-%{version}.jar
%ghost %{_javadir}/hibernate_jdbc_cache.jar
%{_datadir}/maven2
%{_mavendepmapfragdir}
%files tomcat5
%defattr(-,root,root)
%{_javadir}/*-tomcat5*.jar
%files javadoc
%defattr(-,root,root)
%doc %{_javadocdir}/%{name}-%{version}
%doc %{_javadocdir}/%{name}
%if %{with_maven}
%files manual
%defattr(0644,root,root,0755)
%doc %{_docdir}/%{name}-%{version}
%endif
%changelog
* Thu Nov 06 2008 ro@suse.de
- add buildignore for jakarta-commons-dbcp-tomcat5
(workaround for bs bug)
* Thu Aug 28 2008 mvyskocil@suse.cz
- target=1.5 source=1.5
* Thu Jul 31 2008 mvyskocil@suse.cz
- do not add a java6 compatibility for javac 1.5.0 (fixed build on ia64)
* Tue Jul 29 2008 anosek@suse.cz
- made the symlink jakarta-commons-dbcp -> jakarta-commons-dbcp-1.2.2
part of the javadoc package
* Mon Jul 21 2008 mvyskocil@suse.cz
- merged with jpackage 1.7 spec
- added a tomcat5 subpackage (to fix [bnc#408253])
- added a maven build branch (n/a in suse yet):
- added a poms and project.xmls for maven
- added a depmagfrags for maven
- build againts tomcat6 (instead of tomcat5 as in original jpackage project)
- add a java6 compatibility patch
* Wed Apr 09 2008 mvyskocil@suse.cz
- update to 1.2.2
- remove the java14compat patch
* Mon Sep 25 2006 skh@suse.de
- don't use icecream
- use source="1.4" and target="1.4" for build with java 1.5
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Wed Oct 12 2005 jsmeix@suse.de
- Removed jdbc-stdext from build-classpath because it is
not needed for build.
* Wed Jul 27 2005 jsmeix@suse.de
- Adjustments in the spec file.
* Mon Jul 18 2005 jsmeix@suse.de
- Current version 1.2.1 from JPackage.org
* Fri Sep 03 2004 skh@suse.de
- Initial package created with version 1.2.1 (JPackage 1.5)