1 |
# Copyright (c) 2000-2008, JPackage Project |
2 |
# All rights reserved. |
3 |
# |
4 |
# Redistribution and use in source and binary forms, with or without |
5 |
# modification, are permitted provided that the following conditions |
6 |
# are met: |
7 |
# |
8 |
# 1. Redistributions of source code must retain the above copyright |
9 |
# notice, this list of conditions and the following disclaimer. |
10 |
# 2. Redistributions in binary form must reproduce the above copyright |
11 |
# notice, this list of conditions and the following disclaimer in the |
12 |
# documentation and/or other materials provided with the |
13 |
# distribution. |
14 |
# 3. Neither the name of the JPackage Project nor the names of its |
15 |
# contributors may be used to endorse or promote products derived |
16 |
# from this software without specific prior written permission. |
17 |
# |
18 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 |
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 |
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
21 |
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 |
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 |
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 |
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 |
# |
30 |
|
31 |
%global jspspec 2.2 |
32 |
%global major_version 7 |
33 |
%global minor_version 0 |
34 |
%global micro_version 14 |
35 |
%global packdname apache-tomcat-%{version}-src |
36 |
%global servletspec 3.0 |
37 |
%global elspec 2.2 |
38 |
%global tcuid 91 |
39 |
|
40 |
# FHS 2.3 compliant tree structure - http://www.pathname.com/fhs/2.3/ |
41 |
%global basedir %{_var}/lib/%{name} |
42 |
%global appdir %{basedir}/webapps |
43 |
%global homedir %{_datadir}/%{name} |
44 |
%global bindir %{homedir}/bin |
45 |
%global confdir %{_sysconfdir}/%{name} |
46 |
%global libdir %{_javadir}/%{name} |
47 |
%global logdir %{_var}/log/%{name} |
48 |
%global cachedir %{_var}/cache/%{name} |
49 |
%global tempdir %{cachedir}/temp |
50 |
%global workdir %{cachedir}/work |
51 |
%global _initrddir %{_sysconfdir}/init.d |
52 |
%global _systemddir /lib/systemd/system |
53 |
|
54 |
Name: tomcat |
55 |
Epoch: 0 |
56 |
Version: %{major_version}.%{minor_version}.%{micro_version} |
57 |
Release: %mkrel 3 |
58 |
Summary: Apache Servlet/JSP Engine, RI for Servlet %{servletspec}/JSP %{jspspec} API |
59 |
|
60 |
Group: Development/Java |
61 |
License: ASL 2.0 |
62 |
URL: http://tomcat.apache.org/ |
63 |
Source0: http://www.apache.org/dist/tomcat/tomcat-%{major_version}/v%{version}/src/%{packdname}.tar.gz |
64 |
Source1: %{name}-%{major_version}.%{minor_version}.conf |
65 |
Source2: %{name}-%{major_version}.%{minor_version}.init |
66 |
Source3: %{name}-%{major_version}.%{minor_version}.sysconfig |
67 |
Source4: %{name}-%{major_version}.%{minor_version}.wrapper |
68 |
Source5: %{name}-%{major_version}.%{minor_version}.logrotate |
69 |
Source6: %{name}-%{major_version}.%{minor_version}-digest.script |
70 |
Source7: %{name}-%{major_version}.%{minor_version}-tool-wrapper.script |
71 |
Source8: servlet-api-OSGi-MANIFEST.MF |
72 |
Source9: jsp-api-OSGi-MANIFEST.MF |
73 |
Source10: %{name}-%{major_version}.%{minor_version}-log4j.properties |
74 |
Source11: %{name}-%{major_version}.%{minor_version}.service |
75 |
Patch0: %{name}-%{major_version}.%{minor_version}-bootstrap-MANIFEST.MF.patch |
76 |
Patch1: %{name}-%{major_version}.%{minor_version}-tomcat-users-webapp.patch |
77 |
|
78 |
BuildArch: noarch |
79 |
|
80 |
BuildRequires: ant |
81 |
BuildRequires: ant-nodeps |
82 |
BuildRequires: ecj |
83 |
BuildRequires: findutils |
84 |
BuildRequires: apache-commons-collections |
85 |
BuildRequires: apache-commons-daemon |
86 |
BuildRequires: apache-commons-dbcp |
87 |
BuildRequires: apache-commons-pool |
88 |
BuildRequires: jakarta-taglibs-standard |
89 |
BuildRequires: java-devel >= 0:1.6.0 |
90 |
BuildRequires: jpackage-utils >= 0:1.7.0 |
91 |
BuildRequires: junit |
92 |
BuildRequires: log4j |
93 |
BuildRequires: geronimo-jaxrpc |
94 |
BuildRequires: wsdl4j |
95 |
Requires: apache-commons-daemon |
96 |
Requires: apache-commons-logging |
97 |
Requires: apache-commons-collections |
98 |
Requires: apache-commons-dbcp |
99 |
Requires: apache-commons-pool |
100 |
Requires: java >= 0:1.6.0 |
101 |
Requires: procps |
102 |
Requires: %{name}-lib = %{epoch}:%{version}-%{release} |
103 |
Requires(pre): shadow-utils |
104 |
Requires(post): chkconfig |
105 |
Requires(preun): chkconfig |
106 |
Requires(post): redhat-lsb |
107 |
Requires(preun): redhat-lsb |
108 |
Requires(post): jpackage-utils |
109 |
Requires(postun): jpackage-utils |
110 |
|
111 |
%description |
112 |
Tomcat is the servlet container that is used in the official Reference |
113 |
Implementation for the Java Servlet and JavaServer Pages technologies. |
114 |
The Java Servlet and JavaServer Pages specifications are developed by |
115 |
Sun under the Java Community Process. |
116 |
|
117 |
Tomcat is developed in an open and participatory environment and |
118 |
released under the Apache Software License version 2.0. Tomcat is intended |
119 |
to be a collaboration of the best-of-breed developers from around the world. |
120 |
|
121 |
%package admin-webapps |
122 |
Group: Development/Java |
123 |
Summary: The host-manager and manager web applications for Apache Tomcat |
124 |
Requires: %{name} = %{epoch}:%{version}-%{release} |
125 |
|
126 |
%description admin-webapps |
127 |
The host-manager and manager web applications for Apache Tomcat. |
128 |
|
129 |
%package docs-webapp |
130 |
Group: Applications/Text |
131 |
Summary: The docs web application for Apache Tomcat |
132 |
Requires: %{name} = %{epoch}:%{version}-%{release} |
133 |
|
134 |
%description docs-webapp |
135 |
The docs web application for Apache Tomcat. |
136 |
|
137 |
%package javadoc |
138 |
Group: Development/Java |
139 |
Summary: Javadoc generated documentation for Apache Tomcat |
140 |
Requires: jpackage-utils |
141 |
|
142 |
%description javadoc |
143 |
Javadoc generated documentation for Apache Tomcat. |
144 |
|
145 |
%package jsp-%{jspspec}-api |
146 |
Group: Development/Java |
147 |
Summary: Apache Tomcat JSP API implementation classes |
148 |
Provides: jsp = %{jspspec} |
149 |
Provides: jsp22 |
150 |
Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release} |
151 |
Requires(post): chkconfig |
152 |
Requires(postun): chkconfig |
153 |
|
154 |
%description jsp-%{jspspec}-api |
155 |
Apache Tomcat JSP API implementation classes. |
156 |
|
157 |
|
158 |
%package lib |
159 |
Group: Development/Java |
160 |
Summary: Libraries needed to run the Tomcat Web container |
161 |
Requires: %{name}-jsp-%{jspspec}-api = %{epoch}:%{version}-%{release} |
162 |
Requires: %{name}-servlet-%{servletspec}-api = %{epoch}:%{version}-%{release} |
163 |
Requires: %{name}-el-%{elspec}-api = %{epoch}:%{version}-%{release} |
164 |
Requires: ecj |
165 |
Requires: apache-commons-collections |
166 |
Requires: apache-commons-dbcp |
167 |
Requires: apache-commons-pool |
168 |
Requires(preun): coreutils |
169 |
|
170 |
%description lib |
171 |
Libraries needed to run the Tomcat Web container. |
172 |
|
173 |
%package servlet-%{servletspec}-api |
174 |
Group: Development/Java |
175 |
Summary: Apache Tomcat Servlet API implementation classes |
176 |
Provides: servlet = %{servletspec} |
177 |
Provides: servlet6 |
178 |
Provides: servlet3 |
179 |
Requires(post): chkconfig |
180 |
Requires(postun): chkconfig |
181 |
|
182 |
%description servlet-%{servletspec}-api |
183 |
Apache Tomcat Servlet API implementation classes. |
184 |
|
185 |
%package el-%{elspec}-api |
186 |
Group: Development/Java |
187 |
Summary: Expression Language v1.0 API |
188 |
Provides: el_1_0_api = %{epoch}:%{version}-%{release} |
189 |
Provides: el_api = %{elspec} |
190 |
Requires(post): chkconfig |
191 |
Requires(postun): chkconfig |
192 |
|
193 |
%description el-%{elspec}-api |
194 |
Expression Language 1.0. |
195 |
|
196 |
%package webapps |
197 |
Group: Development/Java |
198 |
Summary: The ROOT and examples web applications for Apache Tomcat |
199 |
Requires: %{name} = %{epoch}:%{version}-%{release} |
200 |
Requires: jakarta-taglibs-standard >= 0:1.1 |
201 |
|
202 |
%description webapps |
203 |
The ROOT and examples web applications for Apache Tomcat. |
204 |
|
205 |
%prep |
206 |
%setup -q -n %{packdname} |
207 |
# remove pre-built binaries and windows files |
208 |
find . -type f \( -name "*.bat" -o -name "*.class" -o -name Thumbs.db -o -name "*.gz" -o \ |
209 |
-name "*.jar" -o -name "*.war" -o -name "*.zip" \) -delete |
210 |
|
211 |
%patch0 -p0 |
212 |
%patch1 -p0 |
213 |
# %patch2 -p0 |
214 |
%{__ln_s} $(build-classpath jakarta-taglibs-core) webapps/examples/WEB-INF/lib/jstl.jar |
215 |
%{__ln_s} $(build-classpath jakarta-taglibs-standard) webapps/examples/WEB-INF/lib/standard.jar |
216 |
|
217 |
%build |
218 |
export OPT_JAR_LIST="xalan-j2-serializer" |
219 |
# we don't care about the tarballs and we're going to replace |
220 |
# tomcat-dbcp.jar with apache-commons-{collections,dbcp,pool}-tomcat5.jar |
221 |
# so just create a dummy file for later removal |
222 |
touch HACK |
223 |
%{__mkdir_p} HACKDIR |
224 |
touch HACKDIR/build.xml |
225 |
# who needs a build.properties file anyway |
226 |
%{ant} -Dbase.path="." \ |
227 |
-Dbuild.compiler="modern" \ |
228 |
-Dcommons-collections.jar="$(build-classpath apache-commons-collections)" \ |
229 |
-Dcommons-daemon.jar="$(build-classpath apache-commons-daemon)" \ |
230 |
-Dcommons-daemon.native.src.tgz="HACK" \ |
231 |
-Djasper-jdt.jar="$(build-classpath ecj)" \ |
232 |
-Djdt.jar="$(build-classpath ecj)" \ |
233 |
-Dtomcat-dbcp.jar="$(build-classpath apache-commons-dbcp)" \ |
234 |
-Dtomcat-native.tar.gz="HACK" \ |
235 |
-Dtomcat-native.dll.win32="HACK" \ |
236 |
-Dtomcat-native.dll.x64="HACK" \ |
237 |
-Dtomcat-native.dll.i64="HACK" \ |
238 |
-Dcommons-daemon.native.win.mgr.exe="HACK" \ |
239 |
-Dnsis.exe="HACK" \ |
240 |
-Djaxrpc-lib.jar="$(build-classpath jaxrpc)" \ |
241 |
-Dwsdl4j-lib.jar="$(build-classpath wsdl4j)" \ |
242 |
-Dcommons-pool.home="HACKDIR" \ |
243 |
-Dcommons-dbcp.home="HACKDIR" \ |
244 |
-Dno.build.dbcp=true \ |
245 |
-Dversion="%{version}" \ |
246 |
-Dversion.build="%{micro_version}" \ |
247 |
deploy dist-prepare dist-source javadoc |
248 |
|
249 |
# remove some jars that we'll replace with symlinks later |
250 |
%{__rm} output/build/bin/commons-daemon.jar \ |
251 |
output/build/lib/ecj.jar |
252 |
# remove the cruft we created |
253 |
%{__rm} output/build/bin/tomcat-native.tar.gz |
254 |
pushd output/dist/src/webapps/docs/appdev/sample/src |
255 |
%{__mkdir_p} ../web/WEB-INF/classes |
256 |
%{javac} -cp ../../../../../../../../output/build/lib/servlet-api.jar -d ../web/WEB-INF/classes mypackage/Hello.java |
257 |
pushd ../web |
258 |
%{jar} cf ../../../../../../../../output/build/webapps/docs/appdev/sample/sample.war * |
259 |
popd |
260 |
popd |
261 |
|
262 |
# inject OSGi manifests |
263 |
mkdir -p META-INF |
264 |
cp -p %{SOURCE8} META-INF/MANIFEST.MF |
265 |
touch META-INF/MANIFEST.MF |
266 |
zip -u output/build/lib/servlet-api.jar META-INF/MANIFEST.MF |
267 |
cp -p %{SOURCE9} META-INF/MANIFEST.MF |
268 |
touch META-INF/MANIFEST.MF |
269 |
zip -u output/build/lib/jsp-api.jar META-INF/MANIFEST.MF |
270 |
|
271 |
%install |
272 |
# build initial path structure |
273 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir} |
274 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sbindir} |
275 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_javadocdir}/%{name} |
276 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_initrddir} |
277 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_systemddir} |
278 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d |
279 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig |
280 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{appdir} |
281 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{bindir} |
282 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir} |
283 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{confdir}/Catalina/localhost |
284 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{libdir} |
285 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{logdir} |
286 |
/bin/touch ${RPM_BUILD_ROOT}%{logdir}/catalina.out |
287 |
/bin/echo "%{name}-%{major_version}.%{minor_version}.%{micro_version} RPM installed" >> ${RPM_BUILD_ROOT}%{logdir}/catalina.out |
288 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{homedir} |
289 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{tempdir} |
290 |
%{__install} -d -m 0775 ${RPM_BUILD_ROOT}%{workdir} |
291 |
|
292 |
# move things into place |
293 |
# First copy supporting libs to tomcat lib |
294 |
pushd output/build |
295 |
%{__cp} -a bin/*.{jar,xml} ${RPM_BUILD_ROOT}%{bindir} |
296 |
%{__cp} %{SOURCE10} conf/log4j.properties |
297 |
%{__cp} -a conf/*.{policy,properties,xml} ${RPM_BUILD_ROOT}%{confdir} |
298 |
%{__cp} -a lib/*.jar ${RPM_BUILD_ROOT}%{libdir} |
299 |
%{__cp} -a webapps/* ${RPM_BUILD_ROOT}%{appdir} |
300 |
popd |
301 |
# javadoc |
302 |
%{__cp} -a output/dist/webapps/docs/api/* ${RPM_BUILD_ROOT}%{_javadocdir}/%{name} |
303 |
|
304 |
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ |
305 |
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ |
306 |
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE1} \ |
307 |
> ${RPM_BUILD_ROOT}%{confdir}/%{name}.conf |
308 |
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ |
309 |
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ |
310 |
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE3} \ |
311 |
> ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name} |
312 |
%{__install} -m 0644 %{SOURCE2} \ |
313 |
${RPM_BUILD_ROOT}%{_initrddir}/%{name} |
314 |
%{__install} -m 0644 %{SOURCE4} \ |
315 |
${RPM_BUILD_ROOT}%{_sbindir}/%{name} |
316 |
%{__install} -m 0644 %{SOURCE11} \ |
317 |
${RPM_BUILD_ROOT}%{_systemddir}/%{name}.service |
318 |
%{__ln_s} %{name} ${RPM_BUILD_ROOT}%{_sbindir}/d%{name} |
319 |
%{__sed} -e "s|\@\@\@TCLOG\@\@\@|%{logdir}|g" %{SOURCE5} \ |
320 |
> ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name} |
321 |
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ |
322 |
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ |
323 |
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE6} \ |
324 |
> ${RPM_BUILD_ROOT}%{_bindir}/%{name}-digest |
325 |
%{__sed} -e "s|\@\@\@TCHOME\@\@\@|%{homedir}|g" \ |
326 |
-e "s|\@\@\@TCTEMP\@\@\@|%{tempdir}|g" \ |
327 |
-e "s|\@\@\@LIBDIR\@\@\@|%{_libdir}|g" %{SOURCE7} \ |
328 |
> ${RPM_BUILD_ROOT}%{_bindir}/%{name}-tool-wrapper |
329 |
# create jsp and servlet API symlinks |
330 |
pushd ${RPM_BUILD_ROOT}%{_javadir} |
331 |
%{__mv} %{name}/jsp-api.jar %{name}-jsp-%{jspspec}-api.jar |
332 |
%{__ln_s} %{name}-jsp-%{jspspec}-api.jar %{name}-jsp-api.jar |
333 |
%{__mv} %{name}/servlet-api.jar %{name}-servlet-%{servletspec}-api.jar |
334 |
%{__ln_s} %{name}-servlet-%{servletspec}-api.jar %{name}-servlet-api.jar |
335 |
%{__mv} %{name}/el-api.jar %{name}-el-%{elspec}-api.jar |
336 |
%{__ln_s} %{name}-el-%{elspec}-api.jar %{name}-el-api.jar |
337 |
popd |
338 |
|
339 |
pushd output/build |
340 |
%{_bindir}/build-jar-repository lib apache-commons-collections \ |
341 |
apache-commons-dbcp apache-commons-pool ecj 2>&1 |
342 |
# need to use -p here with b-j-r otherwise the examples webapp fails to |
343 |
# load with a java.io.IOException |
344 |
%{_bindir}/build-jar-repository -p webapps/examples/WEB-INF/lib \ |
345 |
taglibs-core.jar taglibs-standard.jar 2>&1 |
346 |
popd |
347 |
|
348 |
pushd ${RPM_BUILD_ROOT}%{libdir} |
349 |
# symlink JSP and servlet API jars |
350 |
%{__ln_s} ../%{name}-jsp-%{jspspec}-api.jar . |
351 |
%{__ln_s} ../%{name}-servlet-%{servletspec}-api.jar . |
352 |
%{__ln_s} ../%{name}-el-%{elspec}-api.jar . |
353 |
%{__ln_s} $(build-classpath apache-commons-collections) commons-collections.jar |
354 |
%{__ln_s} $(build-classpath apache-commons-dbcp) commons-dbcp.jar |
355 |
%{__ln_s} $(build-classpath log4j) log4j.jar |
356 |
%{__ln_s} $(build-classpath ecj) jasper-jdt.jar |
357 |
|
358 |
# Link the juli jar here from /usr/share/java/tomcat |
359 |
%{__ln_s} %{bindir}/tomcat-juli.jar . |
360 |
popd |
361 |
|
362 |
# symlink to the FHS locations where we've installed things |
363 |
pushd ${RPM_BUILD_ROOT}%{homedir} |
364 |
%{__ln_s} %{appdir} webapps |
365 |
%{__ln_s} %{confdir} conf |
366 |
%{__ln_s} %{libdir} lib |
367 |
%{__ln_s} %{logdir} logs |
368 |
%{__ln_s} %{tempdir} temp |
369 |
%{__ln_s} %{workdir} work |
370 |
popd |
371 |
|
372 |
# install sample webapp |
373 |
%{__mkdir_p} ${RPM_BUILD_ROOT}%{appdir}/sample |
374 |
pushd ${RPM_BUILD_ROOT}%{appdir}/sample |
375 |
%{jar} xf ${RPM_BUILD_ROOT}%{appdir}/docs/appdev/sample/sample.war |
376 |
popd |
377 |
%{__rm} ${RPM_BUILD_ROOT}%{appdir}/docs/appdev/sample/sample.war |
378 |
|
379 |
|
380 |
# Generate a depmap fragment javax.servlet:servlet-api pointing to |
381 |
# tomcat-servlet-3.0-api for backwards compatibility |
382 |
%add_to_maven_depmap javax.servlet servlet-api %{servletspec} JPP %{name}-servlet-%{servletspec}-api |
383 |
# also provide jetty depmap (originally in jetty package, but it's cleaner to have it here) |
384 |
%add_to_maven_depmap org.mortbay.jetty servlet-api %{servletspec} JPP %{name}-servlet-%{servletspec}-api |
385 |
mv %{buildroot}%{_mavendepmapfragdir}/%{name} %{buildroot}%{_mavendepmapfragdir}/%{name}-servlet-api |
386 |
|
387 |
# Install the maven metadata |
388 |
%{__install} -d -m 0755 ${RPM_BUILD_ROOT}%{_mavenpomdir} |
389 |
pushd output/dist/src/res/maven |
390 |
for pom in *.pom; do |
391 |
# fix-up version in all pom files |
392 |
sed -i 's/@MAVEN.DEPLOY.VERSION@/%{version}/g' $pom |
393 |
done |
394 |
|
395 |
# we won't install dbcp, juli-adapters and juli-extras pom files |
396 |
for pom in tomcat-annotations-api.pom tomcat-catalina.pom tomcat-jasper-el.pom tomcat-jasper.pom \ |
397 |
tomcat-catalina-ha.pom tomcat-el-api.pom; do |
398 |
%{__cp} -a $pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-$pom |
399 |
base=`basename $pom .pom` |
400 |
%add_to_maven_depmap org.apache.tomcat $base %{version} JPP/%{name} $base |
401 |
done |
402 |
|
403 |
# servlet-api jsp-api and el-api are not in tomcat subdir, since they are widely re-used elsewhere |
404 |
for pom in tomcat-jsp-api.pom tomcat-servlet-api.pom tomcat-el-api.pom;do |
405 |
%{__cp} -a $pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP-%{name}-$pom |
406 |
base=`basename $pom .pom` |
407 |
%add_to_maven_depmap org.apache.tomcat $base %{version} JPP %{name}-$base |
408 |
done |
409 |
|
410 |
# two special pom where jar files have different names |
411 |
%{__cp} -a tomcat-tribes.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-catalina-tribes.pom |
412 |
%add_to_maven_depmap org.apache.tomcat tribes %{version} JPP/%{name} catalina-tribes |
413 |
|
414 |
%{__cp} -a tomcat-juli.pom ${RPM_BUILD_ROOT}%{_mavenpomdir}/JPP.%{name}-tomcat-juli.pom |
415 |
%add_to_maven_depmap org.apache.tomcat juli %{version} JPP/%{name} tomcat-juli |
416 |
|
417 |
|
418 |
%pre |
419 |
# add the tomcat user and group |
420 |
%{_sbindir}/groupadd -g %{tcuid} -r tomcat 2>/dev/null || : |
421 |
%{_sbindir}/useradd -c "Apache Tomcat" -u %{tcuid} -g tomcat \ |
422 |
-s /bin/nologin -r -d %{homedir} tomcat 2>/dev/null || : |
423 |
|
424 |
%post |
425 |
# install but don't activate |
426 |
/sbin/chkconfig --add %{name} |
427 |
%update_maven_depmap |
428 |
|
429 |
%post jsp-%{jspspec}-api |
430 |
%{_sbindir}/update-alternatives --install %{_javadir}/jsp.jar jsp \ |
431 |
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar 20100 |
432 |
|
433 |
%post servlet-%{servletspec}-api |
434 |
%{_sbindir}/update-alternatives --install %{_javadir}/servlet.jar servlet \ |
435 |
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar 20500 |
436 |
%update_maven_depmap |
437 |
|
438 |
%post el-%{elspec}-api |
439 |
%{_sbindir}/update-alternatives --install %{_javadir}/elspec.jar elspec \ |
440 |
%{_javadir}/%{name}-el-%{elspec}-api.jar 20250 |
441 |
|
442 |
%preun |
443 |
# clean tempdir and workdir on removal or upgrade |
444 |
%{__rm} -rf %{workdir}/* %{tempdir}/* |
445 |
if [ "$1" = "0" ]; then |
446 |
%{_initrddir}/%{name} stop >/dev/null 2>&1 |
447 |
/sbin/chkconfig --del %{name} |
448 |
fi |
449 |
|
450 |
|
451 |
%postun |
452 |
%update_maven_depmap |
453 |
|
454 |
%postun jsp-%{jspspec}-api |
455 |
if [ "$1" = "0" ]; then |
456 |
%{_sbindir}/update-alternatives --remove jsp \ |
457 |
%{_javadir}/%{name}-jsp-%{jspspec}-api.jar |
458 |
fi |
459 |
|
460 |
%postun servlet-%{servletspec}-api |
461 |
if [ "$1" = "0" ]; then |
462 |
%{_sbindir}/update-alternatives --remove servlet \ |
463 |
%{_javadir}/%{name}-servlet-%{servletspec}-api.jar |
464 |
%update_maven_depmap |
465 |
fi |
466 |
|
467 |
%postun el-%{elspec}-api |
468 |
if [ "$1" = "0" ]; then |
469 |
%{_sbindir}/update-alternatives --remove elspec \ |
470 |
%{_javadir}/%{name}-el-%{elspec}-api.jar |
471 |
fi |
472 |
|
473 |
%files |
474 |
%defattr(0664,root,tomcat,0755) |
475 |
%doc {LICENSE,NOTICE,RELEASE*} |
476 |
%attr(0755,root,root) %{_bindir}/%{name}-digest |
477 |
%attr(0755,root,root) %{_bindir}/%{name}-tool-wrapper |
478 |
%attr(0755,root,root) %{_sbindir}/d%{name} |
479 |
%attr(0755,root,root) %{_sbindir}/%{name} |
480 |
%attr(0755,root,root) %{_initrddir}/%{name} |
481 |
%attr(0644,root,root) %{_systemddir}/%{name}.service |
482 |
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
483 |
%config(noreplace) %{_sysconfdir}/sysconfig/%{name} |
484 |
%attr(0765,root,tomcat) %dir %{basedir} |
485 |
%attr(0755,root,tomcat) %dir %{confdir} |
486 |
%defattr(0664,root,tomcat,0770) |
487 |
%attr(0770,root,tomcat) %dir %{logdir} |
488 |
%attr(0660,tomcat,tomcat) %{logdir}/catalina.out |
489 |
%attr(0770,root,tomcat) %dir %{cachedir} |
490 |
%attr(0770,root,tomcat) %dir %{tempdir} |
491 |
%attr(0770,root,tomcat) %dir %{workdir} |
492 |
%defattr(0664,root,tomcat,0775) |
493 |
%attr(0775,root,tomcat) %dir %{appdir} |
494 |
%attr(0775,root,tomcat) %dir %{confdir}/Catalina |
495 |
%attr(0775,root,tomcat) %dir %{confdir}/Catalina/localhost |
496 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/%{name}.conf |
497 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/*.policy |
498 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/*.properties |
499 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/context.xml |
500 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/server.xml |
501 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/log4j.properties |
502 |
%attr(0660,tomcat,tomcat) %config(noreplace) %{confdir}/tomcat-users.xml |
503 |
%attr(0664,tomcat,tomcat) %config(noreplace) %{confdir}/web.xml |
504 |
%dir %{homedir} |
505 |
%{bindir}/bootstrap.jar |
506 |
%{bindir}/catalina-tasks.xml |
507 |
%{bindir}/tomcat-juli.jar |
508 |
%{libdir}/tomcat-juli.jar |
509 |
%{homedir}/lib |
510 |
%{homedir}/temp |
511 |
%{homedir}/webapps |
512 |
%{homedir}/work |
513 |
%{homedir}/logs |
514 |
%{homedir}/conf |
515 |
%{_mavendepmapfragdir}/%{name} |
516 |
%{_mavenpomdir}/*.pom |
517 |
# Exclude the POMs that are in sub-packages |
518 |
%exclude %{_mavenpomdir}/*api* |
519 |
|
520 |
%files admin-webapps |
521 |
%defattr(0664,root,tomcat,0755) |
522 |
%{appdir}/host-manager |
523 |
%{appdir}/manager |
524 |
|
525 |
%files docs-webapp |
526 |
%defattr(-,root,root,-) |
527 |
%{appdir}/docs |
528 |
|
529 |
%files javadoc |
530 |
%defattr(-,root,root,-) |
531 |
%{_javadocdir}/%{name} |
532 |
|
533 |
%files jsp-%{jspspec}-api |
534 |
%defattr(-,root,root,-) |
535 |
%{_javadir}/%{name}-jsp-%{jspspec}*.jar |
536 |
%{_javadir}/%{name}-jsp-api.jar |
537 |
%{_mavenpomdir}/JPP-%{name}-tomcat-jsp-api.pom |
538 |
|
539 |
%files lib |
540 |
%defattr(-,root,root,-) |
541 |
%{libdir} |
542 |
%exclude %{libdir}/tomcat-juli.jar |
543 |
%exclude %{libdir}/%{name}-el-%{elspec}-api.jar |
544 |
|
545 |
%files servlet-%{servletspec}-api |
546 |
%defattr(-,root,root,-) |
547 |
%doc LICENSE |
548 |
%{_javadir}/%{name}-servlet-%{servletspec}*.jar |
549 |
%{_javadir}/%{name}-servlet-api.jar |
550 |
%{_mavendepmapfragdir}/%{name}-servlet-api |
551 |
%{_mavenpomdir}/JPP-%{name}-tomcat-servlet-api.pom |
552 |
|
553 |
%files el-%{elspec}-api |
554 |
%defattr(-,root,root,-) |
555 |
%doc LICENSE |
556 |
%{_javadir}/%{name}-el-%{elspec}-api.jar |
557 |
%{_javadir}/%{name}-el-api.jar |
558 |
%{libdir}/%{name}-el-%{elspec}-api.jar |
559 |
%{_mavenpomdir}/JPP-%{name}-tomcat-el-api.pom |
560 |
|
561 |
%files webapps |
562 |
%defattr(0644,tomcat,tomcat,0755) |
563 |
%{appdir}/ROOT |
564 |
%{appdir}/examples |
565 |
%{appdir}/sample |
566 |
|