tomcat/tomcat.spec

720 lines
26 KiB
RPMSpec
Raw Normal View History

#
# spec file for package tomcat
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2009, JPackage Project
# All rights reserved.
#
# 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 jspspec 2.2
%define servletspec 3.0
%define elspec 2.2
%define major_version 7
%define minor_version 0
%define micro_version 27
%define packdname apache-tomcat-%{version}-src
%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 cachedir %{_localstatedir}/cache/%{name}
%define tempdir %{cachedir}/temp
%define workdir %{cachedir}/work
%define _initrddir %{_sysconfdir}/init.d
%define _systemddir /lib/systemd/system
Name: tomcat
Version: %{major_version}.%{minor_version}.%{micro_version}
Release: 0
Summary: Apache Servlet/JSP Engine, RI for Servlet 3.0/JSP 2.2 API
License: Apache-2.0
Group: Productivity/Networking/Web/Servers
Url: http://tomcat.apache.org
Source0: http://www.apache.org/dist/tomcat/tomcat-%{major_version}/v%{version}/src/%{packdname}.tar.gz
Source1: %{name}-%{major_version}.%{minor_version}.conf
Source2: %{name}-%{major_version}.%{minor_version}.init
# sysconfig removal - bnc#471639
#Source3: %{name}-%{major_version}.%{minor_version}.sysconfig
Source4: %{name}-%{major_version}.%{minor_version}.wrapper
Source5: %{name}-%{major_version}.%{minor_version}.logrotate
Source6: %{name}-%{major_version}.%{minor_version}-digest.script
Source7: %{name}-%{major_version}.%{minor_version}-tool-wrapper.script
Source8: servlet-api-OSGi-MANIFEST.MF
Source9: jsp-api-OSGi-MANIFEST.MF
Source10: %{name}-%{major_version}.%{minor_version}-log4j.properties
Source11: %{name}-%{major_version}.%{minor_version}.service
Source12: el-api-OSGi-MANIFEST.MF
Source13: jasper-el-OSGi-MANIFEST.MF
Source14: jasper-OSGi-MANIFEST.MF
Source15: tomcat-api-OSGi-MANIFEST.MF
Source16: tomcat-juli-OSGi-MANIFEST.MF
Source17: tomcat-7.0-tomcat-sysd
Source18: %{name}-%{major_version}.%{minor_version}-tomcat-jsvc-sysd
Source19: %{name}-%{major_version}.%{minor_version}-jsvc.wrapper
Source20: %{name}-%{major_version}.%{minor_version}-jsvc.service
Source1000: tomcat-rpmlintrc
#PATCH-FIX-UPSTREAM: from jpackage.org package
Patch0: %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch
#PATCH-FIX-UPSTREAM: from jpackage.org package
Patch1: %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch
#PATCH-FIX-OPENSUSE: skip few windows specific parts of build
Patch2: tomcat-7.0.2-property-build.windows.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: ant
BuildRequires: ecj >= 3.2.2
BuildRequires: fdupes
BuildRequires: findutils
BuildRequires: geronimo-jaf-1_0_2-api
BuildRequires: jakarta-commons-collections
BuildRequires: jakarta-commons-daemon
BuildRequires: jakarta-commons-dbcp
BuildRequires: jakarta-commons-pool
BuildRequires: jakarta-taglibs-standard >= 1.1
BuildRequires: java-devel >= 1.6.0
BuildRequires: jpackage-utils >= 1.7.0
BuildRequires: junit
BuildRequires: sed
BuildRequires: unzip
BuildRequires: zip
#BuildRequires: geronimo-j2ee-1_4-apis
BuildRequires: geronimo-jaxrpc-1_1-api
BuildRequires: geronimo-qname-1_1-api
BuildRequires: geronimo-saaj-1_1-api
BuildRequires: log4j
BuildRequires: wsdl4j
%if 0%{?suse_version} > 1140
BuildRequires: systemd
%endif
Recommends: libtcnative-1-0
Recommends: logrotate
Requires(pre): %{_sbindir}/groupadd
Requires(pre): %{_sbindir}/useradd
Requires: %{name}-lib = %{version}-%{release}
Requires: jakarta-commons-daemon
Requires: jakarta-commons-dbcp
Requires: jakarta-commons-logging
Requires: jakarta-commons-pool
%{?systemd_requires}
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
Summary: The host-manager and manager web applications for Apache Tomcat
Group: Productivity/Networking/Web/Servers
Requires: %{name} = %{version}-%{release}
%description admin-webapps
The host-manager and manager web applications for Apache Tomcat.
%package docs-webapp
Summary: The docs web application for Apache Tomcat
Group: Productivity/Networking/Web/Servers
Requires: %{name} = %{version}-%{release}
%description docs-webapp
The docs web application for Apache Tomcat.
%package el-2_2-api
Summary: Expression Language v2.2 API
Group: Development/Libraries/Java
Provides: %{name}-el-%{elspec}-api = %{version}-%{release}
Provides: el_2_2_api = %{version}-%{release}
Provides: el_api = %{elspec}
Requires(preun):%{_sbindir}/update-alternatives
Requires(post): %{_sbindir}/update-alternatives
%description el-2_2-api
Expression Language 2.2.
%package javadoc
Summary: Javadoc generated documentation for Apache Tomcat
Group: Productivity/Networking/Web/Servers
%description javadoc
Javadoc generated documentation for Apache Tomcat.
%package jsp-2_2-api
Summary: Apache Tomcat JSP API implementation classes
Group: Productivity/Networking/Web/Servers
Provides: %{name}-jsp-%{jspspec}-api
Provides: jsp = %{jspspec}
Provides: jsp22
Requires: %{name}-servlet-%{servletspec}-api = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description jsp-2_2-api
Apache Tomcat JSP API implementation classes
%package jsvc
Summary: Apache jsvc wrapper for Apache Tomcat as separate service
Group: Productivity/Networking/Web/Servers
Requires: %{name} = %{version}-%{release}
Requires: apache-commons-daemon-jsvc
%description jsvc
Systemd service and wrapper scripts to start tomcat with jsvc,
which allows tomcat to perform some privileged operations
(e.g. bind to a port < 1024) and then switch identity to a non-privileged user.
%package lib
Summary: Libraries needed to run the Tomcat Web container
Group: Productivity/Networking/Web/Servers
Requires: %{name}-el-%{elspec}-api = %{version}-%{release}
Requires: %{name}-jsp-%{jspspec}-api = %{version}-%{release}
Requires: %{name}-servlet-%{servletspec}-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-3_0-api
Summary: Apache Tomcat Servlet API implementation classes
Group: Productivity/Networking/Web/Servers
Provides: %{name}-servlet-%{servletspec}-api = %{version}-%{release}
Provides: servlet = %{servletspec}
Provides: servlet30
Provides: servlet7
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description servlet-3_0-api
Apache Tomcat Servlet API implementation classes
%package webapps
Summary: The ROOT and examples web applications for Apache Tomcat
Group: Productivity/Networking/Web/Servers
Requires: %{name} = %{version}-%{release}
Requires(post): jakarta-taglibs-standard >= 1.1
%description webapps
The ROOT and examples web applications for Apache Tomcat
%prep
%setup -q -n %{packdname}
# remove pre-built binaries and windows files
find . -type f \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name "*.gz" -o \
-name "*.jar" -o -name "*.war" -o -name "*.zip" \) | xargs -t %{__rm} -f
%patch0 -p1
%patch1 -p1
%patch2 -p1
%build
%{__ln_s} $(build-classpath jakarta-taglibs-core) webapps/examples/WEB-INF/lib/jstl.jar
%{__ln_s} $(build-classpath jakarta-taglibs-standard) webapps/examples/WEB-INF/lib/standard.jar
export CLASSPATH=
export OPT_JAR_LIST="xalan-j2-serializer"
export ANT_OPTS=-Xmx500M
# 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
%{__mkdir_p} HACKDIR
touch HACKDIR/build.xml
%{ant} -Dbase.path="." \
-Dbuild.compiler="modern" \
-Dcommons-collections.jar="$(build-classpath commons-collections)" \
-Dcommons-daemon.jar="$(build-classpath commons-daemon)" \
-Dcommons-daemon.native.src.tgz="HACK" \
-Djasper-jdt.jar="$(build-classpath ecj)" \
-Djdt.jar="$(build-classpath ecj)" \
-Dtomcat-dbcp.jar="HACK" \
-Dtomcat-native.tar.gz="HACK" \
-Dtomcat-native.home="." \
-Dcommons-daemon.native.win.mgr.exe="HACK" \
-Dnsis.exe="HACK" \
-Djaxrpc-lib.jar="$(build-classpath jaxrpc)" \
-Dwsdl4j-lib.jar="$(build-classpath wsdl4j)" \
-Dcommons-pool.home="HACKDIR" \
-Dcommons-dbcp.home="HACKDIR" \
-Dno.build.dbcp=true \
-Dversion="%{version}" \
-Dversion.build="%{micro_version}" \
deploy dist-prepare dist-source 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/tomcat-native.tar.gz
pushd output/dist/src/webapps/docs/appdev/sample/src
%{__mkdir_p} ../web/WEB-INF/classes
%{javac} -cp ../../../../../../../../output/build/lib/servlet-api.jar -d ../web/WEB-INF/classes mypackage/Hello.java
pushd ../web
%{jar} cf ../../../../../../../../output/build/webapps/docs/appdev/sample/sample.war *
popd
popd
# inject OSGi manifests
mkdir -p META-INF
cp -p %{SOURCE8} META-INF/MANIFEST.MF
touch META-INF/MANIFEST.MF
zip -u output/build/lib/servlet-api.jar META-INF/MANIFEST.MF
cp -p %{SOURCE9} META-INF/MANIFEST.MF
touch META-INF/MANIFEST.MF
zip -u output/build/lib/jsp-api.jar META-INF/MANIFEST.MF
cp -p %{SOURCE12} META-INF/MANIFEST.MF
touch META-INF/MANIFEST.MF
zip -u output/build/lib/el-api.jar META-INF/MANIFEST.MF
cp -p %{SOURCE13} META-INF/MANIFEST.MF
touch META-INF/MANIFEST.MF
zip -u output/build/lib/jasper-el.jar META-INF/MANIFEST.MF
cp -p %{SOURCE14} META-INF/MANIFEST.MF
touch META-INF/MANIFEST.MF
zip -u output/build/lib/jasper.jar META-INF/MANIFEST.MF
cp -p %{SOURCE15} META-INF/MANIFEST.MF
touch META-INF/MANIFEST.MF
zip -u output/build/lib/tomcat-api.jar META-INF/MANIFEST.MF
cp -p %{SOURCE16} META-INF/MANIFEST.MF
touch META-INF/MANIFEST.MF
zip -u output/build/bin/tomcat-juli.jar META-INF/MANIFEST.MF
%install
# build initial path structure
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sbindir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_javadocdir}/%{name}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_initrddir}
%if 0%{?suse_version} > 1140
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_systemddir}
%endif
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}
# sysconfig removal
# % {__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 0775 ${RPM_BUILD_ROOT}%{workdir}
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{cachedir}/Catalina/localhost
%if 0%{?suse_version} > 1140
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_unitdir}
%endif
# move things into place
# First copy supporting libs to tomcat lib
pushd output/build
%{__cp} -a bin/*.{jar,xml} ${RPM_BUILD_ROOT}%{bindir}
%{__cp} %{SOURCE10} conf/log4j.properties
%{__cp} -a conf/*.{policy,properties,xml} ${RPM_BUILD_ROOT}%{confdir}
%{__cp} -a lib/*.jar ${RPM_BUILD_ROOT}%{libdir}
%{__cp} -a webapps/* ${RPM_BUILD_ROOT}%{appdir}
popd
# javadoc
%{__cp} -a output/dist/webapps/docs/api/* ${RPM_BUILD_ROOT}%{_javadocdir}/%{name}
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
-e "s|\@\@\@JAVAHOME\@\@\@|/etc/alternatives/jre|g" \
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE1} \
> ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf
# sysconfig removal
# % {__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
# -e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" %{SOURCE3} \
# > ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}
%{__install} -m 0755 %{SOURCE2} \
${RPM_BUILD_ROOT}%{_initrddir}/%{name}
%{__install} -m 0755 %{SOURCE4} \
${RPM_BUILD_ROOT}%{_sbindir}/d%{name}
# % {__ln_s} %{name} ${RPM_BUILD_ROOT}%{_sbindir}/d%{name}
%if 0%{?suse_version} > 1140
%{__install} -m 0644 %{SOURCE11} \
${RPM_BUILD_ROOT}%{_unitdir}/%{name}.service
%{__install} -m 0644 %{SOURCE17} \
${RPM_BUILD_ROOT}%{_sbindir}/%{name}-sysd
%endif
%{__install} -m 0644 %{SOURCE19} \
${RPM_BUILD_ROOT}%{_sbindir}/%{name}-jsvc
%if 0%{?suse_version} > 1140
%{__install} -m 0644 %{SOURCE20} \
${RPM_BUILD_ROOT}%{_unitdir}/%{name}-jsvc.service
%{__install} -m 0644 %{SOURCE18} \
${RPM_BUILD_ROOT}%{_sbindir}/%{name}-jsvc-sysd
%endif
%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \
> ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE6} \
> ${RPM_BUILD_ROOT}%{_bindir}/%{name}-digest
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE7} \
> ${RPM_BUILD_ROOT}%{_bindir}/%{name}-tool-wrapper
# create jsp and servlet and el API symlinks
pushd ${RPM_BUILD_ROOT}%{_javadir}
%{__mv} %{name}/jsp-api.jar %{name}-jsp-%{jspspec}-api.jar
%{__ln_s} %{name}-jsp-%{jspspec}-api.jar %{name}-jsp-api.jar
%{__mv} %{name}/servlet-api.jar %{name}-servlet-%{servletspec}-api.jar
%{__ln_s} %{name}-servlet-%{servletspec}-api.jar %{name}-servlet-api.jar
%{__mv} %{name}/el-api.jar %{name}-el-%{elspec}-api.jar
%{__ln_s} %{name}-el-%{elspec}-api.jar %{name}-el-api.jar
popd
pushd output/build
%{_bindir}/build-jar-repository lib commons-collections \
commons-dbcp commons-pool ecj 2>&1
# need to use -p here with b-j-r otherwise the examples webapp fails to
# load with a java.io.IOException
%{_bindir}/build-jar-repository -p webapps/examples/WEB-INF/lib \
taglibs-core.jar taglibs-standard.jar 2>&1
popd
pushd ${RPM_BUILD_ROOT}%{libdir}
# symlink JSP and servlet and el API jars
%{__ln_s} ../%{name}-jsp-%{jspspec}-api.jar .
%{__ln_s} ../%{name}-servlet-%{servletspec}-api.jar .
%{__ln_s} ../%{name}-el-%{elspec}-api.jar .
%{__ln_s} $(build-classpath commons-collections) commons-collections.jar
%{__ln_s} $(build-classpath commons-dbcp) commons-dbcp.jar
%{__ln_s} $(build-classpath log4j) log4j.jar
%{__ln_s} $(build-classpath ecj) jasper-jdt.jar
# Temporary copy the juli jar here from /usr/share/java/tomcat (for maven depmap)
%{__cp} -a ${RPM_BUILD_ROOT}%{bindir}/tomcat-juli.jar ./
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
# install sample webapp
%{__mkdir_p} ${RPM_BUILD_ROOT}%{appdir}/sample
pushd ${RPM_BUILD_ROOT}%{appdir}/sample
%{jar} xf ${RPM_BUILD_ROOT}%{appdir}/docs/appdev/sample/sample.war
popd
%{__rm} ${RPM_BUILD_ROOT}%{appdir}/docs/appdev/sample/sample.war
# Install the maven metadata
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_mavenpomdir}
pushd output/dist/src/res/maven
for pom in *.pom; do
# fix-up version in all pom files
sed -i 's/@MAVEN.DEPLOY.VERSION@/%{version}/g' $pom
done
# we won't install dbcp, juli-adapters and juli-extras pom files
for libname in annotations-api catalina jasper-el jasper catalina-ha; do
%{__cp} -a %{name}-$libname.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-$libname.pom
%add_maven_depmap JPP.%{name}-$libname.pom %{name}/$libname.jar
done
# servlet-api jsp-api and el-api are not in tomcat subdir, since they are widely re-used elsewhere
%{__cp} -a tomcat-jsp-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-jsp-api.pom
%add_maven_depmap JPP-tomcat-jsp-api.pom tomcat-jsp-api.jar -f "tomcat-jsp-api" -a "javax.servlet.jsp:javax.servlet.jsp-api,javax.servlet:jsp-api"
%{__cp} -a tomcat-el-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-el-api.pom
%add_maven_depmap JPP-tomcat-el-api.pom tomcat-el-api.jar -f "tomcat-el-api" -a "javax.el:javax.el-api,javax.el:el-api"
%{__cp} -a tomcat-servlet-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-tomcat-servlet-api.pom
# Generate a depmap fragment javax.servlet:servlet-api pointing to
# tomcat-servlet-3.0-api for backwards compatibility
# also provide jetty depmap (originally in jetty package, but it's cleaner to have it here
%add_maven_depmap JPP-tomcat-servlet-api.pom tomcat-servlet-api.jar -f "tomcat-servlet-api" -a "javax.servlet:servlet-api,javax.servlet:javax.servlet-api,org.mortbay.jetty:servlet-api"
# two special pom where jar files have different names
%{__cp} -a tomcat-tribes.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-catalina-tribes.pom
%add_maven_depmap JPP.%{name}-catalina-tribes.pom %{name}/catalina-tribes.jar
%{__cp} -a tomcat-juli.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-juli.pom
%add_maven_depmap JPP.%{name}-tomcat-juli.pom %{name}/tomcat-juli.jar
%{__cp} -a tomcat-api.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-api.pom
%add_maven_depmap JPP.%{name}-tomcat-api.pom %{name}/tomcat-api.jar
%{__cp} -a tomcat-util.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-util.pom
%add_maven_depmap JPP.%{name}-tomcat-util.pom %{name}/tomcat-util.jar
# replace temporary copy with link
%{__ln_s} -f %{bindir}/tomcat-juli.jar ${RPM_BUILD_ROOT}%{libdir}/
%if %defined suse_version
# bnc#424675
%{__ln_s} %{cachedir}/Catalina ${RPM_BUILD_ROOT}/%{confdir}
%{__rm} -rf %{buildroot}/%{confdir}/Catalina
%{__ln_s} %{cachedir}/Catalina ${RPM_BUILD_ROOT}/%{confdir}/
# bnc#418664
install -d -m 0755 ${RPM_BUILD_ROOT}/%{_sysconfdir}/ant.d/
echo "%{name}/catalina-ant" > ${RPM_BUILD_ROOT}/%{_sysconfdir}/ant.d/catalina-ant
%fdupes $RPM_BUILD_ROOT /srv/%{name}
install -d -m 755 $RPM_BUILD_ROOT/%{_sbindir}
ln -sf %{_initrddir}/%{name} $RPM_BUILD_ROOT/%{_sbindir}/rc%{name}
#bnc#565901
ln -sf %{_sbindir}/d%{name} %{buildroot}/%{bindir}/catalina.sh
%endif
%clean
%{__rm} -rf $RPM_BUILD_ROOT
%pre
# add the tomcat user and group
%{_sbindir}/groupadd -r tomcat 2>/dev/null || :
%{_sbindir}/useradd -c "Apache Tomcat" -g tomcat \
-s /bin/sh -r -d %{homedir} tomcat 2>/dev/null || :
%if 0%{?suse_version} > 1140
%service_add_pre %{name}.service
%endif
%post
%{fillup_and_insserv -f %{name}}
%if 0%{?suse_version} > 1140
%service_add_post %{name}.service
%endif
%preun
# clean tempdir and cachedir on removal or upgrade
## % {__rm} -rf %{workdir}/* %{tempdir}/*
%stop_on_removal %{name}
%if 0%{?suse_version} > 1140
%service_del_preun %{name}.service
%endif
%postun
%insserv_cleanup
%restart_on_update %{name}
%if 0%{?suse_version} > 1140
%service_del_postun %{name}.service
%endif
%post el-2_2-api
%{_sbindir}/update-alternatives --install %{_javadir}/el_api.jar el_api %{_javadir}/%{name}-el-%{elspec}-api.jar 20300
%{_sbindir}/update-alternatives --install %{_javadir}/el_1_0_api.jar el_1_0_api %{_javadir}/%{name}-el-%{elspec}-api.jar 20300
%preun el-2_2-api
if [ "$1" = "0" ]; then
%{_sbindir}/update-alternatives --remove el_api %{_javadir}/%{name}-el-%{elspec}-api.jar
%{_sbindir}/update-alternatives --remove el_1_0_api %{_javadir}/%{name}-el-%{elspec}-api.jar
fi
%post jsp-2_2-api
%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar 20200
%postun jsp-2_2-api
if [ "$1" = "0" ]; then
%{_sbindir}/update-alternatives --remove jsp \
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar
fi
%post servlet-3_0-api
%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar 30000
%postun servlet-3_0-api
if [ "$1" = "0" ]; then
%{_sbindir}/update-alternatives --remove servlet \
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar
fi
%post lib
# HACK! The commons-dbcp-tomcat5 needs the tomcat-lib to build, but tomcat
# 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
%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
%files
%defattr(0644,root,root,0755)
%doc {LICENSE,NOTICE,RELEASE*}
%attr(0755,root,root) %{_bindir}/%{name}-digest
%attr(0755,root,root) %{_bindir}/%{name}-tool-wrapper
%attr(0755,root,root) %{_sbindir}/d%{name}
# % attr(0755,root,root) %{_sbindir}/%{name}
%if 0%{?suse_version} > 1140
%attr(0644,root,root) %{_unitdir}/%{name}.service
%attr(0755,root,root) %{_sbindir}/%{name}-sysd
%endif
%attr(0755,root,root) %{_initrddir}/%{name}
#bnc#565901
%attr(0755,root,root) %{bindir}/catalina.sh
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
# sysconfig removal
# % config(noreplace) %{_sysconfdir}/sysconfig/%{name}
# bnc#726307
%attr(0775,root,tomcat) %dir %{confdir}
%attr(0775,root,tomcat) %dir %{confdir}/Catalina
# % attr(0775,root,tomcat) %dir %{confdir}/Catalina/localhost
%config(noreplace) %{confdir}/%{name}.conf
%config(noreplace) %{confdir}/*.policy
%config(noreplace) %{confdir}/*.properties
%config(noreplace) %{confdir}/context.xml
%config(noreplace) %{confdir}/server.xml
%config(noreplace) %{confdir}/web.xml
%verify (not user group) %attr(0660,tomcat,tomcat) %config(noreplace) %{confdir}/tomcat-users.xml
%dir %{homedir}
%dir %{bindir}
%{bindir}/bootstrap.jar
%{bindir}/catalina-tasks.xml
%{homedir}/lib
%{homedir}/temp
%{homedir}/webapps
%{homedir}/work
%{homedir}/logs
%{homedir}/conf
%dir /srv/%{name}
%{_sbindir}/rc%{name}
%{confdir}/Catalina
# tomcat group writtable dirs - bnc#625415
%defattr(0664,root,tomcat,0775)
%verify (not user group) %dir %{appdir}
%verify (not user group) %{logdir}
%verify (not user group) %{cachedir}
%files admin-webapps
%defattr(0644,root,root,0755)
%{appdir}/host-manager
%{appdir}/manager
%files docs-webapp
%defattr(0644,root,root,0755)
%doc %{appdir}/docs
%files el-2_2-api
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-el-%{elspec}-api.jar
%{_javadir}/%{name}-el-api.jar
%{libdir}/%{name}-el-%{elspec}-api.jar
%{_mavenpomdir}/JPP-%{name}-el-api.pom
%{_mavendepmapfragdir}/%{name}-tomcat-el-api
%files javadoc
%defattr(0644,root,root,0755)
%doc %{_javadocdir}/%{name}
%files jsp-2_2-api
%defattr(0644,root,root,0755)
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar
%{_javadir}/%{name}-jsp-api.jar
# % ghost %{_javadir}/jsp.jar
%{_mavenpomdir}/JPP-%{name}-jsp-api.pom
%{_mavendepmapfragdir}/%{name}-tomcat-jsp-api
%files lib
%defattr(0644,root,root,0755)
%{libdir}
%dir %{bindir}
%{bindir}/tomcat-juli.jar
%{_mavendepmapfragdir}/%{name}
%{_mavenpomdir}/JPP.%{name}-annotations-api.pom
%{_mavenpomdir}/JPP.%{name}-catalina-ha.pom
%{_mavenpomdir}/JPP.%{name}-catalina-tribes.pom
%{_mavenpomdir}/JPP.%{name}-catalina.pom
%{_mavenpomdir}/JPP.%{name}-jasper-el.pom
%{_mavenpomdir}/JPP.%{name}-jasper.pom
%{_mavenpomdir}/JPP.%{name}-tomcat-api.pom
%{_mavenpomdir}/JPP.%{name}-tomcat-juli.pom
%{_mavenpomdir}/JPP.%{name}-tomcat-util.pom
%exclude %{libdir}/%{name}-el-%{elspec}-api.jar
# bnc#418664
%config(noreplace) %{_sysconfdir}/ant.d
%files servlet-3_0-api
%defattr(0644,root,root,0755)
%doc LICENSE
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar
%{_javadir}/%{name}-servlet-api.jar
# % ghost %{_javadir}/servlet.jar
%{_mavendepmapfragdir}/%{name}-tomcat-servlet-api
%{_mavenpomdir}/JPP-%{name}-servlet-api.pom
%files webapps
%defattr(0644,root,root,0755)
#bnc#520532
%config(noreplace) %{appdir}/ROOT
%{appdir}/examples
%{appdir}/sample
%files jsvc
%defattr(755,root,root,0755)
%{_sbindir}/%{name}-jsvc
%if 0%{?suse_version} > 1140
%{_sbindir}/%{name}-jsvc-sysd
%attr(0644,root,root) %{_unitdir}/%{name}-jsvc.service
%endif
%changelog