This commit is contained in:
Sandino Araico Sanchez 2018-02-07 05:38:06 -06:00
commit 178f6ddfd9
6 changed files with 520 additions and 0 deletions

6
dev-db/pgpool2/Manifest Normal file
View file

@ -0,0 +1,6 @@
AUX pgpool-II-3.7.1-libressl.patch 2090 SHA256 d8b505aad048c1efe2b7c0aeb9191ac4f178e9ac42b65296b6a80d00b26f37f3 SHA512 a248456f4c74ff40d79559902229f3d31774f710f652f8c6af96f4055580bd48d47a19ea0bbc211dd570fbe2c137ff7f9b92fa346a50fc8f612c828450ecf9d4 WHIRLPOOL d92c7c240b19bc653f18edea922b28bf0c03a72b96f18b82451d16070ca5cde996994a1dd38cc5d9e2b9cf5dcda50c1a42f0e311000e5d46aa41214a5793bd9c
AUX pgpool2.confd 649 SHA256 542007a1f5fc377ce921316913526fe08a5b6913d533359a3ec3317b0075b60d SHA512 5f9a4fa1e68161049ad767d64c764fbf70e84a4239e58119455a45a7e45d86ea2d19b617147cf891053e0dad4420c84704d67015334c7d41bad05b260d70e910 WHIRLPOOL 0b28a1731bed4a316f33c2c0f8d95567093b6685e43912a2de05802248d3f6a7044bf391efa1f01a320e978f45764b4c7569f0e5aa73be8291abad264d43964c
AUX pgpool2.initd 2174 SHA256 dce3cd0d474719c5cf42be8adf63e9e0856c5de8d08f5741bb0d3155ca803810 SHA512 3123d2c5e7178fc4b970592fe6908df2860ca3cd5ec54d4609c28145ffc934edf6ddb11f9d2208d89d43bc4252e326b3bc0eed36a28fd2fadbaeb2d635935e40 WHIRLPOOL c6795799b370b21f56e472d1ec1d8f5c194dbec881d5a2f3360c1e87dd1ec63b24fca527029f505856006069b82702d1e3beac3f2987a6721b561abbc186622f
AUX pgpool_run_paths-3.6.5.patch 11626 SHA256 4f0a05764970fa7f5652bec12f7d548ae0544466b16f4a3079c1d9e848bc8c17 SHA512 ea718378d0ea14fa48975a899df26bc8aafa1e61b0d3f264ead81031a21d68284f4af5ce065c5534d113faf36724c880ce280665e148ec623e9fea9c8f91c77c WHIRLPOOL 2c96e6e1c43f86ab20804d9a0f8022f9a78f337b87abff826757c7b00ec4b6cce0df13eaf150dd131af78d68951a4dea6bc6c04d948812587fb9ea640d08061d
DIST pgpool-II-3.7.1.tar.gz 3237755 SHA256 142eac8776e81fd208b3379f5a21c4b5a92ddf92ab3a237fa00f14c7c77bc75a SHA512 2a83f573ca2a720ee7beb75d8d1380747e29b2bb3c809f51bd0f8e4423d67f882ce2acb7d9ea118c55313e969aba3bf94a0d5b190eb905123d43c09df25e00ef WHIRLPOOL 78a50c6366329d1c046748cf42d6cf7923b2ae9e944967471d73f4a80e94772ddc1ec60140c29d98130530447f62b9d04d348ff15a0539caf7ed025cfd20c278
EBUILD pgpool2-3.7.1-r1.ebuild 2608 SHA256 b52ae153a51bf2151e7f88422b4dbf5f3fa83333a367db057b0a5c223c1bed29 SHA512 9972dae46db7ea6e9e9626e4049bf227f06409825f237c7405992c098760c1f4f04ccf58a2d243ad4fa53b2bb11df4c917d7a72186811cad7d1bb78b2e9aca4f WHIRLPOOL ee09436c607122953b3b7371f902d2d69d5c12dc4b7b72e85e574e8b3ad91d1e407fe1262611d32d2b57188736883f1815b2f65293660e546ebecc5abb787bce

View file

@ -0,0 +1,45 @@
diff -pura pgpool-II-3.7.1.orig/src/main/main.c pgpool-II-3.7.1/src/main/main.c
--- pgpool-II-3.7.1.orig/src/main/main.c 2018-01-08 01:46:37.000000000 -0600
+++ pgpool-II-3.7.1/src/main/main.c 2018-02-07 05:10:16.000000000 -0600
@@ -186,7 +186,7 @@ int main(int argc, char **argv)
}
#ifdef USE_SSL
/* global ssl init */
-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined (LIBRESSL_VERSION_NUMBER))
OPENSSL_init_ssl(0, NULL);
#else
SSL_library_init();
diff -pura pgpool-II-3.7.1.orig/src/utils/pool_ssl.c pgpool-II-3.7.1/src/utils/pool_ssl.c
--- pgpool-II-3.7.1.orig/src/utils/pool_ssl.c 2018-01-08 01:46:37.000000000 -0600
+++ pgpool-II-3.7.1/src/utils/pool_ssl.c 2018-02-07 05:10:16.000000000 -0600
@@ -253,7 +253,7 @@ static int init_ssl_ctx(POOL_CONNECTION
char *cacert = NULL, *cacert_dir = NULL;
/* initialize SSL members */
-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined (LIBRESSL_VERSION_NUMBER))
cp->ssl_ctx = SSL_CTX_new(TLS_method());
#else
cp->ssl_ctx = SSL_CTX_new(SSLv23_method());
diff -pura pgpool-II-3.7.1.orig/src/watchdog/wd_utils.c pgpool-II-3.7.1/src/watchdog/wd_utils.c
--- pgpool-II-3.7.1.orig/src/watchdog/wd_utils.c 2018-01-08 01:46:37.000000000 -0600
+++ pgpool-II-3.7.1/src/watchdog/wd_utils.c 2018-02-07 05:10:16.000000000 -0600
@@ -154,7 +154,7 @@ static void calculate_hmac_sha256(const
unsigned int res_len = WD_AUTH_HASH_LEN;
HMAC_CTX *ctx = NULL;
-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined (LIBRESSL_VERSION_NUMBER))
ctx = HMAC_CTX_new();
HMAC_CTX_reset(ctx);
#else
@@ -165,7 +165,7 @@ static void calculate_hmac_sha256(const
HMAC_Init_ex(ctx, key, strlen(key), EVP_sha256(), NULL);
HMAC_Update(ctx, (unsigned char*)data, len);
HMAC_Final(ctx, (unsigned char*)str, &res_len);
-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined (LIBRESSL_VERSION_NUMBER))
HMAC_CTX_reset(ctx);
HMAC_CTX_free(ctx);
#else

View file

@ -0,0 +1,17 @@
# NICE_QUIT ignores new connections and wait for clients to disconnect from
# server before shutting down. NICE_TIMEOUT in seconds determines how long to
# wait for this to succeed.
NICE_TIMEOUT=60
# Forecfully disconnect clients from server and shut down. This is performed
# after NICE_QUIT. Terminated client connections have their open transactions
# rolled back.
# Set RUDE_QUIT to "NO" to disable. RUDE_TIMEOUT in seconds.
RUDE_QUIT="YES"
RUDE_TIMEOUT=30
# If the server still fails to shutdown, you can force it to quit by setting
# this to YES.
# Set FORCE_QUIT to "YES" to enable. FORCE_TIMEOUT in seconds.
FORCE_QUIT="NO"
FORCE_TIMEOUT=2

View file

@ -0,0 +1,82 @@
#!/sbin/openrc-run
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
extra_started_commands="reload"
CONFIGFILE="/etc/pgpool2/pgpool.conf"
LOGFILE="/var/log/pgpool2.log"
depend() {
use net
use postgresql
after logger
}
get_config() {
[ -f ${CONFIGFILE} ] || return 1
eval echo $(sed -e 's:#.*::' ${CONFIGFILE} | \
awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }')
}
PIDFILE="$(get_config pid_file_name)"
: ${PIDFILE:='/run/pgpool/pgpool.pid'}
prep() {
# $logdir contains status file(s), not log files.
local logdir=$(get_config logdir)
local socket_dir=$(get_config socket_dir)
local pcp_socket_dir=$(get_config pcp_socket_dir)
checkpath -o pgpool:postgres -m 0770 -d $(dirname ${PIDFILE}) || return 1
checkpath -o pgpool:postgres -m 0770 -d ${logdir:-'/run/pgpool'} || return 1
checkpath -o pgpool:postgres -m 0660 -f ${LOGFILE} || return 1
checkpath -o postgres:postgres -m 0770 \
-d ${socket_dir:-'/run/postgresql'} || return 1
checkpath -o postgres:postgres -m 0770 \
-d ${pcp_socket_dir:-'/run/postgresql'} || return 1
}
start() {
prep || return 1
ebegin "Starting pgpool2"
start-stop-daemon --start \
--user pgpool:postgres \
--pidfile ${PIDFILE} \
--exec /usr/bin/pgpool
eend
}
stop() {
local seconds=$(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} ))
ebegin "Stopping pgpool (this can take up to ${seconds} seconds)"
local retval
local retries=SIGTERM/${NICE_TIMEOUT}
if [ "${RUDE_QUIT}" != "NO" ] ; then
einfo "RUDE_QUIT enabled."
retries="${retries}/SIGINT/${RUDE_TIMEOUT}"
fi
if [ "${FORCE_QUIT}" = "YES" ] ; then
einfo "FORCE_QUIT enabled."
ewarn "A recover-run might be executed on next startup."
retries="${retries}/SIGQUIT/${FORCE_TIMEOUT}"
fi
# Loops through nice, rude, and force quit in one go.
start-stop-daemon --stop \
--pidfile ${PIDFILE} \
--retry ${retries}
eend
}
reload() {
start-stop-daemon --signal HUP \
--pidfile ${PIDFILE}
}

View file

@ -0,0 +1,268 @@
diff -ur a/src/include/parser/pg_config_manual.h b/src/include/parser/pg_config_manual.h
--- a/src/include/parser/pg_config_manual.h 2017-07-10 04:56:18.000000000 -0400
+++ b/src/include/parser/pg_config_manual.h 2017-07-11 09:38:46.612907898 -0400
@@ -193,7 +193,7 @@
* here's where to twiddle it. You can also override this at runtime
* with the postmaster's -k switch.
*/
-#define DEFAULT_PGSOCKET_DIR "/tmp"
+#define DEFAULT_PGSOCKET_DIR "/run/postgresql"
/*
* This is the default event source for Windows event log.
Only in b/src/include/parser: pg_config_manual.h.orig
diff -ur a/src/include/pcp/pcp_stream.h b/src/include/pcp/pcp_stream.h
--- a/src/include/pcp/pcp_stream.h 2017-07-10 04:39:14.000000000 -0400
+++ b/src/include/pcp/pcp_stream.h 2017-07-11 09:38:46.612907898 -0400
@@ -48,6 +48,6 @@
extern int pcp_write(PCP_CONNECTION *pc, void *buf, int len);
extern int pcp_flush(PCP_CONNECTION *pc);
-#define UNIX_DOMAIN_PATH "/tmp"
+#define UNIX_DOMAIN_PATH "/run/pgpool"
#endif /* PCP_STREAM_H */
diff -ur a/src/include/pool.h b/src/include/pool.h
--- a/src/include/pool.h 2017-07-10 04:56:18.000000000 -0400
+++ b/src/include/pool.h 2017-07-11 09:38:46.612907898 -0400
@@ -73,16 +73,16 @@
#define HBA_CONF_FILE_NAME "pool_hba.conf"
/* pid file directory */
-#define DEFAULT_LOGDIR "/tmp"
+#define DEFAULT_LOGDIR "/run/pgpool"
/* Unix domain socket directory */
-#define DEFAULT_SOCKET_DIR "/tmp"
+#define DEFAULT_SOCKET_DIR "/run/postgresql"
/* Unix domain socket directory for watchdog IPC */
-#define DEFAULT_WD_IPC_SOCKET_DIR "/tmp"
+#define DEFAULT_WD_IPC_SOCKET_DIR "/run/pgpool"
/* pid file name */
-#define DEFAULT_PID_FILE_NAME "/var/run/pgpool/pgpool.pid"
+#define DEFAULT_PID_FILE_NAME "/run/pgpool/pgpool.pid"
/* status file name */
#define STATUS_FILE_NAME "pgpool_status"
diff -ur a/src/sample/pgpool.conf.sample b/src/sample/pgpool.conf.sample
--- a/src/sample/pgpool.conf.sample 2017-07-10 04:56:18.000000000 -0400
+++ b/src/sample/pgpool.conf.sample 2017-07-11 11:05:00.174030914 -0400
@@ -31,10 +31,8 @@
port = 9999
# Port number
# (change requires restart)
-socket_dir = '/tmp'
+socket_dir = '/run/postgresql'
# Unix domain socket path
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
listen_backlog_multiplier = 2
# Set the backlog parameter of listen(2) to
@@ -53,10 +51,8 @@
pcp_port = 9898
# Port number for pcp
# (change requires restart)
-pcp_socket_dir = '/tmp'
+pcp_socket_dir = '/run/pgpool'
# Unix domain socket path for pcp
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
# - Backend Connection Settings -
@@ -210,13 +206,13 @@
# FILE LOCATIONS
#------------------------------------------------------------------------------
-pid_file_name = '/var/run/pgpool/pgpool.pid'
+pid_file_name = '/run/pgpool/pgpool.pid'
# PID file name
# Can be specified as relative to the"
# location of pgpool.conf file or
# as an absolute path
# (change requires restart)
-logdir = '/var/log/pgpool'
+logdir = '/run/pgpool'
# Directory of pgPool status file
# (change requires restart)
@@ -493,10 +489,8 @@
# Authentication key for watchdog communication
# (change requires restart)
-wd_ipc_socket_dir = '/tmp'
+wd_ipc_socket_dir = '/run/pgpool'
# Unix domain socket path for watchdog IPC socket
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
diff -ur a/src/sample/pgpool.conf.sample-master-slave b/src/sample/pgpool.conf.sample-master-slave
--- a/src/sample/pgpool.conf.sample-master-slave 2017-07-10 04:56:18.000000000 -0400
+++ b/src/sample/pgpool.conf.sample-master-slave 2017-07-11 11:13:57.700698647 -0400
@@ -31,10 +31,8 @@
port = 9999
# Port number
# (change requires restart)
-socket_dir = '/tmp'
+socket_dir = '/run/postgresql'
# Unix domain socket path
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
listen_backlog_multiplier = 2
# Set the backlog parameter of listen(2) to
@@ -53,10 +51,8 @@
pcp_port = 9898
# Port number for pcp
# (change requires restart)
-pcp_socket_dir = '/tmp'
+pcp_socket_dir = '/run/pgpool'
# Unix domain socket path for pcp
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
# - Backend Connection Settings -
@@ -210,13 +206,13 @@
# FILE LOCATIONS
#------------------------------------------------------------------------------
-pid_file_name = '/var/run/pgpool/pgpool.pid'
+pid_file_name = '/run/pgpool/pgpool.pid'
# PID file name
# Can be specified as relative to the"
# location of pgpool.conf file or
# as an absolute path
# (change requires restart)
-logdir = '/tmp'
+logdir = '/run/pgpool'
# Directory of pgPool status file
# (change requires restart)
@@ -492,10 +488,8 @@
# Authentication key for watchdog communication
# (change requires restart)
-wd_ipc_socket_dir = '/tmp'
+wd_ipc_socket_dir = '/run/pgpool'
# Unix domain socket path for watchdog IPC socket
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
# - Virtual IP control Setting -
diff -ur a/src/sample/pgpool.conf.sample-replication b/src/sample/pgpool.conf.sample-replication
--- a/src/sample/pgpool.conf.sample-replication 2017-07-10 04:56:18.000000000 -0400
+++ b/src/sample/pgpool.conf.sample-replication 2017-07-11 11:15:10.613588243 -0400
@@ -31,10 +31,8 @@
port = 9999
# Port number
# (change requires restart)
-socket_dir = '/tmp'
+socket_dir = '/run/postgresql'
# Unix domain socket path
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
listen_backlog_multiplier = 2
# Set the backlog parameter of listen(2) to
@@ -53,10 +51,8 @@
pcp_port = 9898
# Port number for pcp
# (change requires restart)
-pcp_socket_dir = '/tmp'
+pcp_socket_dir = '/run/pgpool'
# Unix domain socket path for pcp
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
# - Backend Connection Settings -
@@ -210,13 +206,13 @@
# FILE LOCATIONS
#------------------------------------------------------------------------------
-pid_file_name = '/var/run/pgpool/pgpool.pid'
+pid_file_name = '/run/pgpool/pgpool.pid'
# PID file name
# Can be specified as relative to the"
# location of pgpool.conf file or
# as an absolute path
# (change requires restart)
-logdir = '/tmp'
+logdir = '/run/pgpool'
# Directory of pgPool status file
# (change requires restart)
@@ -492,10 +488,8 @@
# Authentication key for watchdog communication
# (change requires restart)
-wd_ipc_socket_dir = '/tmp'
+wd_ipc_socket_dir = '/run/pgpool'
# Unix domain socket path for watchdog IPC socket
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
diff -ur a/src/sample/pgpool.conf.sample-stream b/src/sample/pgpool.conf.sample-stream
--- a/src/sample/pgpool.conf.sample-stream 2017-07-10 04:56:18.000000000 -0400
+++ b/src/sample/pgpool.conf.sample-stream 2017-07-11 11:15:50.996675811 -0400
@@ -31,10 +31,8 @@
port = 9999
# Port number
# (change requires restart)
-socket_dir = '/tmp'
+socket_dir = '/run/postgresql'
# Unix domain socket path
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
@@ -47,10 +45,8 @@
pcp_port = 9898
# Port number for pcp
# (change requires restart)
-pcp_socket_dir = '/tmp'
+pcp_socket_dir = '/run/pgpool'
# Unix domain socket path for pcp
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)
listen_backlog_multiplier = 2
# Set the backlog parameter of listen(2) to
@@ -211,13 +207,13 @@
# FILE LOCATIONS
#------------------------------------------------------------------------------
-pid_file_name = '/var/run/pgpool/pgpool.pid'
+pid_file_name = '/run/pgpool/pgpool.pid'
# PID file name
# Can be specified as relative to the"
# location of pgpool.conf file or
# as an absolute path
# (change requires restart)
-logdir = '/tmp'
+logdir = '/run/pgpool'
# Directory of pgPool status file
# (change requires restart)
@@ -492,10 +488,8 @@
# Authentication key for watchdog communication
# (change requires restart)
-wd_ipc_socket_dir = '/tmp'
+wd_ipc_socket_dir = '/run/pgpool'
# Unix domain socket path for watchdog IPC socket
- # The Debian package defaults to
- # /var/run/postgresql
# (change requires restart)

View file

@ -0,0 +1,102 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
POSTGRES_COMPAT=( 9.{2..6} 10 )
inherit postgres-multi
MY_P="${PN/2/-II}-${PV}"
DESCRIPTION="Connection pool server for PostgreSQL"
HOMEPAGE="http://www.pgpool.net/"
SRC_URI="http://www.pgpool.net/download.php?f=${MY_P}.tar.gz -> ${MY_P}.tar.gz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc libressl memcached pam ssl static-libs"
RDEPEND="
${POSTGRES_DEP}
net-libs/libnsl:0=
memcached? ( dev-libs/libmemcached )
pam? ( sys-auth/pambase )
ssl? (
!libressl? ( dev-libs/openssl:* )
libressl? ( dev-libs/libressl:* )
)
"
DEPEND="${RDEPEND}
sys-devel/bison
!!dev-db/pgpool
"
S=${WORKDIR}/${MY_P}
pkg_setup() {
postgres_new_user pgpool
postgres-multi_pkg_setup
}
src_prepare() {
eapply "${FILESDIR}/pgpool_run_paths-3.6.5.patch"
eapply "${FILESDIR}/pgpool-II-3.7.1-libressl.patch"
postgres-multi_src_prepare
}
src_configure() {
local myconf
use memcached && \
myconf="--with-memcached=\"${EROOT%/}/usr/include/libmemcached\""
use pam && myconf+=' --with-pam'
postgres-multi_foreach econf \
--disable-rpath \
--sysconfdir="${EROOT%/}/etc/${PN}" \
--with-pgsql-includedir='/usr/include/postgresql-@PG_SLOT@' \
--with-pgsql-libdir="/usr/$(get_libdir)/postgresql-@PG_SLOT@/$(get_libdir)" \
$(use_with ssl openssl) \
$(use_enable static-libs static) \
${myconf}
}
src_compile() {
# Even though we're only going to do an install for the best slot
# available, the extension bits in src/sql need some things outside
# of that directory built, too.
postgres-multi_foreach emake
postgres-multi_foreach emake -C src/sql
}
src_install() {
# We only need the best stuff installed
postgres-multi_forbest emake DESTDIR="${D}" install
# Except for the extension and .so files that each PostgreSQL slot needs
postgres-multi_foreach emake DESTDIR="${D}" -C src/sql install
newinitd "${FILESDIR}/${PN}.initd" ${PN}
newconfd "${FILESDIR}/${PN}.confd" ${PN}
# Documentation!
dodoc NEWS TODO
doman doc/src/sgml/man{1,8}/*
use doc && dodoc -r doc/src/sgml/html
# Examples and extras
# mv some files that get installed to /usr/share/pgpool-II so that
# they all wind up in the same place
mv "${ED%/}/usr/share/${PN/2/-II}" "${ED%/}/usr/share/${PN}" || die
into "/usr/share/${PN}"
dobin src/sample/{pgpool_recovery,pgpool_recovery_pitr,pgpool_remote_start}
insinto "/usr/share/${PN}"
doins src/sample/{{pcp,pgpool,pool_hba}.conf.sample*,pgpool.pam}
# One more thing: Evil la files!
find "${ED}" -name '*.la' -exec rm -f {} +
}