SPECS: amavis-stats.spec - webapps framework, rel .5

glen glen at pld-linux.org
Fri Mar 24 13:10:33 CET 2006


Author: glen                         Date: Fri Mar 24 12:10:33 2006 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- webapps framework, rel .5

---- Files affected:
SPECS:
   amavis-stats.spec (1.24 -> 1.25) 

---- Diffs:

================================================================
Index: SPECS/amavis-stats.spec
diff -u SPECS/amavis-stats.spec:1.24 SPECS/amavis-stats.spec:1.25
--- SPECS/amavis-stats.spec:1.24	Mon Dec 12 14:44:44 2005
+++ SPECS/amavis-stats.spec	Fri Mar 24 13:10:27 2006
@@ -5,7 +5,7 @@
 Summary(pl):	Prosty generator statystyk dla amavisd-new
 Name:		amavis-stats
 Version:	0.1.13
-Release:	0.%{_rc}.4
+Release:	0.%{_rc}.5
 License:	GPL
 Group:		Applications/System
 Source0:	http://rekudos.net/download/%{name}-%{version}-%{_rc}.tar.gz
@@ -15,12 +15,16 @@
 Patch1:		%{name}-more_ac.patch
 Patch2:		%{name}-Makefile.patch
 URL:		http://rekudos.net/amavis-stats/
-BuildArch:	noarch
+BuildRequires:	rpmbuild(macros) >= 1.268
 Provides:	%{name}-%{version}-%{release}
+BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-%define		_pkglibdir		/var/lib/%{name}
-%define		_phpdir			/usr/share/%{name}
+%define		_pkglibdir	/var/lib/%{name}
+%define		_webapps	/etc/webapps
+%define		_webapp		%{name}
+%define		_webappdir	%{_webapps}/%{_webapp}
+%define		_appdir		%{_datadir}/%{_webapp}
 
 %description
 amavis-stats is a simple amavis statistics generator based on rrdtool.
@@ -37,7 +41,9 @@
 Summary(pl):	Interfejs PHP dla amavis-stats
 Group:		Applications/System
 Requires:	%{name}-%{version}-%{release}
+Requires:	php
 Requires:	php-pcre
+Requires:	webapps
 
 %description php
 PHP interface for amavis-stats.
@@ -69,40 +75,40 @@
 	web_group=$group
 
 install %{SOURCE1} $RPM_BUILD_ROOT/etc/cron.d/amavis-stats
-
-cd $RPM_BUILD_ROOT%{_datadir}/%{name}/
-ln -s amavis-stats.php index.php
-
+ln -s amavis-stats.php $RPM_BUILD_ROOT%{_datadir}/%{name}/index.php
+install -d $RPM_BUILD_ROOT%{_webapps}/%{_webapp}
+mv $RPM_BUILD_ROOT{/etc/amavis-stats/apache.conf,%{_webapps}/%{_webapp}/httpd.conf}
+cp $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/{httpd,apache}.conf
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-%post php
-if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*/etc/%{name}/apache.conf" /etc/httpd/httpd.conf; then
-	echo "Include /etc/%{name}/apache.conf" >> /etc/httpd/httpd.conf
-elif [ -d /etc/httpd/httpd.conf ]; then
-	ln -sf /etc/%{name}/apache.conf /etc/httpd/httpd.conf/99_%{name}.conf
-fi
-if [ -f /var/lock/subsys/httpd ]; then
-	/usr/sbin/apachectl restart 1>&2
+%triggerin php -- apache1
+%webapp_register apache %{_webapp}
+
+%triggerun php -- apache1
+%webapp_unregister apache %{_webapp}
+
+%triggerin php -- apache < 2.2.0, apache-base
+%webapp_register httpd %{_webapp}
+
+%triggerun php -- apache < 2.2.0, apache-base
+%webapp_unregister httpd %{_webapp}
+
+%triggerpostun php -- %{name}-php < 0.1.13-0.rc6.4.1
+if [ -f /etc/httpd/httpd.conf ]; then
+	sed -i -e "/^Include.*%{name}\/apache.conf/d" /etc/httpd/httpd.conf
 fi
 
-%preun php
-if [ "$1" = "0" ]; then
-	umask 027
-	if [ -d /etc/httpd/httpd.conf ]; then
-		rm -f /etc/httpd/httpd.conf/99_%{name}.conf
-	else
-		grep -v "^Include.*/etc/%{name}/apache.conf" /etc/httpd/httpd.conf > \
-			/etc/httpd/httpd.conf.tmp
-		mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
-	fi
-
-	if [ -f /var/lock/subsys/httpd ]; then
-		/usr/sbin/apachectl restart 1>&2
-	fi
+if [ -f /etc/%{name}/apache.conf.rpmsave ]; then
+	cp -f %{_webapps}/%{_webapp}/httpd.conf{,.rpmnew}
+	mv -f /etc/%{name}/apache.conf.rpmsave %{_webapps}/%{_webapp}/httpd.conf
 fi
 
+rm -f /etc/httpd/httpd.conf/99_%{name}.conf
+/usr/sbin/webapp register httpd %{_webapp}
+%service -q httpd reload
+
 %files
 %defattr(644,root,root,755)
 %doc README debian/changelog
@@ -113,13 +119,15 @@
 
 %files php
 %defattr(644,root,root,755)
-%dir %{_sysconfdir}/%{name}
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/apache.conf
-%dir %{_phpdir}
-%dir %attr(755,http,root) %{_phpdir}/img
-%{_phpdir}/%{name}.php
-%{_phpdir}/index.php
-%attr(755,http,http) %dir %{_pkglibdir}/img
+%dir %attr(750,root,http) %{_webapps}/%{_webapp}
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/apache.conf
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_webapps}/%{_webapp}/httpd.conf
+%dir %{_appdir}
+# symlink
+%{_appdir}/img
+%{_appdir}/%{name}.php
+%{_appdir}/index.php
+%attr(775,root,http) %dir %{_pkglibdir}/img
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
@@ -127,6 +135,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.25  2006/03/24 12:10:27  glen
+- webapps framework, rel .5
+
 Revision 1.24  2005/12/12 13:44:44  glen
 - adapterized (sorted %verify attrs)
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/amavis-stats.spec?r1=1.24&r2=1.25&f=u



More information about the pld-cvs-commit mailing list