SPECS: apache1.spec - minimize apache restarts using %posttrans - ...

glen glen at pld-linux.org
Tue Aug 16 11:34:42 CEST 2005


Author: glen                         Date: Tue Aug 16 09:34:42 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- minimize apache restarts using %posttrans
- cleanups

---- Files affected:
SPECS:
   apache1.spec (1.105 -> 1.106) 

---- Diffs:

================================================================
Index: SPECS/apache1.spec
diff -u SPECS/apache1.spec:1.105 SPECS/apache1.spec:1.106
--- SPECS/apache1.spec:1.105	Sun Aug 14 11:39:00 2005
+++ SPECS/apache1.spec	Tue Aug 16 11:34:36 2005
@@ -1,6 +1,6 @@
 # $Revision$, $Date$
 # TODO
-# - documentroot and cgi-dir out of /home/services
+# - move DocumentRoot and cgi-dir out of /home/services
 #
 # Conditional build:
 %bcond_with	rewrite_ldap	# enable ldap map support for mod_rewrite (alpha)
@@ -31,7 +31,7 @@
 Summary(zh_CN):	Internet ÉĎÓŚÓĂ×îšăˇşľÄ Web ˇţÎńłĚĐňĄŁ
 Name:		apache1
 Version:	1.3.33
-Release:	7
+Release:	7.9
 License:	Apache Group
 Group:		Networking/Daemons
 Source0:	http://www.apache.org/dist/httpd/apache_%{version}.tar.gz
@@ -89,6 +89,7 @@
 BuildRequires:	mm-devel >= 1.3.0
 %{?with_rewrite_ldap:BuildRequires:	openldap-devel}
 BuildRequires:	rpmbuild(macros) >= 1.228
+BuildRequires:	rpm-build >= 4.4.0
 BuildRequires:	rpm-perlprov
 PreReq:		mm
 PreReq:		perl-base
@@ -126,6 +127,8 @@
 Obsoletes:	apache < 2.0.0
 Obsoletes:	apache-extra
 Obsoletes:	apache6
+# for the posttrans scriptlet, conflicts because in vserver environment rpm package is not installed.
+Conflicts:	rpm < 4.4.2-0.2
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define		_sysconfdir	/etc/apache
@@ -1403,7 +1406,6 @@
 %groupadd -g 51 -r -f http
 %useradd -u 51 -r -d %{httpdir} -s /bin/false -c "HTTP User" -g http http
 
-# this should be in trigger instead...
 if [ "`getent passwd http | cut -d: -f6`" = "/home/httpd" ]; then
 	/usr/sbin/usermod -d %{httpdir} http
 fi
@@ -1412,7 +1414,6 @@
 /sbin/chkconfig --add apache
 umask 137
 touch /var/log/apache/{access,error,agent,referer}_log
-%service apache restart
 
 %preun
 if [ "$1" = "0" ]; then
@@ -1484,336 +1485,289 @@
 	mv -f /etc/sysconfig/apache{1.rpmsave,}
 fi
 
+%triggerpostun mod_auth_db -- apache-mod_auth_db <= 1.3.20-2
+%{apxs} -e -A -n auth_dbm %{_libexecdir}/mod_auth_dbm.so 1>&2
+
+%triggerpostun mod_autoindex -- apache1-mod_autoindex < 1.3.33-1.85
+%{apxs} -e -A -n autoindex %{_libexecdir}/mod_autoindex.so 1>&2
+sed -i -e '
+	s,^Include.*mod_autoindex.conf,Include %{_sysconfdir}/conf.d/*_mod_autoindex.conf,
+' /etc/apache/apache.conf
+
+%triggerpostun mod_proxy -- apache1-mod_proxy < 1.3.33-1.85
+%{apxs} -e -A -n proxy %{_libexecdir}/libproxy.so 1>&2
+sed -i -e '
+	s,^Include.*mod_proxy.conf,Include %{_sysconfdir}/conf.d/*_mod_proxy.conf,
+' /etc/apache/apache.conf
+
+%triggerpostun mod_status -- apache1-mod_status < 1.3.33-1.85
+%{apxs} -e -A -n status %{_libexecdir}/mod_status.so 1>&2
+sed -i -e '
+	s,^Include.*mod_status.conf,Include %{_sysconfdir}/conf.d/*_mod_status.conf,
+' /etc/apache/apache.conf
+
+%triggerpostun mod_vhost_alias -- apache1-mod_vhost_alias < 1.3.33-1.85
+%{apxs} -e -A -n vhost_alias %{_libexecdir}/mod_vhost_alias.so 1>&2
+sed -i -e '
+	s,^Include.*mod_vhost_alias.conf,Include %{_sysconfdir}/conf.d/*_mod_vhost_alias.conf,
+' /etc/apache/apache.conf
+
+%posttrans
+# minimizing apache restarts logics. we restart webserver:
+#
+# 1. at the end of transaction. (posttrans, feature from rpm 4.4.2)
+# 2. first install of module (post: $1 = 1)
+# 2. uninstall of module (postun: $1 == 0)
+#
+# the strict internal deps between apache modules and
+# main package are very important for all this to work.
+
+# restart webserver at the end of transaction
+%service -q apache restart
+
+# macro called at module post scriptlet
+%define	module_post \
+if [ "$1" = "1" ]; then \
+	%service -q apache restart \
+fi
+
+# macro called at module postun scriptlet
+%define	module_postun \
+if [ "$1" = "0" ]; then \
+	%service -q apache restart \
+fi
+
 %post errordocs
-%service apache restart
+if [ "$1" = "1" ]; then
+	%service -q apache reload
+fi
 
 %postun errordocs
 if [ "$1" = "0" ]; then
-	%service -q apache restart
+	%service -q apache reload
 fi
 
 %post mod_access
-%service apache restart
+%module_post
 
 %postun mod_access
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_actions
-%service apache restart
+%module_post
 
 %postun mod_actions
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_alias
-%service apache restart
+%module_post
 
 %postun mod_alias
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_asis
-%service apache restart
+%module_post
 
 %postun mod_asis
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_auth
-%service apache restart
+%module_post
 
 %postun mod_auth
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_auth_anon
-%service apache restart
+%module_post
 
 %postun mod_auth_anon
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_auth_db
-%service apache restart
+%module_post
 
 %postun mod_auth_db
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
-
-%triggerpostun mod_auth_db -- apache-mod_auth_db <= 1.3.20-2
-%{apxs} -e -A -n auth_dbm %{_libexecdir}/mod_auth_dbm.so 1>&2
+%module_postun
 
 %post mod_auth_digest
-%service apache restart
+%module_post
 
 %postun mod_auth_digest
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_autoindex
-%service apache restart
+%module_post
 
 %postun mod_autoindex
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
-
-%triggerpostun mod_autoindex -- apache1-mod_autoindex < 1.3.33-1.85
-%{apxs} -e -A -n autoindex %{_libexecdir}/mod_autoindex.so 1>&2
-sed -i -e '
-	s,^Include.*mod_autoindex.conf,Include %{_sysconfdir}/conf.d/*_mod_autoindex.conf,
-' /etc/apache/apache.conf
+%module_postun
 
 %post mod_cern_meta
-%service apache restart
+%module_post
 
 %postun mod_cern_meta
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_cgi
-%service apache restart
+%module_post
 
 %postun mod_cgi
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_define
-%service apache restart
+%module_post
 
 %postun mod_define
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_digest
-%service apache restart
+%module_post
 
 %postun mod_digest
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_dir
-%service apache restart
+%module_post
 
 %postun mod_dir
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_env
-%service apache restart
+%module_post
 
 %postun mod_env
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_expires
-%service apache restart
+%module_post
 
 %postun mod_expires
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_headers
-%service apache restart
+%module_post
 
 %postun mod_headers
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_imap
-%service apache restart
+%module_post
 
 %postun mod_imap
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_include
-%service apache restart
+%module_post
 
 %postun mod_include
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_info
-%service apache restart
+%module_post
 
 %postun mod_info
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_log_agent
-%service apache restart
+%module_post
 
 %postun mod_log_agent
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_log_config
-%service apache restart
+%module_post
 
 %postun mod_log_config
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_log_forensic
-%service apache restart
+%module_post
 
 %postun mod_log_forensic
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_log_referer
-%service apache restart
+%module_post
 
 %postun mod_log_referer
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_mime
-%service apache restart
+%module_post
 
 %postun mod_mime
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_mime_magic
-%service apache restart
+%module_post
 
 %postun mod_mime_magic
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_mmap_static
-%service apache restart
+%module_post
 
 %postun mod_mmap_static
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_negotiation
-%service apache restart
+%module_post
 
 %postun mod_negotiation
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_proxy
-%service apache restart
+%module_post
 
 %postun mod_proxy
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
-
-%triggerpostun mod_proxy -- apache1-mod_proxy < 1.3.33-1.85
-%{apxs} -e -A -n proxy %{_libexecdir}/libproxy.so 1>&2
-sed -i -e '
-	s,^Include.*mod_proxy.conf,Include %{_sysconfdir}/conf.d/*_mod_proxy.conf,
-' /etc/apache/apache.conf
+%module_postun
 
 %post mod_rewrite
-%service apache restart
+%module_post
 
 %postun mod_rewrite
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_setenvif
-%service apache restart
+%module_post
 
 %postun mod_setenvif
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_speling
-%service apache restart
+%module_post
 
 %postun mod_speling
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_status
-%service apache restart
+%module_post
 
 %postun mod_status
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
-
-%triggerpostun mod_status -- apache1-mod_status < 1.3.33-1.85
-%{apxs} -e -A -n status %{_libexecdir}/mod_status.so 1>&2
-sed -i -e '
-	s,^Include.*mod_status.conf,Include %{_sysconfdir}/conf.d/*_mod_status.conf,
-' /etc/apache/apache.conf
+%module_postun
 
 %post mod_unique_id
-%service apache restart
+%module_post
 
 %postun mod_unique_id
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_userdir
-%service apache restart
+%module_post
 
 %postun mod_userdir
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_usertrack
-%service apache restart
+%module_post
 
 %postun mod_usertrack
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
+%module_postun
 
 %post mod_vhost_alias
-%service apache restart
+%module_post
 
 %postun mod_vhost_alias
-if [ "$1" = "0" ]; then
-	%service -q apache restart
-fi
-
-%triggerpostun mod_vhost_alias -- apache1-mod_vhost_alias < 1.3.33-1.85
-%{apxs} -e -A -n vhost_alias %{_libexecdir}/mod_vhost_alias.so 1>&2
-sed -i -e '
-	s,^Include.*mod_vhost_alias.conf,Include %{_sysconfdir}/conf.d/*_mod_vhost_alias.conf,
-' /etc/apache/apache.conf
+%module_postun
 
 %files
 %defattr(644,root,root,755)
@@ -2395,6 +2349,10 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.106  2005/08/16 09:34:36  glen
+- minimize apache restarts using %posttrans
+- cleanups
+
 Revision 1.105  2005/08/14 09:39:00  glen
 - rel 7, STBR
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/apache1.spec?r1=1.105&r2=1.106&f=u




More information about the pld-cvs-commit mailing list