diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
commit | 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch) | |
tree | 7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /dev-db/pgbouncer | |
parent | 30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff) |
gentoo resync : 14.07.2018
Diffstat (limited to 'dev-db/pgbouncer')
-rw-r--r-- | dev-db/pgbouncer/Manifest | 7 | ||||
-rw-r--r-- | dev-db/pgbouncer/files/logrotate | 7 | ||||
-rw-r--r-- | dev-db/pgbouncer/files/pgbouncer-1.8-dirs.patch | 32 | ||||
-rw-r--r-- | dev-db/pgbouncer/files/pgbouncer.confd | 12 | ||||
-rwxr-xr-x | dev-db/pgbouncer/files/pgbouncer.initd-r1 | 83 | ||||
-rw-r--r-- | dev-db/pgbouncer/metadata.xml | 17 | ||||
-rw-r--r-- | dev-db/pgbouncer/pgbouncer-1.8.1.ebuild | 86 |
7 files changed, 244 insertions, 0 deletions
diff --git a/dev-db/pgbouncer/Manifest b/dev-db/pgbouncer/Manifest new file mode 100644 index 000000000000..5495f91cc78c --- /dev/null +++ b/dev-db/pgbouncer/Manifest @@ -0,0 +1,7 @@ +AUX logrotate 119 BLAKE2B 7ed90c0272410e5a37411f78aaa446d1688ceb5a5a0cfa652f8ea3d043f693af2b963aaf18bb230ec4cd5ae34f09219f02b9ee0ca5b43fe61489f46aa7a8d505 SHA512 5aa4226ab2d168a88a3b64deb114d3901431d2afb2571cf8ae411c989549bc465ee05104a6863cc8fce6d769d809b4ab536973280f50cb4415c6698c34e1a5b8 +AUX pgbouncer-1.8-dirs.patch 984 BLAKE2B 0e9a3550efad0669e4598513197c50460326f701dae628ae8c9fb201e08ae3f0c5826515c6a884a00f2b0afd048490b16d87f9b3b9cf836ca4c77284cd705334 SHA512 2c9ddd2ae193b032435f97d41e789283ae69d99fefeb3829e80a90be296ccd2a754a9d00e6930985408758dfa3349d65f3c2ddf1f74053424bc8d8d09b2fa0e2 +AUX pgbouncer.confd 425 BLAKE2B f9b7065c043474f2208b44eecefb9cd1d6544295a47c3aee51f340f522eb4ba87bb270c99e18183541aca144eb16487a622ff5f2b5d5b87b2d1c7dd950262afd SHA512 9f997cbfb18f5bb1623aea2a9af706359a973fd2167be91ee6ffb37a22a6dc453280c66b6d2c11ab0174dbf159a195f0a1612be198466633d728a5317a878035 +AUX pgbouncer.initd-r1 2216 BLAKE2B cfc489a5db03b6e4c56c79036d070152a6f78ce6c300fdc52049aaf91c41db1e2a41af409e701ab8dc2a24a5ca4e8b89b38cc61c52885a1330a04ef727d7585e SHA512 c2af62daf4e7c8e5a25acd17237de2134f1e496a51bd054abecc020a65b39c309c85572c17105431fd598a80ada187fb32fa8f2b1db229d2207c59607748220a +DIST pgbouncer-1.8.1.tar.gz 465930 BLAKE2B 692c551cb7bfb56bfe1b354791b06bdf61866197150a78a7fa9688891a2e4cd3c015abc5fbe33bf66dc85ab0ae83745f2db852eae91ae99596c97be0154e8bd5 SHA512 595a94db98866cec211f2b8c1ad13d209dba00e5fd41f2e9025aabdcb660194f0f772810270a1d9f067c3039c9fee630e8ff2d56f231935add17207aecc10bee +EBUILD pgbouncer-1.8.1.ebuild 1892 BLAKE2B 7fab90d3eb06d905c21a42773532c21fb978d7040915d14262f5203eb54db0fb7a6747b88fcf0183b6980f29a81774d79b809c50193bfdc07def521b9df42f2c SHA512 723a646c3694518d5a0e40b8dc6dd6ea2d393b6dbebccfafb324a1d6f160415166c3ac1fbda068aadee277c2ac549fca92109d432a6ec49f20f687ffd06fe931 +MISC metadata.xml 472 BLAKE2B b06a5dca1ee52c85fa1f948c4c8cf6e83c0aba3e0b0bd77672f1585c01d0a2f8ef4d7502e30e9cb658ec3dd3e53560671b69210166c36b4ce888e329f531585b SHA512 b098e87be6194706f462bb93c4bf5425023f7bd90a0ed421a51ea42db98c85ebd77f23eb413f4e271e126ad4404cd0bdf0694f675662c421f7afd8ec0f036b4d diff --git a/dev-db/pgbouncer/files/logrotate b/dev-db/pgbouncer/files/logrotate new file mode 100644 index 000000000000..9617eafa66b0 --- /dev/null +++ b/dev-db/pgbouncer/files/logrotate @@ -0,0 +1,7 @@ +/var/log/pgbouncer/pgbouncer.log { + missingok + sharedscripts + postrotate + /etc/init.d/pgbouncer -q reload + endscript +}
\ No newline at end of file diff --git a/dev-db/pgbouncer/files/pgbouncer-1.8-dirs.patch b/dev-db/pgbouncer/files/pgbouncer-1.8-dirs.patch new file mode 100644 index 000000000000..cc4d0634b6b3 --- /dev/null +++ b/dev-db/pgbouncer/files/pgbouncer-1.8-dirs.patch @@ -0,0 +1,32 @@ +diff -Naruw pgbouncer-1.8.orig/etc/pgbouncer.ini pgbouncer-1.8/etc/pgbouncer.ini +--- pgbouncer-1.8.orig/etc/pgbouncer.ini 2017-12-18 11:03:18.000000000 -0500 ++++ pgbouncer-1.8/etc/pgbouncer.ini 2017-12-20 06:48:25.935839539 -0500 +@@ -34,7 +34,9 @@ + ;;; + + logfile = /var/log/pgbouncer/pgbouncer.log +-pidfile = /var/run/pgbouncer/pgbouncer.pid ++ ++; Leave unset. This is handled in the initscript. ++;pidfile = + + ;;; + ;;; Where to wait for clients +@@ -44,11 +46,12 @@ + listen_addr = 127.0.0.1 + listen_port = 6432 + +-; Unix socket is also used for -R. +-; On Debian it should be /var/run/postgresql +-;unix_socket_dir = /tmp +-;unix_socket_mode = 0777 +-;unix_socket_group = ++; Unix socket is also used for -R (online restart), but the ++; initscripts can't do that. Generally, you'll want to leave these ++; alone. System-wide default is: /run/postgresql ++unix_socket_dir = /run/postgresql ++unix_socket_mode = 0777 ++unix_socket_group = postgres + + ;;; + ;;; TLS settings for accepting clients diff --git a/dev-db/pgbouncer/files/pgbouncer.confd b/dev-db/pgbouncer/files/pgbouncer.confd new file mode 100644 index 000000000000..e2c584011884 --- /dev/null +++ b/dev-db/pgbouncer/files/pgbouncer.confd @@ -0,0 +1,12 @@ +# Location of configuration file for PgBouncer. +INIFILE="/etc/pgbouncer.ini" + +# How long to wait in seconds for a safe shutdown. Equivalent to +# issuing 'PAUSE;' and 'SHUTDOWN;' on psql console. (See 'man 1 pgbouncer'.) +NICE_TIMEOUT=60 + +# Set to 'YES' to perform an immediate shutdown if the nice shutdown +# doesn't work. Same as issuing 'SHUTDOWN;' on console. (See 'man 1 +# pgbouncer'.) +FORCE_QUIT="no" +FORCE_QUIT_TIMEOUT=2
\ No newline at end of file diff --git a/dev-db/pgbouncer/files/pgbouncer.initd-r1 b/dev-db/pgbouncer/files/pgbouncer.initd-r1 new file mode 100755 index 000000000000..7392918593bb --- /dev/null +++ b/dev-db/pgbouncer/files/pgbouncer.initd-r1 @@ -0,0 +1,83 @@ +#!/sbin/openrc-run + +extra_started_commands="reload" + +PIDFILE="/run/pgbouncer.pid" + +depend() { + use net + after postgresql +} + +get_config() { + [ -f "${INIFILE}" ] || eend 1 "'${INIFILE}' not found" + + eval echo $(sed -e 's:;.*::' "${INIFILE}" | \ + awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }') +} + +start_pre() { + local s="$(get_config unix_socket_dir)" + + if [ -n "${s}" ] ; then + checkpath -o root:postgres -m 1775 -d "${s}" || return 1 + + local listen_port="$(get_config listen_port)" + + if [ -e "${s%/}/.s.PGSQL.${listen_port}" ] ; then + eerror "Socket conflict." + eerror "A server is already listening on:" + eerror " ${s%/}/.s.PGSQL.${listen_port}" + eerror "HINT: Change listen_port in pgbouncer.ini to listen on a" + eerror "different socket." + return 1 + fi + fi + + checkpath -o pgbouncer:postgres -m 0755 \ + -d "$(dirname $(get_config logfile))" || return 1 + checkpath -o pgbouncer:postgres -m 0640 \ + -f "$(get_config logfile)" || return 1 + + return 0 +} + +start() { + ebegin "Starting PgBouncer" + [ -f ${PIDFILE} ] && rm ${PIDFILE} + + start-stop-daemon --start \ + --pidfile ${PIDFILE} \ + --background \ + --make-pidfile \ + --user pgbouncer \ + --exec /usr/bin/pgbouncer \ + -- -q "${INIFILE}" + eend $? +} + +stop() { + local seconds=$(( ${NICE_TIMEOUT} + ${FORCE_QUIT_TIMEOUT} )) + ebegin "Stopping PgBouncer (this can take up to ${seconds} seconds)" + + local retries=SIGINT/${NICE_TIMEOUT} + + if [ "${FORCE_QUIT}" = "YES" ] ; then + einfo "FORCE_QUIT enabled." + retries="${retries}/SIGTERM/${FORCE_QUIT_TIMEOUT}" + fi + + # Loops through nice and force quit in one go. + start-stop-daemon --stop \ + --user pgbouncer \ + --pidfile ${PIDFILE} \ + --retry ${retries} + + eend $? +} + +reload() { + ebegin "Reloading PgBouncer configuration from '${INIFILE}'" + start-stop-daemon --signal HUP --pidfile ${PIDFILE} + eend $? +} diff --git a/dev-db/pgbouncer/metadata.xml b/dev-db/pgbouncer/metadata.xml new file mode 100644 index 000000000000..ee74448388b1 --- /dev/null +++ b/dev-db/pgbouncer/metadata.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="project"> + <email>pgsql-bugs@gentoo.org</email> + <name>PostgreSQL</name> + </maintainer> + <use> + <flag name="c-ares"> + Use c-ares as the DNS backend instead of evdns (libevent). + </flag> + <flag name="udns"> + Use udns as the DNS backend instead of evdns (libevent). Supports + IPv4 only. + </flag> + </use> +</pkgmetadata> diff --git a/dev-db/pgbouncer/pgbouncer-1.8.1.ebuild b/dev-db/pgbouncer/pgbouncer-1.8.1.ebuild new file mode 100644 index 000000000000..f590a731732e --- /dev/null +++ b/dev-db/pgbouncer/pgbouncer-1.8.1.ebuild @@ -0,0 +1,86 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI="6" + +inherit user + +DESCRIPTION="Lightweight connection pooler for PostgreSQL" +HOMEPAGE="https://pgbouncer.github.io" +SRC_URI="https://pgbouncer.github.io/downloads/files/${PV}/${P}.tar.gz" +LICENSE="BSD" +SLOT="0" +KEYWORDS="amd64 x86" +IUSE="+c-ares debug doc pam ssl -udns" + +# At-most-one-of, one can be enabled but not both +REQUIRED_USE="?? ( c-ares udns )" + +RDEPEND=" + >=dev-libs/libevent-2.0 + >=sys-libs/glibc-2.10 + c-ares? ( >=net-dns/c-ares-1.10 ) + ssl? ( >=dev-libs/openssl-1.0.1:=[-bindist] ) + udns? ( >=net-libs/udns-0.1 ) +" + +DEPEND="${RDEPEND}" + +pkg_setup() { + enewgroup postgres 70 + enewuser postgres 70 /bin/bash /var/lib/postgresql postgres + + enewuser pgbouncer -1 -1 -1 postgres +} + +src_prepare() { + eapply "${FILESDIR}/pgbouncer-1.8-dirs.patch" + + default +} + +src_configure() { + # --enable-debug is only used to disable stripping + econf \ + --docdir=/usr/share/doc/${PF} \ + --enable-debug \ + $(use_with c-ares cares) \ + $(use_enable debug cassert) \ + $(use_with pam) \ + $(use_with ssl openssl) \ + $(use_with udns) +} + +src_test() { + cd "${S}/test" + emake +} + +src_install() { + emake DESTDIR="${D}" install + + dodoc AUTHORS + use doc && dodoc doc/*.rst + + newconfd "${FILESDIR}/${PN}.confd" "${PN}" + newinitd "${FILESDIR}/${PN}.initd-r1" "${PN}" + + insinto /etc + doins etc/pgbouncer.ini + + insinto /etc/logrotate.d + newins "${FILESDIR}/logrotate" pgbouncer +} + +pkg_postinst() { + if [[ -z ${REPLACING_VERSIONS} ]] ; then + einfo "Please read the config.txt for Configuration Directives" + einfo + einfo "For Administration Commands, see:" + einfo " man pgbouncer" + einfo + einfo "By default, PgBouncer does not have access to any database." + einfo "GRANT the permissions needed for your application and make sure that it" + einfo "exists in PgBouncer's auth_file." + fi +} |