[postgresql-pgpool-II] 3.1 + systemd

Tom Callaway spot at fedoraproject.org
Mon Sep 12 16:31:41 UTC 2011


commit 5899a016e64c25d829bf2e5b3e998398dfe9dc44
Author: Tom "spot" Callaway <tcallawa at redhat.com>
Date:   Mon Sep 12 12:31:28 2011 -0400

    3.1 + systemd

 .gitignore                   |    1 +
 pgpool-3.1-conf.sample.patch |   40 +++++++++++++++++++
 pgpool.service               |   10 +++++
 postgresql-pgpool-II.spec    |   89 ++++++++++++++++++++++++++++--------------
 sources                      |    2 +-
 5 files changed, 111 insertions(+), 31 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9ae6c1e..b2be6cd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 pgpool-II-2.3.1.tar.gz
+/pgpool-II-3.1.tar.gz
diff --git a/pgpool-3.1-conf.sample.patch b/pgpool-3.1-conf.sample.patch
new file mode 100644
index 0000000..990614a
--- /dev/null
+++ b/pgpool-3.1-conf.sample.patch
@@ -0,0 +1,40 @@
+diff -up pgpool-II-3.1/pgpool.conf.sample.orig pgpool-II-3.1/pgpool.conf.sample
+--- pgpool-II-3.1/pgpool.conf.sample.orig	2011-08-25 17:04:43.000000000 -0400
++++ pgpool-II-3.1/pgpool.conf.sample	2011-09-12 10:51:53.136935503 -0400
+@@ -33,8 +33,6 @@ port = 9999
+                                    # (change requires restart)
+ socket_dir = '/tmp'
+                                    # Unix domain socket path
+-                                   # The Debian package defaults to
+-                                   # /var/run/postgresql
+                                    # (change requires restart)
+ 
+ 
+@@ -45,12 +43,16 @@ pcp_port = 9898
+                                    # (change requires restart)
+ pcp_socket_dir = '/tmp'
+                                    # Unix domain socket path for pcp
+-                                   # The Debian package defaults to
+-                                   # /var/run/postgresql
+                                    # (change requires restart)
+ 
+ # - Backend Connection Settings -
+ 
++backend_hostname0 = 'localhost'
++backend_port0 = 5432
++backend_weight0 = 1
++backend_data_directory0 = '/var/lib/pgsql/data'
++backend_flag0 = 'ALLOW_TO_FAILOVER'
++
+ #backend_hostname0 = 'host1'
+                                    # Host name or IP address to connect to for backend 0
+ #backend_port0 = 5432
+@@ -179,7 +181,7 @@ debug_level = 0
+ pid_file_name = '/var/run/pgpool/pgpool.pid'
+                                    # PID file name
+                                    # (change requires restart)
+-logdir = '/tmp'
++logdir = '/var/log/pgpool'
+                                    # Directory of pgPool status file
+                                    # (change requires restart)
+ 
diff --git a/pgpool.service b/pgpool.service
new file mode 100644
index 0000000..01bb6c4
--- /dev/null
+++ b/pgpool.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=PGPool-II Middleware Between PostgreSQL Servers And PostgreSQL Database Clients
+After=syslog.target network.target
+
+[Service]
+EnvironmentFile=-/etc/sysconfig/pgpool
+ExecStart=/usr/bin/pgpool -f /etc/pgpool-II/pgpool.conf $OPTS 
+
+[Install]
+WantedBy=multi-user.target
diff --git a/postgresql-pgpool-II.spec b/postgresql-pgpool-II.spec
index d847d3a..c79ce99 100644
--- a/postgresql-pgpool-II.spec
+++ b/postgresql-pgpool-II.spec
@@ -1,20 +1,23 @@
 %define short_name	pgpool-II
 
-Summary:	Pgpool is a connection pooling/replication server for PostgreSQL
-Name:		postgresql-%{short_name}
-Version:	2.3.1
-Release:	2%{?dist}
-License:	BSD
-Group:		Applications/Databases
-URL:		http://pgpool.projects.PostgreSQL.org
-Source0:	http://pgfoundry.org/frs/download.php/2506/%{short_name}-%{version}.tar.gz
-Source1:        pgpool.init
-Source2:        pgpool.sysconfig
-Patch1:		pgpool.conf.sample.patch
-BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires:	postgresql-devel pam-devel
-
-Obsoletes:	postgresql-pgpool
+Summary:		Pgpool is a connection pooling/replication server for PostgreSQL
+Name:			postgresql-%{short_name}
+Version:		3.1
+Release:		1%{?dist}
+License:		BSD
+Group:			Applications/Databases
+URL:			http://pgpool.projects.PostgreSQL.org
+Source0:		http://pgfoundry.org/frs/download.php/3114/%{short_name}-%{version}.tar.gz
+Source1:        	pgpool.service
+Source2:        	pgpool.sysconfig
+Patch1:			pgpool-3.1-conf.sample.patch
+BuildRequires:		postgresql-devel pam-devel
+BuildRequires:		systemd-units
+Requires(post):		systemd-sysv
+Requires(post):		systemd-units
+Requires(preun):	systemd-units
+Requires(postun):	systemd-units
+Obsoletes:		postgresql-pgpool
 
 %description
 pgpool-II is a inherited project of pgpool (to classify from 
@@ -44,7 +47,7 @@ Development headers and libraries for pgpool-II.
 
 %prep
 %setup -q -n %{short_name}-%{version}
-%patch1 -p0
+%patch1 -p1 -b .samplefix
 
 %build
 %configure --with-pgsql-includedir=%{_includedir}/pgsql --with-pgsql-lib=%{_libdir}/pgsql --disable-static --with-pam --disable-rpath --sysconfdir=%{_sysconfdir}/%{short_name}/
@@ -52,7 +55,6 @@ Development headers and libraries for pgpool-II.
 make %{?_smp_flags}
 
 %install
-rm -rf %{buildroot}
 make %{?_smp_flags} DESTDIR=%{buildroot} install
 install -d %{buildroot}%{_datadir}/%{short_name}
 install -d %{buildroot}%{_sysconfdir}/%{short_name}
@@ -61,62 +63,89 @@ mv %{buildroot}/%{_sysconfdir}/%{short_name}/pgpool.conf.sample %{buildroot}%{_s
 mv %{buildroot}/%{_sysconfdir}/%{short_name}/pool_hba.conf.sample %{buildroot}%{_sysconfdir}/%{short_name}/pool_hba.conf
 mv %{buildroot}/%{_sysconfdir}/%{short_name}/pgpool.conf.sample-master-slave %{buildroot}%{_datadir}/%{short_name}/
 mv %{buildroot}/%{_sysconfdir}/%{short_name}/pgpool.conf.sample-replication %{buildroot}%{_datadir}/%{short_name}/
+mv %{buildroot}/%{_sysconfdir}/%{short_name}/pgpool.conf.sample-stream %{buildroot}%{_datadir}/%{short_name}/
 
-install -d %{buildroot}%{_initrddir}
-install -m 755 %{SOURCE1} %{buildroot}%{_initrddir}/pgpool
+install -d %{buildroot}%{_unitdir}
+install -m 755 %{SOURCE1} %{buildroot}%{_unitdir}/pgpool.service
 install -d %{buildroot}%{_sysconfdir}/sysconfig
 install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/pgpool
 
 # nuke libtool archive and static lib
 rm -f %{buildroot}%{_libdir}/libpcp.{a,la}
 
-%clean
-rm -rf %{buildroot}
-
 %post 
 /sbin/ldconfig
-chkconfig --add pgpool
+if [ $1 -eq 1 ] ; then 
+    # Initial installation 
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun
-if [ $1 = 0 ] ; then
-	/sbin/service pgpool condstop >/dev/null 2>&1
-	chkconfig --del pgpool
+if [ $1 -eq 0 ] ; then
+    # Package removal, not upgrade
+    /bin/systemctl --no-reload disable pgpool.service > /dev/null 2>&1 || :
+    /bin/systemctl stop pgpool.service > /dev/null 2>&1 || :
+fi
+
+%postun 
+/sbin/ldconfig
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+if [ $1 -ge 1 ] ; then
+    # Package upgrade, not uninstall
+    /bin/systemctl try-restart pgpool.service >/dev/null 2>&1 || :
 fi
 
-%postun -p /sbin/ldconfig
+%triggerun -- pgpool < 3.1-1
+# Save the current service runlevel info
+# User must manually run systemd-sysv-convert --apply pgpool
+# to migrate them to systemd targets
+/usr/bin/systemd-sysv-convert --save pgpool >/dev/null 2>&1 ||:
+
+# Run these because the SysV package being removed won't do them
+/sbin/chkconfig --del pgpool >/dev/null 2>&1 || :
+/bin/systemctl try-restart pgpool.service >/dev/null 2>&1 || :
 
 %files
-%defattr(-,root,root,-)
 %doc README README.euc_jp TODO COPYING INSTALL AUTHORS ChangeLog NEWS doc/pgpool-en.html doc/pgpool-ja.html doc/pgpool.css doc/tutorial-en.html doc/tutorial-ja.html
 %{_bindir}/pgpool
 %{_bindir}/pcp_attach_node
 %{_bindir}/pcp_detach_node
 %{_bindir}/pcp_node_count
 %{_bindir}/pcp_node_info
+%{_bindir}/pcp_pool_status
 %{_bindir}/pcp_proc_count
 %{_bindir}/pcp_proc_info
+%{_bindir}/pcp_promote_node
 %{_bindir}/pcp_recovery_node
 %{_bindir}/pcp_stop_pgpool
 %{_bindir}/pcp_systemdb_info
 %{_bindir}/pg_md5
 %{_mandir}/man8/pgpool*
 %dir %{_datadir}/%{short_name}
+%{_datadir}/%{short_name}/insert_lock.sql
 %{_datadir}/%{short_name}/system_db.sql
 %{_datadir}/%{short_name}/pgpool.conf.sample-master-slave  
 %{_datadir}/%{short_name}/pgpool.conf.sample-replication
+%{_datadir}/%{short_name}/pgpool.conf.sample-stream
 %{_libdir}/libpcp.so.*
 %{_datadir}/%{short_name}/pgpool.pam
-%{_initrddir}/pgpool
+%{_unitdir}/pgpool.service
 %attr(764,root,root) %config(noreplace) %{_sysconfdir}/%{short_name}/*.conf
 %config(noreplace) %{_sysconfdir}/sysconfig/pgpool
 
 %files devel
-%defattr(-,root,root,-)
+%{_includedir}/libpcp_ext.h
 %{_includedir}/pcp.h
+%{_includedir}/pool_process_reporting.h
 %{_includedir}/pool_type.h
 %{_libdir}/libpcp.so
 
+
 %changelog
+* Mon Sep 12 2011 Tom Callaway <spot at fedoraproject.org> - 3.1-1
+- update to 3.1
+- convert to systemd
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.3.1-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 
diff --git a/sources b/sources
index 59dbedc..13f1e56 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-032fc94eaa71ed99276234b7a110cdf5  pgpool-II-2.3.1.tar.gz
+dbb591a8aa3c3bd1e689f41a7638b9ee  pgpool-II-3.1.tar.gz


More information about the scm-commits mailing list