SPECS: phpPgAdmin.spec - up to 4.0 - simplified %%install - C&P tr...

twittner twittner at pld-linux.org
Wed Nov 16 20:39:26 CET 2005


Author: twittner                     Date: Wed Nov 16 19:39:26 2005 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- up to 4.0
- simplified %%install
- C&P triggers' scripts from template-apache.spec

---- Files affected:
SPECS:
   phpPgAdmin.spec (1.48 -> 1.49) 

---- Diffs:

================================================================
Index: SPECS/phpPgAdmin.spec
diff -u SPECS/phpPgAdmin.spec:1.48 SPECS/phpPgAdmin.spec:1.49
--- SPECS/phpPgAdmin.spec:1.48	Tue Oct 18 17:49:37 2005
+++ SPECS/phpPgAdmin.spec	Wed Nov 16 20:39:21 2005
@@ -2,14 +2,15 @@
 Summary:	phpPgAdmin - web-based PostgreSQL administration
 Summary(pl):	phpPgAdmin - administracja bazami PostgreSQL przez WWW
 Name:		phpPgAdmin
-Version:	3.5.6
+Version:	4.0	
 Release:	1
 License:	GPL v2+
 Group:		Applications/Databases/Interfaces
 Source0:	http://dl.sourceforge.net/phppgadmin/%{name}-%{version}.tar.bz2
-# Source0-md5:	6492cd318b8213a257571f0443e6c344
-Source1:	%{name}.conf
+# Source0-md5:	9badba12100bd244e697c7448f57ab13
 URL:		http://sourceforge.net/projects/phppgadmin/
+BuildRequires:	rpmbuild(macros) >= 1.226
+Requires(triggerpostun):	sed >= 4.0
 Requires:	php >= 4.1
 Requires:	php-pcre
 Requires:	php-pgsql >= 4.1
@@ -17,8 +18,9 @@
 BuildArch:	noarch
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-%define		_pgadmindir	%{_datadir}/%{name}
-%define		_config_http	/etc/httpd
+%define		_noautoreq	/usr/bin/awk /bin/bash /usr/bin/php
+%define		_appdir		%{_datadir}/%{name}
+%define		_sysconfdir	/etc/%{name}
 
 %description
 phpPgAdmin is a fully functional web-based administration utility for
@@ -33,70 +35,80 @@
 przełączniki, widoki i funkcje (procedury składowane).
 
 %prep
-%setup -q -n phpPgAdmin
+%setup -q
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_pgadmindir}/{classes/{HTML_TreeMenu/images,database},help,images/themes/default,lang/recoded,libraries/adodb/{datadict,drivers},sql,themes/default},/etc/{%{name},httpd/httpd.conf}}
 
-%{__sed} -i 's|error_reporting(E_ALL);|error_reporting(E_ALL \& ~E_NOTICE);|' libraries/lib.inc.php
-
-install *.php *.js *.txt		$RPM_BUILD_ROOT%{_pgadmindir}
-install classes/*.php			$RPM_BUILD_ROOT%{_pgadmindir}/classes
-install classes/HTML_TreeMenu/TreeMenu.* $RPM_BUILD_ROOT%{_pgadmindir}/classes/HTML_TreeMenu
-install classes/HTML_TreeMenu/images/*	$RPM_BUILD_ROOT%{_pgadmindir}/classes/HTML_TreeMenu/images
-install classes/database/*.php		$RPM_BUILD_ROOT%{_pgadmindir}/classes/database
-install images/themes/default/*.png	$RPM_BUILD_ROOT%{_pgadmindir}/images/themes/default
-install lang/*.php			$RPM_BUILD_ROOT%{_pgadmindir}/lang
-install lang/recoded/*.php		$RPM_BUILD_ROOT%{_pgadmindir}/lang/recoded
-install libraries/*.php			$RPM_BUILD_ROOT%{_pgadmindir}/libraries
-install libraries/adodb/*.php		$RPM_BUILD_ROOT%{_pgadmindir}/libraries/adodb
-install libraries/adodb/datadict/*.php	$RPM_BUILD_ROOT%{_pgadmindir}/libraries/adodb/datadict
-install libraries/adodb/drivers/*.php	$RPM_BUILD_ROOT%{_pgadmindir}/libraries/adodb/drivers
-install sql/*.sql			$RPM_BUILD_ROOT%{_pgadmindir}/sql
-install themes/default/*.css		$RPM_BUILD_ROOT%{_pgadmindir}/themes/default
-# DONT MARK IT AS %DOC
-install	help/*.php			$RPM_BUILD_ROOT%{_pgadmindir}/help
-install conf/*				$RPM_BUILD_ROOT/etc/%{name}
-ln -s /etc/%{name}			$RPM_BUILD_ROOT%{_pgadmindir}/conf
+install -d $RPM_BUILD_ROOT{%{_appdir},%{_sysconfdir},%{_config_http}}
 
-install %{SOURCE1} 			$RPM_BUILD_ROOT%{_config_http}/%{name}.conf
-
-%clean
-rm -rf $RPM_BUILD_ROOT
+%{__sed} -i 's|error_reporting(E_ALL);|error_reporting(E_ALL \& ~E_NOTICE);|' libraries/lib.inc.php
 
-%post
-if [ -f /etc/httpd/httpd.conf ] && ! grep -q "^Include.*%{name}.conf" /etc/httpd/httpd.conf; then
-	echo "Include /etc/httpd/%{name}.conf" >> /etc/httpd/httpd.conf
-elif [ -d /etc/httpd/httpd.conf ]; then
-	ln -sf /etc/httpd/%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
+cp -R * $RPM_BUILD_ROOT%{_appdir}
+mv -f $RPM_BUILD_ROOT%{_appdir}/conf/* $RPM_BUILD_ROOT%{_sysconfdir}
+rm -fr $RPM_BUILD_ROOT%{_appdir}/conf
+ln -s %{_sysconfdir} $RPM_BUILD_ROOT%{_appdir}/conf
+
+cat >> $RPM_BUILD_ROOT%{_sysconfdir}/apache-%{name}.conf <<EOF
+# This is sample apache config
+Alias /pgadmin /usr/share/phpPgAdmin
+EOF
+
+%triggerin -- apache1 >= 1.3.33-2
+%apache_config_install -v 1 -c %{_sysconfdir}/apache-%{name}.conf
+
+%triggerun -- apache1 >= 1.3.33-2
+%apache_config_uninstall -v 1
+
+%triggerin -- apache >= 2.0.0
+%apache_config_install -v 2 -c %{_sysconfdir}/apache-%{name}.conf
+
+%triggerun -- apache >= 2.0.0
+%apache_config_uninstall -v 2
+
+%triggerpostun -- %{name} < 1.3.9-1.4
+# migrate from old config location (only apache2, as there was no apache1 support)
+if [ -f /etc/httpd/%{name}.conf.rpmsave ]; then
+	cp -f %{_sysconfdir}/apache-%{name}.conf{,.rpmnew}
+	mv -f /etc/httpd/%{name}.conf.rpmsave %{_sysconfdir}/apache-%{name}.conf
+	if [ -f /var/lock/subsys/httpd ]; then
+		/etc/rc.d/init.d/httpd reload 1>&2
+	fi
 fi
-if [ -f /var/lock/subsys/httpd ]; then
-	/usr/sbin/apachectl restart 1>&2
+
+# nuke very-old config location (this mostly for Ra)
+if [ ! -d /etc/httpd/httpd.conf ]; then
+	sed -i -e "/^Include.*%{name}.conf/d" /etc/httpd/httpd.conf
+	if [ -f /var/lock/subsys/httpd ]; then
+		/etc/rc.d/init.d/httpd reload 1>&2
+	fi
 fi
 
-%preun
-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.*%{name}.conf" /etc/httpd/httpd.conf > \
-			/etc/httpd/httpd.conf.tmp
-		mv -f /etc/httpd/httpd.conf.tmp /etc/httpd/httpd.conf
-		if [ -f /var/lock/subsys/httpd ]; then
-			/usr/sbin/apachectl restart 1>&2
-		fi
+# place new config location, as trigger puts config only on first install, do it here.
+# apache1
+if [ -d /etc/apache/conf.d ]; then
+	ln -sf %{_sysconfdir}/apache-%{name}.conf /etc/apache/conf.d/99_%{name}.conf
+	if [ -f /var/lock/subsys/apache ]; then
+		/etc/rc.d/init.d/apache reload 1>&2
+	fi
+fi
+# apache2
+if [ -d /etc/httpd/httpd.conf ]; then
+	ln -sf %{_sysconfdir}/apache-%{name}.conf /etc/httpd/httpd.conf/99_%{name}.conf
+	if [ -f /var/lock/subsys/httpd ]; then
+		/etc/rc.d/init.d/httpd reload 1>&2
 	fi
 fi
 
+%clean
+rm -rf $RPM_BUILD_ROOT
+
 %files
 %defattr(644,root,root,755)
 %doc CREDITS DEVELOPERS FAQ HISTORY INSTALL TODO TRANSLATORS
-%dir /etc/%{name}
-%attr(640,root,http) %config(noreplace) %verify(not size mtime md5) /etc/%{name}/*
-%config(noreplace) %verify(not size mtime md5) %{_config_http}/%{name}.conf
-%{_pgadmindir}
+%dir %{_sysconfdir} 
+%attr(640,root,http) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/*
+%{_appdir}
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
@@ -104,6 +116,11 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.49  2005/11/16 19:39:21  twittner
+- up to 4.0
+- simplified %%install
+- C&P triggers' scripts from template-apache.spec
+
 Revision 1.48  2005/10/18 15:49:37  qboosh
 - updated md5
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/phpPgAdmin.spec?r1=1.48&r2=1.49&f=u




More information about the pld-cvs-commit mailing list