[java-sig-commits] [jetty/f17] Fix web server running example webapp

Stanislav Ochotnicky sochotni at fedoraproject.org
Thu Feb 23 15:36:59 UTC 2012


commit d1e4b3602fff48b8133bd311a922ce7281e21a77
Author: Stanislav Ochotnicky <sochotnicky at redhat.com>
Date:   Thu Feb 23 16:35:47 2012 +0100

    Fix web server running example webapp
    
    - Add systemd unit file and conversion scriptlets

 jetty.spec |   51 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 39 insertions(+), 12 deletions(-)
---
diff --git a/jetty.spec b/jetty.spec
index 53c6883..3a1ebb9 100644
--- a/jetty.spec
+++ b/jetty.spec
@@ -44,7 +44,7 @@
 
 Name:           jetty
 Version:        8.1.0
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        Java Webserver and Servlet Container
 
 Group:          Applications/Internet
@@ -55,6 +55,7 @@ Source1:        djetty.script
 Source2:        jetty.init
 Source3:        jetty.logrotate
 Source4:        %{name}-depmap.xml
+Source5:        %{name}.service
 Patch0:         0001-Remove-javadoc-execution.patch
 Patch1:         0002-Cleaup-distribution-generation.patch
 Patch2:         0003-Disable-test-artifacts.patch
@@ -80,7 +81,8 @@ BuildRequires:  eclipse-platform
 BuildRequires:  jakarta-taglibs-standard
 BuildRequires:  mongo-java-driver >= 2.6.5-4
 BuildRequires:  objectweb-asm
-BuildRequires:       fedora-usermgmt-devel
+BuildRequires:  fedora-usermgmt-devel
+BuildRequires:  systemd-units
 
 # we want javamail not classpathx-javamail
 BuildRequires:  %{_javadir}/javamail/mail.jar
@@ -114,6 +116,8 @@ Requires:       jakarta-taglibs-standard
 Requires:       objectweb-asm
 %{?FE_USERADD_REQ}
 
+Requires(post): systemd-sysv
+
 Provides:       group(%username) = %jtuid
 Provides:       user(%username) = %jtuid
 
@@ -189,6 +193,11 @@ install -dm 755 %{buildroot}%{logdir}
 install -dm 755 %{buildroot}%{rundir}
 install -dm 755 %{buildroot}%{tempdir}
 install -dm 755 %{buildroot}%{appdir}
+install -dm 755 %{buildroot}%{_unitdir}
+
+# systemd unit file
+cp %{SOURCE5} %{buildroot}%{_unitdir}/
+
 # main pkg
 tar xvf jetty-distribution/target/%{name}-distribution-%{version}.%{addver}.tar.gz -C %{buildroot}%{homedir}
 mv %{buildroot}%{homedir}/%{name}-distribution-%{version}.%{addver}/* %{buildroot}%{homedir}/
@@ -252,19 +261,19 @@ install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-project.pom
 %add_maven_depmap JPP.%{name}-project.pom
 
 # recreat tarball structure in lib
-ln -sf $(build-classpath tomcat-servlet-3.0-api)  %{buildroot}%{homedir}/lib
+ln -sf $(build-classpath tomcat-servlet-3.0-api) \
+       %{buildroot}%{homedir}/lib/servlet-api-3.0.jar
 
-ln -sf $(build-classpath objectweb-asm/asm-all) \
-       %{buildroot}%{homedir}/lib/annotations/
+build-jar-repository %{buildroot}%{homedir}/lib/annotations \
+                     objectweb-asm/asm-all geronimo-annotation
 
-ln -sf $(build-classpath javamail/mail) \
-       %{buildroot}%{homedir}/lib/jndi/
+build-jar-repository %{buildroot}%{homedir}/lib/jndi javamail/mail
+
+build-jar-repository %{buildroot}%{homedir}/lib/jsp tomcat-el-2.2-api \
+           taglibs-core taglibs-standard tomcat/jasper-el eclipse-ecj \
+           tomcat/jasper tomcat/tomcat-api tomcat/tomcat-jsp-2.2-api \
+           tomcat/tomcat-juli
 
-for jar in tomcat-el-2.2-api taglibs-core taglibs-standard \
-           tomcat/jasper tomcat/jasper-el eclipse-ecj; do
-    ln -sf $(build-classpath $jar) \
-           %{buildroot}%{homedir}/lib/jsp/
-done
 
 ln -sf $(build-classpath geronimo-jta) \
        %{buildroot}%{homedir}/lib/jta/
@@ -347,6 +356,19 @@ cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}/
 %__fe_groupdel %username &>/dev/null || :
 
 
+%triggerun -- jetty < 8.1.0-3
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply httpd
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save jetty >/dev/null 2>&1 ||:
+
+# If the package is allowed to autostart:
+/bin/systemctl --no-reload enable jetty.service >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del jetty >/dev/null 2>&1 || :
+/bin/systemctl try-restart jetty.service >/dev/null 2>&1 || :
+
 %preun
 if [ $1 = 0 ]; then
     [ -f /var/lock/subsys/%{name} ] && %{_initrddir}/%{name} stop
@@ -373,12 +395,17 @@ fi
 %ghost %dir %attr(755, jetty, jetty) %{rundir}
 %{appdir}
 %{_initrddir}/%{name}
+%{_unitdir}/%{name}.service
 
 %files javadoc
 %doc LICENSE*
 %doc %{_javadocdir}/%{name}
 
 %changelog
+* Thu Feb 23 2012 Stanislav Ochotnicky <sochotnicky at redhat.com> - 8.1.0-3
+- Fix web server running example webapp
+- Add systemd unit file and conversion scriptlets
+
 * Wed Feb 22 2012 Stanislav Ochotnicky <sochotnicky at redhat.com> - 8.1.0-2
 - Fix #794913 - missing user management utils during install
 


More information about the java-sig-commits mailing list