File tomcat6.spec of Package tomcat6
#
# spec file for package tomcat6 (Version MACRO)
#
# 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/
#
%define section free
%define jspspec 2.1
%define major_version 6
%define minor_version 0
%define macro_version 18
%define packdname apache-tomcat-%{version}-src
%define servletspec 2.5
%define tcuid 91
# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/
%define appdir /srv/%{name}/webapps
%define bindir %{_datadir}/%{name}/bin
%define confdir %{_sysconfdir}/%{name}
%define homedir %{_datadir}/%{name}
%define libdir %{_javadir}/%{name}
%define logdir %{_localstatedir}/log/%{name}
%define tempdir %{_localstatedir}/cache/%{name}/temp
%define workdir %{_localstatedir}/cache/%{name}
Name: tomcat6
Version: %{major_version}.%{minor_version}.%{macro_version}
Release: 14
Summary: Apache Servlet/JSP Engine, RI for Servlet 2.5/JSP 2.1 API
Group: Productivity/Networking/Web/Servers
License: The Apache Software License
Url: http://tomcat.apache.org
Source0: http://www.apache.org/dist/tomcat/tomcat-6/v%{version}/src/%{packdname}.tar.bz2
Source1: %{name}-%{major_version}.%{minor_version}.conf
Source2: %{name}-%{major_version}.%{minor_version}.init
Source3: %{name}-%{major_version}.%{minor_version}.sysconfig
Source4: %{name}-%{major_version}.%{minor_version}.wrapper
Patch0: %{name}-%{major_version}.%{minor_version}.bootstrap-MANIFEST.MF.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: ant
BuildRequires: ant-trax
BuildRequires: ecj >= 3.2.2
BuildRequires: findutils
BuildRequires: jakarta-commons-collections
BuildRequires: jakarta-commons-daemon
BuildRequires: java-devel >= 1.5.0
BuildRequires: jpackage-utils >= 1.7.0
BuildRequires: junit
BuildRequires: sed
%if %defined suse_version
BuildRequires: unzip
BuildRequires: jakarta-taglibs-standard >= 1.1
BuildRequires: fdupes
PreReq: %fillup_prereq
PreReq: jpackage-utils
Recommends: libtcnative-1-0
%endif
Requires(pre): %{_sbindir}/groupadd
Requires(pre): %{_sbindir}/useradd
Requires: jakarta-commons-daemon
Requires: jakarta-commons-logging
Requires: %{name}-lib = %{version}-%{release}
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
%description
Tomcat is the servlet container that is used in the official Reference
Implementation for the Java Servlet and JavaServer Pages technologies.
The Java Servlet and JavaServer Pages specifications are developed by
Sun under the Java Community Process.
Tomcat is developed in an open and participatory environment and
released under the Apache Software License version 2.0. Tomcat is
intended to be a collaboration of the best-of-breed developers from
around the world.
%package admin-webapps
License: The Apache Software License
Group: Productivity/Networking/Web/Servers
Summary: The host-manager and manager web applications for Apache Tomcat
Requires: %{name} = %{version}-%{release}
%description admin-webapps
The host-manager and manager web applications for Apache Tomcat
%package docs-webapp
License: The Apache Software License
Group: Productivity/Networking/Web/Servers
Summary: The docs web application for Apache Tomcat
Requires: %{name} = %{version}-%{release}
%description docs-webapp
The docs web application for Apache Tomcat
%package javadoc
License: The Apache Software License
Group: Productivity/Networking/Web/Servers
Summary: Javadoc generated documentation for Apache Tomcat
%description javadoc
Javadoc generated documentation for Apache Tomcat
%package jsp-2_1-api
License: The Apache Software License
Group: Productivity/Networking/Web/Servers
Summary: Apache Tomcat JSP API implementation classes
Provides: %{name}-jsp-2.1-api
Requires: %{name}-servlet-2_5-api = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description jsp-2_1-api
Apache Tomcat JSP API implementation classes
%package lib
License: The Apache Software License
Group: Productivity/Networking/Web/Servers
Summary: Libraries needed to run the Tomcat Web container
Requires: %{name}-jsp-2_1-api = %{version}-%{release}
Requires: %{name}-servlet-2_5-api = %{version}-%{release}
Requires(post): ecj >= 3.2.2
Requires(post): jakarta-commons-collections-tomcat5
Requires(post): jakarta-commons-dbcp-tomcat5
Requires(post): jakarta-commons-pool-tomcat5
Requires(preun): %{__rm}
%description lib
Libraries needed to run the Tomcat Web container
%package servlet-2_5-api
License: The Apache Software License
Group: Productivity/Networking/Web/Servers
Summary: Apache Tomcat Servlet API implementation classes
Provides: %{name}-servlet-2.5-api
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description servlet-2_5-api
Apache Tomcat Servlet API implementation classes
%package webapps
License: The Apache Software License
Group: Productivity/Networking/Web/Servers
Summary: The ROOT and examples web applications for Apache Tomcat
Requires: %{name} = %{version}-%{release}
Requires(post): jakarta-taglibs-standard >= 1.1
%description webapps
The ROOT and examples web applications for Apache Tomcat
%prep
%{__rm} -rf ${RPM_BUILD_DIR}/%{name}-%{version}
%setup -q -c -T -a 0
%patch0
%build
pushd ${RPM_BUILD_DIR}/%{name}-%{version}/%{packdname}
# remove pre-built binaries and windows files
find . \( -name "*.bat" -o -name "*.class" -o -name "*.gz" -o \
-name "*.jar" -o -name "*.zip" \) | xargs -t %{__rm} -f
# we don't care about the tarballs and we're going to replace
# tomcat-dbcp.jar with jakarta-commons-{collections,dbcp,pool}-tomcat5.jar
# so just create a dummy file for later removal
touch HACK
%if %defined suse_version
export CLASSPATH="$(build-classpath xalan-j2-serializer)"
export ANT_OPTS=-Xmx500M
%endif
# who needs a build.properties file anyway
ant -Dbase.path="${RPM_BUILD_DIR}/%{name}-%{version}/%{packdname}" \
-Dbuild.compiler="modern" \
-Dcommons-collections.jar="$(build-classpath commons-collections)" \
-Dcommons-daemon.jar="$(build-classpath commons-daemon)" \
-Dcommons-daemon.jsvc.tar.gz="HACK" \
-Djasper-jdt.jar="$(build-classpath ecj)" \
-Djdt.jar="$(build-classpath ecj)" \
-Dtomcat-dbcp.jar="HACK" \
-Dtomcat-native.tar.gz="HACK" \
-Dversion="%{version}" \
-Dversion.build="%{macro_version}"
# javadoc generation
ant -f dist.xml dist-prepare
ant -f dist.xml dist-source
ant -f dist.xml dist-javadoc
# remove some jars that we'll replace with symlinks later
%{__rm} output/build/bin/commons-daemon.jar \
output/build/lib/ecj.jar
# remove the cruft we created
%{__rm} output/build/bin/HACK \
output/build/bin/tomcat-native.tar.gz \
output/build/lib/HACK
popd
%install
%if %defined suse_version
export NO_BRP_CHECK_BYTECODE_VERSION=true
%endif
%{__rm} -rf $RPM_BUILD_ROOT
# build initial path structure
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_javadocdir}/%{name}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/init.d
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{appdir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{bindir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{confdir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{libdir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{logdir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{homedir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{tempdir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{workdir}
# move things into place
pushd ${RPM_BUILD_DIR}/%{name}-%{version}/%{packdname}/output/build
%{__mv} bin/*.{jar,xml} ${RPM_BUILD_ROOT}%{bindir}
%{__mv} conf/*.{policy,properties,xml} ${RPM_BUILD_ROOT}%{confdir}
%{__mv} lib/*.jar ${RPM_BUILD_ROOT}%{libdir}
%{__mv} webapps/* ${RPM_BUILD_ROOT}%{appdir}
popd
# javadoc
pushd ${RPM_BUILD_DIR}/%{name}-%{version}/%{packdname}/output/dist/webapps
%{__mv} docs/api/* ${RPM_BUILD_ROOT}%{_javadocdir}/%{name}
popd
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" %{SOURCE1} \
%if %defined suse_version
-e "s|\@\@\@JAVAHOME\@\@\@|/etc/alternatives/jre|g" \
%endif
> ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf
%if %defined suse_version
mkdir -p ${RPM_BUILD_ROOT}/var/adm/fillup-templates
cp %{SOURCE3} ${RPM_BUILD_ROOT}/var/adm/fillup-templates/sysconfig.%{name}
%else
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" %{SOURCE3} \
> ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}
%endif
%{__install} -m 0644 %{SOURCE2} \
${RPM_BUILD_ROOT}%{_sysconfdir}/init.d/%{name}
%{__install} -m 0644 %{SOURCE4} \
${RPM_BUILD_ROOT}%{_bindir}/d%{name}
# create jsp and servlet API symlinks
pushd ${RPM_BUILD_ROOT}%{_javadir}
%{__mv} %{name}/jsp-api.jar %{name}-jsp-%{jspspec}-api-%{version}.jar
%{__mv} %{name}/servlet-api.jar \
%{name}-servlet-%{servletspec}-api-%{version}.jar
%{__ln_s} %{name}-jsp-%{jspspec}-api-%{version}.jar \
%{name}-jsp-%{jspspec}-api.jar
%{__ln_s} %{name}-servlet-%{servletspec}-api-%{version}.jar \
%{name}-servlet-%{servletspec}-api.jar
popd
pushd ${RPM_BUILD_ROOT}%{libdir}
# fix up jars to include version number
for i in *.jar; do
j="$(echo $i | %{__sed} -e 's,\.jar$,,')"
%{__mv} ${j}.jar ${j}-%{version}.jar
%{__ln_s} ${j}-%{version}.jar ${j}.jar
done
# symlink JSP and servlet API jars
%{__ln_s} ../%{name}-jsp-%{jspspec}-api-%{version}.jar .
%{__ln_s} ../%{name}-servlet-%{servletspec}-api-%{version}.jar .
popd
pushd ${RPM_BUILD_ROOT}%{bindir}
# fix up jars to include version number
for i in *.jar; do
j="$(echo $i | %{__sed} -e 's,\.jar$,,')"
%{__mv} ${j}.jar ${j}-%{version}.jar
%{__ln_s} ${j}-%{version}.jar ${j}.jar
done
popd
# symlink to the FHS locations where we've installed things
pushd ${RPM_BUILD_ROOT}%{homedir}
%{__ln_s} %{appdir} webapps
%{__ln_s} %{confdir} conf
%{__ln_s} %{libdir} lib
%{__ln_s} %{logdir} logs
%{__ln_s} %{tempdir} temp
%{__ln_s} %{workdir} work
popd
%if %defined suse_version
%fdupes $RPM_BUILD_ROOT /srv/%{name}
install -d -m 755 $RPM_BUILD_ROOT/%{_sbindir}
ln -sf %{_sysconfdir}/init.d/%{name} $RPM_BUILD_ROOT/%{_sbindir}/rc%{name}
%endif
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%pre
# add the tomcat user and group
%if %defined suse_version
%{_sbindir}/groupadd -r tomcat 2>/dev/null || :
%{_sbindir}/useradd -c "Apache Tomcat" -g tomcat \
-s /bin/sh -r -d %{homedir} tomcat 2>/dev/null || :
%else
%{_sbindir}/groupadd -g %{tcuid} -r tomcat 2>/dev/null || :
%{_sbindir}/useradd -c "Apache Tomcat" -u %{tcuid} -g tomcat \
-s /bin/sh -r -d %{homedir} tomcat 2>/dev/null || :
%endif
%post
%if %defined suse_version
%{fillup_only}
%else
# install but don't activate
/sbin/chkconfig --add %{name}
%endif
%post jsp-2_1-api
%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar 20100
%post lib
# HACK! The commons-dbcp-tomcat5 needs the tomcat6-lib to build, but tomcat6
# needs this only as post/un dependency to create a symlink, not for build of
# itself. This is mainly for succesfully build, in the production case it
# should not happen!
build-jar-repository %{libdir} \
commons-collections-tomcat5 \
commons-dbcp-tomcat5 \
commons-pool-tomcat5 \
ecj 2>&1 || exit 0
%post servlet-2_5-api
%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar 20500
%post webapps
build-jar-repository %{appdir}/examples/WEB-INF/lib \
taglibs-core.jar taglibs-standard.jar 2>&1
%preun
# clean tempdir and workdir on removal or upgrade
## % {__rm} -fr %{workdir}/* # %{tempdir}/*
%if %defined suse_version
%stop_on_removal %{name}
%else
if [ "$1" = "0" ]; then
[ -f /var/lock/subsys/%{name} ] && %{_sysconfdir}/init.d/%{name} stop
[ -f %{_sysconfdir}/init.d/%{name} ] && /sbin/chkconfig --del %{name}
fi
%endif
%preun lib
if [ "$1" = "0" ]; then
%{__rm} -f \
%{libdir}/\[commons-collections-tomcat5\].jar \
%{libdir}/\[commons-dbcp-tomcat5\].jar \
%{libdir}/\[commons-pool-tomcat5\].jar \
%{libdir}/\[ecj\].jar >/dev/null 2>&1
fi
%if %defined suse_version
%postun
%restart_on_update %{name}
%insserv_cleanup
%endif
%postun jsp-2_1-api
if [ "$1" = "0" ]; then
%{_sbindir}/update-alternatives --remove jsp \
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar
fi
%postun servlet-2_5-api
if [ "$1" = "0" ]; then
%{_sbindir}/update-alternatives --remove servlet \
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar
fi
%files
%defattr(0644,root,root,0755)
%doc %{packdname}/{LICENSE,NOTICE,RELEASE*}
%attr(755,root,root) %{_bindir}/d%{name}
%attr(0770,root,tomcat) %dir %{_localstatedir}/log/%{name}
%attr(755,root,root) %{_sysconfdir}/init.d/%{name}
%if %defined suse_version
%{_var}/adm/fillup-templates/*
%else
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%endif
%attr(0775,root,tomcat) %dir %{appdir}
%dir %{confdir}
%config(noreplace) %{confdir}/%{name}.conf
%config(noreplace) %{confdir}/*.policy
%config(noreplace) %{confdir}/*.properties
%config(noreplace) %{confdir}/context.xml
%config(noreplace) %{confdir}/server.xml
%attr(660,root,tomcat) %config(noreplace) %{confdir}/tomcat-users.xml
%config(noreplace) %{confdir}/web.xml
%attr(0775,root,tomcat) %dir %{tempdir}
%attr(0775,root,tomcat) %dir %{workdir}
%{homedir}
%dir /srv/%{name}
%{_sbindir}/rc%{name}
%files admin-webapps
%defattr(0644,root,root,0755)
%{appdir}/host-manager
%{appdir}/manager
%files docs-webapp
%defattr(0644,root,root,0755)
%{appdir}/docs
%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}
%files jsp-2_1-api
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-jsp*.jar
%files lib
%defattr(0644,root,root,0755)
%{libdir}
%files servlet-2_5-api
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-servlet*.jar
%files webapps
%defattr(0644,root,root,0755)
%{appdir}/ROOT
%{appdir}/examples
%changelog
* Mon Nov 24 2008 mvyskocil@suse.cz
- Fixed bnc#446598 - Tomcat6: tomcat6.conf overwrites sysconfig/tomcat6 values
* Fri Sep 12 2008 mvyskocil@suse.cz
- Update to 6.0.18. This obsoletes patches:
apache-tomcat-CVE-2008-1232
apache-tomcat-CVE-2008-1947
apache-tomcat-CVE-2008-2370
apache-tomcat-CVE-2008-2938
* Tue Aug 19 2008 mvyskocil@suse.cz
- fix CVE-2008-2938: VUL-0: tomcat5: directory traversal
* Wed Aug 06 2008 mvyskocil@suse.cz
- fix CVE-2008-1232 and CVE-2008-2370: VUL-0: Apache Tomcat Cross-Site
Scripting and Security Bypass [bnc#414657]
* Mon Jul 21 2008 mvyskocil@suse.cz
- fixed [bnc#394503]: tomcat6 is missing rctomcat6 link
- add a /usr/sbin/rctomcat6 symlink
- and heavy rewrite and improve of original jpackage tomcat6 init script
- add Should-Start and Should-Stop section and values for Default-Start and
Default-Stop
- removed the echo_success and echo_failure functions and usage
- include a /etc/rc.status and use a rc_XXXXX functions instead of echo and
return. Plus add a comments with error codes explanations
- merge the start/stop/status messages from previous version
- use `ps' command instead of pgrep
- changes in commands: added a try-restart|force-reload|reload|probe and
removed the version|conrestart
- fixed [bnc#394499]: add a PreReq to jpackage-utils
- fixed [bnc#408253]: tomcat6 fails because if missing commons-xxxx jars
- add a removed dependencies to the jakarta-commons-*-tomcat5 packages
- fixed a proper link creation in post/n scripts
- fixed a build cycle, jakarta-commons-dbcp-tomcat5 needs the tomcat6-lib for
build, but the tomcat6-lib has this package in Requires(post). The
%%post scripplet is non-fatal if the jars cannot be found (but this would
not happens in a production state).
* Fri Jun 27 2008 mvyskocil@suse.cz
- fixed [bnc#396962]: VUL-0: tomcat5: [SECURITY] CVE-2008-1947: Tomcat host-manager XSS vulnerability
- fixed [bnc#403310]: Tomcat startup script uses wrong java.io.tmpdir
- the temp directory is in /var/cache/tomcat6/temp
* Tue May 06 2008 mvyskocil@suse.cz
- fixed a [bnc#383331] - Tomcat cannot compile JSPs
- add a ecj requires for tomcat6-lib
- create a symlink of ecj.jar to tomcat6 libdir
- add a jakarta-taglibs-standard to BuildRequires
- use a fdupes to avoid a file duplication waste in /srv
- replace a %%{_jvmdir}/jre to /etc/alternatives/jre in JAVAHOME in default
tomcat6.conf (this path is architecture independent)
- add a %%stop_on_removal to %%preun, %%restart_on_update and %%insserv_cleanup to
%%postun to fix some rpmlint warnings
- add a $remote_fs dependency to init script
* Wed Feb 27 2008 mvyskocil@suse.cz
- update to 6.0.16
* Fri Jan 25 2008 coolo@suse.de
- don't require the old package names
* Fri Jan 25 2008 ro@suse.de
- don't use dots in package names
* Tue Jan 22 2008 anosek@suse.cz
- don't use macros in package names (the %%package lines)
which does not work with autobuild.
* Thu Dec 20 2007 anosek@suse.cz
- don't use static uid/gid for tomcat user and tomcat group
* Tue Dec 04 2007 anosek@suse.cz
- initial version of tomcat6 package
- based on work by jpackage project