diff options
Diffstat (limited to 'dev-db/pgbouncer')
-rw-r--r-- | dev-db/pgbouncer/Manifest | 4 | ||||
-rw-r--r-- | dev-db/pgbouncer/files/pgbouncer.confd-r1 | 15 | ||||
-rwxr-xr-x | dev-db/pgbouncer/files/pgbouncer.initd-r2 | 81 | ||||
-rw-r--r-- | dev-db/pgbouncer/pgbouncer-1.9.0.ebuild | 86 |
4 files changed, 186 insertions, 0 deletions
diff --git a/dev-db/pgbouncer/Manifest b/dev-db/pgbouncer/Manifest index 5495f91cc78c..dab44ce95cef 100644 --- a/dev-db/pgbouncer/Manifest +++ b/dev-db/pgbouncer/Manifest @@ -1,7 +1,11 @@ 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.confd-r1 457 BLAKE2B 0b2e33b57ee33eac42742a8f9fe7c0f090bad53c5d7c29d86fd3047307bd05d62f922fc66a0805ba3396934f6e2e7060f810f1c71c5b07d887edf2763cc0f40d SHA512 0642b12236e944b6b5086b593dfd4a5d7c04c8347fc286835381945a50a421e87805900d63d84d12dcb1fad667fc81f21c8644c63af33388a71048ec6e024ab5 AUX pgbouncer.initd-r1 2216 BLAKE2B cfc489a5db03b6e4c56c79036d070152a6f78ce6c300fdc52049aaf91c41db1e2a41af409e701ab8dc2a24a5ca4e8b89b38cc61c52885a1330a04ef727d7585e SHA512 c2af62daf4e7c8e5a25acd17237de2134f1e496a51bd054abecc020a65b39c309c85572c17105431fd598a80ada187fb32fa8f2b1db229d2207c59607748220a +AUX pgbouncer.initd-r2 2204 BLAKE2B 9c417188d4a762906c7631f1ae8fc7c7b8f6c52805acf6bfc12d580c53b2faa4e36b7c0662852feaf78aebcc29498bb8ae441d749a710793508c6950a448862f SHA512 dd9e8f7487affcc46b359e6d07a4c2fd698626d7360d2b2929389bbd7a340059eb27f0e0e9a648b7005c446d65762edbb02b865fa68194ebb822c01fba19fd7e DIST pgbouncer-1.8.1.tar.gz 465930 BLAKE2B 692c551cb7bfb56bfe1b354791b06bdf61866197150a78a7fa9688891a2e4cd3c015abc5fbe33bf66dc85ab0ae83745f2db852eae91ae99596c97be0154e8bd5 SHA512 595a94db98866cec211f2b8c1ad13d209dba00e5fd41f2e9025aabdcb660194f0f772810270a1d9f067c3039c9fee630e8ff2d56f231935add17207aecc10bee +DIST pgbouncer-1.9.0.tar.gz 469300 BLAKE2B 466f171a49ec9ce9be9a9d3208780cfbff956da7c74ec4332c7104ea537cb47a5cfdc0d80bbd96d233769b6f430f1ad99b623caefa2dc93af7ba336dd0f49514 SHA512 b127f4cb60ca5cdf339da76727918f0a3797a3e0a89f8ed6fdcaa80f3391d2c5bb51e19731915775210c0e5070dd611ee2e410c9a947624e45b5cf11aecdacf9 EBUILD pgbouncer-1.8.1.ebuild 1892 BLAKE2B 7fab90d3eb06d905c21a42773532c21fb978d7040915d14262f5203eb54db0fb7a6747b88fcf0183b6980f29a81774d79b809c50193bfdc07def521b9df42f2c SHA512 723a646c3694518d5a0e40b8dc6dd6ea2d393b6dbebccfafb324a1d6f160415166c3ac1fbda068aadee277c2ac549fca92109d432a6ec49f20f687ffd06fe931 +EBUILD pgbouncer-1.9.0.ebuild 1897 BLAKE2B 77c6be134fe3990c28f94f5ed7ed76debb4b01080ab594d0355cdae244578a2a3edd986a79d13a6e842b4a1274ea53ba335c0febda14c89ae24b4c3a04ba11c5 SHA512 ff4226509d48fe8cbad3db18f161517db38a8e70c48e5609ae478bfdae20d6989364f2cccadf00fd1b5d736f57305bc9789bec3599d0da2fb3e95bac7a58e7ff MISC metadata.xml 472 BLAKE2B b06a5dca1ee52c85fa1f948c4c8cf6e83c0aba3e0b0bd77672f1585c01d0a2f8ef4d7502e30e9cb658ec3dd3e53560671b69210166c36b4ce888e329f531585b SHA512 b098e87be6194706f462bb93c4bf5425023f7bd90a0ed421a51ea42db98c85ebd77f23eb413f4e271e126ad4404cd0bdf0694f675662c421f7afd8ec0f036b4d diff --git a/dev-db/pgbouncer/files/pgbouncer.confd-r1 b/dev-db/pgbouncer/files/pgbouncer.confd-r1 new file mode 100644 index 000000000000..dbb93b917e7c --- /dev/null +++ b/dev-db/pgbouncer/files/pgbouncer.confd-r1 @@ -0,0 +1,15 @@ +# Location of configuration file for PgBouncer. +INIFILE="/etc/pgbouncer.ini" + +PIDFILE="/run/pgbouncer.pid" + + +# 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 diff --git a/dev-db/pgbouncer/files/pgbouncer.initd-r2 b/dev-db/pgbouncer/files/pgbouncer.initd-r2 new file mode 100755 index 000000000000..72e0103e0b5d --- /dev/null +++ b/dev-db/pgbouncer/files/pgbouncer.initd-r2 @@ -0,0 +1,81 @@ +#!/sbin/openrc-run + +extra_started_commands="reload" + +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:postgres \ + --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:postgres \ + --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/pgbouncer-1.9.0.ebuild b/dev-db/pgbouncer/pgbouncer-1.9.0.ebuild new file mode 100644 index 000000000000..46b5a23edb21 --- /dev/null +++ b/dev-db/pgbouncer/pgbouncer-1.9.0.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-r1" "${PN}" + newinitd "${FILESDIR}/${PN}.initd-r2" "${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 +} |