[packages/pgpool-II] Version: 3.6.0, various improvements

jajcus jajcus at pld-linux.org
Wed Nov 30 13:07:41 CET 2016


commit a1b4546c43eb23bf6ac2d5e50de7246eb0adc796
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Wed Nov 30 11:10:04 2016 +0100

    Version: 3.6.0, various improvements
    
    - libs patch and postgresql-static BR dropped
    - -libs, -devel and -static packages separated
    - docs packaging fixed
    - hardlink identical binaries
    - init script: 'reload' implemented, 'switch' dropped
    - /etc/pool_passwd file added (required for pgpool to start)
    - /var/log/pgpool packaged (status files go there by default)

 pgpool-II-libs.patch | 13 -------
 pgpool-II.spec       | 95 +++++++++++++++++++++++++++++++++++++++++++---------
 pgpool.init          | 30 ++++++-----------
 3 files changed, 89 insertions(+), 49 deletions(-)
---
diff --git a/pgpool-II.spec b/pgpool-II.spec
index 9bf158f..44251d7 100644
--- a/pgpool-II.spec
+++ b/pgpool-II.spec
@@ -1,7 +1,6 @@
 #
 # TODO
 # - logrotate script
-# - libpcp devel subpackage?
 #
 %bcond_without	openssl	# build without SSL support
 %bcond_without	pam	# don't build with pam support
@@ -11,22 +10,20 @@
 Summary:	Pgpool - a connection pooling/replication server for PostgreSQL
 Summary(pl.UTF-8):	Pgpool - serwer puli połączeń i replikacji dla PostgreSQL-a
 Name:		pgpool-II
-Version:	3.4.2
+Version:	3.6.0
 Release:	0.1
 License:	BSD
 Group:		Applications/Databases
 Source0:	http://www.pgpool.net/mediawiki/images/%{name}-%{version}.tar.gz
-# Source0-md5:	a2872b2ff70b2530b324b3bab86d0eb3
+# Source0-md5:	26f0e249067d150f01a9ca02804700eb
 Source1:	%{relname}.init
 Source2:	%{relname}.monitrc
 Source3:	%{relname}.sysconfig
 Source4:	%{relname}.tmpfiles
-Patch0:		%{name}-libs.patch
 URL:		http://www.pgpool.net/
 %{?with_openssl:BuildRequires:	openssl-devel}
 %{?with_pam:BuildRequires:	pam-devel}
 BuildRequires:	postgresql-devel
-BuildRequires:	postgresql-static
 BuildRequires:	sed >= 4.0
 Requires(post,preun):	/sbin/chkconfig
 Requires(postun):	/usr/sbin/groupdel
@@ -35,6 +32,7 @@ Requires(pre):	/bin/id
 Requires(pre):	/usr/bin/getgid
 Requires(pre):	/usr/sbin/groupadd
 Requires(pre):	/usr/sbin/useradd
+Requires:	%{name}-libs = %{version}-%{release}
 %{?with_pam:Requires:	pam}
 Requires:	rc-scripts >= 0.2.0
 Provides:	group(pgpool)
@@ -58,6 +56,41 @@ połaczenie się do pgool tak jakby to był serwer PostgreSQL.
 
 Wsparcie SSL: w%{!?with_openssl:y}łączone
 
+%package libs
+Summary:	%{name} library
+Summary:	Biblioteka %{name}
+Group:		Libraries
+
+%description libs
+Pgpool libraries.
+
+%description libs -l pl.UTF-8
+Biblioteka %{name}.
+
+%package devel
+Summary:	Header files for %{name} library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki %{name}
+Group:		Development/Libraries
+Requires:	%{name}-libs = %{version}-%{release}
+
+%description devel
+Header files for %{name} library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki %{name}.
+
+%package static
+Summary:	Static %{name} library
+Summary(pl.UTF-8):	Statyczna biblioteka %{name}
+Group:		Development/Libraries
+Requires:	%{name}-devel = %{version}-%{release}
+
+%description static
+Static %{name} library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka %{name}.
+
 %package -n monit-rc-pgpool-II
 Summary:	pgpool support for monit
 Summary(pl.UTF-8):	Wsparcie pgpool dla monit
@@ -74,7 +107,6 @@ Plik monitrc do monitorowania pgpool.
 
 %prep
 %setup -q
-%patch0 -p1
 
 %build
 %{__libtoolize}
@@ -98,7 +130,7 @@ export CFLAGS CXXFLAGS
 %install
 rm -rf $RPM_BUILD_ROOT
 
-install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir}/{sysconfig,monit,pam.d},%{_varrun}/pgpool,%{systemdtmpfilesdir}}
+install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir}/{sysconfig,monit,pam.d},%{_varrun}/pgpool,%{systemdtmpfilesdir},%{_mandir}/man{1,8},/var/log/pgpool}
 
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
@@ -106,13 +138,25 @@ install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir}/{sysconfig,monit,pam.
 mv -f $RPM_BUILD_ROOT%{_sysconfdir}/pcp.conf{.sample,}
 mv -f $RPM_BUILD_ROOT%{_sysconfdir}/pgpool.conf{.sample,}
 mv -f $RPM_BUILD_ROOT%{_sysconfdir}/pool_hba.conf{.sample,}
-install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{relname}
-install %{SOURCE2} $RPM_BUILD_ROOT/etc/monit/%{relname}.monitrc
-install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{relname}
-install %{SOURCE4} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{relname}.conf
+cp -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{relname}
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/monit/%{relname}.monitrc
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{relname}
+cp -p %{SOURCE4} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{relname}.conf
 %if %{with pam}
-install src/sample/pgpool.pam $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/pgpool
+cp -p src/sample/pgpool.pam $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/pgpool
 %endif
+cp -p doc/src/sgml/man1/*.1 $RPM_BUILD_ROOT%{_mandir}/man1/
+cp -p doc/src/sgml/man8/*.8 $RPM_BUILD_ROOT%{_mandir}/man8/
+
+touch $RPM_BUILD_ROOT%{_sysconfdir}/pool_passwd
+%{__rm} -f $RPM_BUILD_ROOT%{_sysconfdir}/pgpool.conf.sample*
+
+# hardlink identical binaries
+for n in detach_node node_count node_info pool_status proc_count proc_info promote_node recovery_node stop_pgpool watchdog_info ; do
+	diff -q $RPM_BUILD_ROOT%{_bindir}/pcp_$n $RPM_BUILD_ROOT%{_bindir}/pcp_attach_node
+	%{__rm} $RPM_BUILD_ROOT%{_bindir}/pcp_$n
+	ln $RPM_BUILD_ROOT%{_bindir}/pcp_attach_node $RPM_BUILD_ROOT%{_bindir}/pcp_$n
+done
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -137,26 +181,45 @@ if [ "$1" = "0" ]; then
 	%groupremove pgpool
 fi
 
+%post libs -p /sbin/ldconfig
+
 %files
 %defattr(644,root,root,755)
-%doc AUTHORS COPYING ChangeLog NEWS README TODO doc src/sample src/sql
+%doc AUTHORS COPYING ChangeLog NEWS README TODO doc/src/sgml/html src/sample src/sql
 %attr(755,root,root) %{_bindir}/pcp_*
 %attr(755,root,root) %{_bindir}/pg*
-%attr(755,root,root) %{_libdir}/libpcp.so.*
+%attr(755,root,root) %{_bindir}/watchdog_setup
 %attr(754,root,root) /etc/rc.d/init.d/%{relname}
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pcp.conf
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pgpool.conf
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pool_hba.conf
 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{relname}
+%attr(640,pgpool,pgpool) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/pool_passwd
+%{_mandir}/man1/*.1*
 %{_mandir}/man8/pgpool.8*
 %{_datadir}/%{name}
-%{_includedir}/*
 %dir %attr(775,root,pgpool) %{_varrun}/pgpool
 %{systemdtmpfilesdir}/%{relname}.conf
 %if %{with pam}
 %config(noreplace) %verify(not md5 mtime size) /etc/pam.d/pgpool
 %endif
+%attr(775,root,pgpool) /var/log/pgpool
+
+%files libs
+%defattr(644,root,root,755)
+%ghost %attr(755,root,root) %{_libdir}/libpcp.so.1
+%attr(755,root,root) %{_libdir}/libpcp.so.1.*
+
+%files devel
+%defattr(644,root,root,755)
+%{_includedir}/*
+%attr(755,root,root) %{_libdir}/libpcp.la
+%attr(755,root,root) %{_libdir}/libpcp.so
+
+%files static
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libpcp.a
 
 %files -n monit-rc-pgpool-II
 %defattr(644,root,root,755)
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) /etc/monit/%{relname}.monitrc
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/monit/%{relname}.monitrc
diff --git a/pgpool-II-libs.patch b/pgpool-II-libs.patch
deleted file mode 100644
index 198a2fc..0000000
--- a/pgpool-II-libs.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-libpcp requires symbols which are currently available in static
-libpgcommon library, link it here
-
---- pgpool-II-3.4.2/src/libs/pcp/Makefile.am~	2015-04-08 09:58:44.000000000 +0200
-+++ pgpool-II-3.4.2/src/libs/pcp/Makefile.am	2015-06-18 14:08:24.100554508 +0200
-@@ -1,6 +1,7 @@
- AM_CPPFLAGS = -D_GNU_SOURCE -DPOOL_PRIVATE -I @PGSQL_INCLUDE_DIR@
- 
- lib_LTLIBRARIES = libpcp.la
-+libpcp_la_LIBADD = $(PGSQL_LIB_DIR)/libpgcommon.a 
- libpcp_la_SOURCES = pcp.c \
- 		    pcp_stream.c \
-                     pcp_error.c \
diff --git a/pgpool.init b/pgpool.init
index fa4efcf..829d11b 100644
--- a/pgpool.init
+++ b/pgpool.init
@@ -59,12 +59,15 @@ stop() {
 	if [ -f /var/lock/subsys/pgpool ]; then
 		msg_stopping pgpool
 		busy
-		$PGPOOL_BIN -f $PGPOOLCONF stop >> $PGPOOLLOG 2>&1
+		output=$($PGPOOL_BIN -f "$PGPOOLCONF" stop 2>&1)
 		if [ $? -eq 0 ]; then
 			rm -f /var/run/pgpool/pgpool.pid >/dev/null 2>&1
 			ok
 		else
 			fail
+			echo $output >&2
+			killproc -p /var/run/pgpool/pgpool.pid pgpool >/dev/null
+			rm -f /var/run/pgpool/pgpool.pid >/dev/null 2>&1
 		fi
 		rm -f /var/lock/subsys/pgpool
 	else
@@ -72,14 +75,12 @@ stop() {
 	fi
 }
 
-force-stop() {
-	# Stop daemons (don't wait)
+reload() {
 	if [ -f /var/lock/subsys/pgpool ]; then
-		msg_stopping pgpool
+		msg_reloading pgpool
 		busy
-		$PGPOOL_BIN -m fast stop >> $PGPOOLLOG 2>&1
+		$PGPOOL_BIN -f $PGPOOLCONF reload >> $PGPOOLLOG 2>&1
 		if [ $? -eq 0 ]; then
-			rm -f /var/lock/subsys/pgpool /var/run/pgpool.pid >/dev/null 2>&1
 			ok
 		else
 			fail
@@ -106,22 +107,11 @@ case "$1" in
 	stop
 	start
 	;;
-  switch)
-	if [ -f /var/lock/subsys/pgpool ]; then
-		msg_reloading pgpool
-		pgpool switch >> $PGPOOLLOG 2>&1
-		RETVAL=$?
-	else
-		msg_not_running pgpool
-		RETVAL=7
-	fi
-	;;
-  force-reload)
-	force-stop
-	start
+  reload|force-reload)
+	reload
 	;;
   *)
-	msg_usage "$0 {start|stop|restart|force-reload|switch|status}"
+	msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
 	exit 3
 	;;
 esac
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/pgpool-II.git/commitdiff/eb61ed23e7d323047bfc2aa1fab56e9d695428d7



More information about the pld-cvs-commit mailing list