1 |
commit: f3013a2f9556db788c5f7889a69fe2c7d6e50992 |
2 |
Author: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 27 08:23:00 2018 +0000 |
4 |
Commit: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 27 08:23:00 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f3013a2f |
7 |
|
8 |
dev-db/pgbouncer: Bump |
9 |
|
10 |
Also fixes PIDFILE in init.d/conf.d to allow multi-instance operation |
11 |
|
12 |
Package-Manager: Portage-2.3.48, Repoman-2.3.10 |
13 |
|
14 |
dev-db/pgbouncer/Manifest | 1 + |
15 |
dev-db/pgbouncer/files/pgbouncer.confd-r1 | 15 ++++++ |
16 |
dev-db/pgbouncer/files/pgbouncer.initd-r2 | 81 +++++++++++++++++++++++++++++ |
17 |
dev-db/pgbouncer/pgbouncer-1.9.0.ebuild | 86 +++++++++++++++++++++++++++++++ |
18 |
4 files changed, 183 insertions(+) |
19 |
|
20 |
diff --git a/dev-db/pgbouncer/Manifest b/dev-db/pgbouncer/Manifest |
21 |
index c49eebee4d6..1bea33dfbba 100644 |
22 |
--- a/dev-db/pgbouncer/Manifest |
23 |
+++ b/dev-db/pgbouncer/Manifest |
24 |
@@ -1 +1,2 @@ |
25 |
DIST pgbouncer-1.8.1.tar.gz 465930 BLAKE2B 692c551cb7bfb56bfe1b354791b06bdf61866197150a78a7fa9688891a2e4cd3c015abc5fbe33bf66dc85ab0ae83745f2db852eae91ae99596c97be0154e8bd5 SHA512 595a94db98866cec211f2b8c1ad13d209dba00e5fd41f2e9025aabdcb660194f0f772810270a1d9f067c3039c9fee630e8ff2d56f231935add17207aecc10bee |
26 |
+DIST pgbouncer-1.9.0.tar.gz 469300 BLAKE2B 466f171a49ec9ce9be9a9d3208780cfbff956da7c74ec4332c7104ea537cb47a5cfdc0d80bbd96d233769b6f430f1ad99b623caefa2dc93af7ba336dd0f49514 SHA512 b127f4cb60ca5cdf339da76727918f0a3797a3e0a89f8ed6fdcaa80f3391d2c5bb51e19731915775210c0e5070dd611ee2e410c9a947624e45b5cf11aecdacf9 |
27 |
|
28 |
diff --git a/dev-db/pgbouncer/files/pgbouncer.confd-r1 b/dev-db/pgbouncer/files/pgbouncer.confd-r1 |
29 |
new file mode 100644 |
30 |
index 00000000000..dbb93b917e7 |
31 |
--- /dev/null |
32 |
+++ b/dev-db/pgbouncer/files/pgbouncer.confd-r1 |
33 |
@@ -0,0 +1,15 @@ |
34 |
+# Location of configuration file for PgBouncer. |
35 |
+INIFILE="/etc/pgbouncer.ini" |
36 |
+ |
37 |
+PIDFILE="/run/pgbouncer.pid" |
38 |
+ |
39 |
+ |
40 |
+# How long to wait in seconds for a safe shutdown. Equivalent to |
41 |
+# issuing 'PAUSE;' and 'SHUTDOWN;' on psql console. (See 'man 1 pgbouncer'.) |
42 |
+NICE_TIMEOUT=60 |
43 |
+ |
44 |
+# Set to 'YES' to perform an immediate shutdown if the nice shutdown |
45 |
+# doesn't work. Same as issuing 'SHUTDOWN;' on console. (See 'man 1 |
46 |
+# pgbouncer'.) |
47 |
+FORCE_QUIT="no" |
48 |
+FORCE_QUIT_TIMEOUT=2 |
49 |
|
50 |
diff --git a/dev-db/pgbouncer/files/pgbouncer.initd-r2 b/dev-db/pgbouncer/files/pgbouncer.initd-r2 |
51 |
new file mode 100644 |
52 |
index 00000000000..a2a79a0784a |
53 |
--- /dev/null |
54 |
+++ b/dev-db/pgbouncer/files/pgbouncer.initd-r2 |
55 |
@@ -0,0 +1,81 @@ |
56 |
+#!/sbin/openrc-run |
57 |
+ |
58 |
+extra_started_commands="reload" |
59 |
+ |
60 |
+depend() { |
61 |
+ use net |
62 |
+ after postgresql |
63 |
+} |
64 |
+ |
65 |
+get_config() { |
66 |
+ [ -f "${INIFILE}" ] || eend 1 "'${INIFILE}' not found" |
67 |
+ |
68 |
+ eval echo $(sed -e 's:;.*::' "${INIFILE}" | \ |
69 |
+ awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }') |
70 |
+} |
71 |
+ |
72 |
+start_pre() { |
73 |
+ local s="$(get_config unix_socket_dir)" |
74 |
+ |
75 |
+ if [ -n "${s}" ] ; then |
76 |
+ checkpath -o root:postgres -m 1775 -d "${s}" || return 1 |
77 |
+ |
78 |
+ local listen_port="$(get_config listen_port)" |
79 |
+ |
80 |
+ if [ -e "${s%/}/.s.PGSQL.${listen_port}" ] ; then |
81 |
+ eerror "Socket conflict." |
82 |
+ eerror "A server is already listening on:" |
83 |
+ eerror " ${s%/}/.s.PGSQL.${listen_port}" |
84 |
+ eerror "HINT: Change listen_port in pgbouncer.ini to listen on a" |
85 |
+ eerror "different socket." |
86 |
+ return 1 |
87 |
+ fi |
88 |
+ fi |
89 |
+ |
90 |
+ checkpath -o pgbouncer:postgres -m 0755 \ |
91 |
+ -d "$(dirname $(get_config logfile))" || return 1 |
92 |
+ checkpath -o pgbouncer:postgres -m 0640 \ |
93 |
+ -f "$(get_config logfile)" || return 1 |
94 |
+ |
95 |
+ return 0 |
96 |
+} |
97 |
+ |
98 |
+start() { |
99 |
+ ebegin "Starting PgBouncer" |
100 |
+ [ -f ${PIDFILE} ] && rm ${PIDFILE} |
101 |
+ |
102 |
+ start-stop-daemon --start \ |
103 |
+ --pidfile ${PIDFILE} \ |
104 |
+ --background \ |
105 |
+ --make-pidfile \ |
106 |
+ --user pgbouncer \ |
107 |
+ --exec /usr/bin/pgbouncer \ |
108 |
+ -- -q "${INIFILE}" |
109 |
+ eend $? |
110 |
+} |
111 |
+ |
112 |
+stop() { |
113 |
+ local seconds=$(( ${NICE_TIMEOUT} + ${FORCE_QUIT_TIMEOUT} )) |
114 |
+ ebegin "Stopping PgBouncer (this can take up to ${seconds} seconds)" |
115 |
+ |
116 |
+ local retries=SIGINT/${NICE_TIMEOUT} |
117 |
+ |
118 |
+ if [ "${FORCE_QUIT}" = "YES" ] ; then |
119 |
+ einfo "FORCE_QUIT enabled." |
120 |
+ retries="${retries}/SIGTERM/${FORCE_QUIT_TIMEOUT}" |
121 |
+ fi |
122 |
+ |
123 |
+ # Loops through nice and force quit in one go. |
124 |
+ start-stop-daemon --stop \ |
125 |
+ --user pgbouncer \ |
126 |
+ --pidfile ${PIDFILE} \ |
127 |
+ --retry ${retries} |
128 |
+ |
129 |
+ eend $? |
130 |
+} |
131 |
+ |
132 |
+reload() { |
133 |
+ ebegin "Reloading PgBouncer configuration from '${INIFILE}'" |
134 |
+ start-stop-daemon --signal HUP --pidfile ${PIDFILE} |
135 |
+ eend $? |
136 |
+} |
137 |
|
138 |
diff --git a/dev-db/pgbouncer/pgbouncer-1.9.0.ebuild b/dev-db/pgbouncer/pgbouncer-1.9.0.ebuild |
139 |
new file mode 100644 |
140 |
index 00000000000..46b5a23edb2 |
141 |
--- /dev/null |
142 |
+++ b/dev-db/pgbouncer/pgbouncer-1.9.0.ebuild |
143 |
@@ -0,0 +1,86 @@ |
144 |
+# Copyright 1999-2018 Gentoo Foundation |
145 |
+# Distributed under the terms of the GNU General Public License v2 |
146 |
+ |
147 |
+EAPI="6" |
148 |
+ |
149 |
+inherit user |
150 |
+ |
151 |
+DESCRIPTION="Lightweight connection pooler for PostgreSQL" |
152 |
+HOMEPAGE="https://pgbouncer.github.io" |
153 |
+SRC_URI="https://pgbouncer.github.io/downloads/files/${PV}/${P}.tar.gz" |
154 |
+LICENSE="BSD" |
155 |
+SLOT="0" |
156 |
+KEYWORDS="~amd64 ~x86" |
157 |
+IUSE="+c-ares debug doc pam ssl -udns" |
158 |
+ |
159 |
+# At-most-one-of, one can be enabled but not both |
160 |
+REQUIRED_USE="?? ( c-ares udns )" |
161 |
+ |
162 |
+RDEPEND=" |
163 |
+ >=dev-libs/libevent-2.0 |
164 |
+ >=sys-libs/glibc-2.10 |
165 |
+ c-ares? ( >=net-dns/c-ares-1.10 ) |
166 |
+ ssl? ( >=dev-libs/openssl-1.0.1:=[-bindist] ) |
167 |
+ udns? ( >=net-libs/udns-0.1 ) |
168 |
+" |
169 |
+ |
170 |
+DEPEND="${RDEPEND}" |
171 |
+ |
172 |
+pkg_setup() { |
173 |
+ enewgroup postgres 70 |
174 |
+ enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
175 |
+ |
176 |
+ enewuser pgbouncer -1 -1 -1 postgres |
177 |
+} |
178 |
+ |
179 |
+src_prepare() { |
180 |
+ eapply "${FILESDIR}/pgbouncer-1.8-dirs.patch" |
181 |
+ |
182 |
+ default |
183 |
+} |
184 |
+ |
185 |
+src_configure() { |
186 |
+ # --enable-debug is only used to disable stripping |
187 |
+ econf \ |
188 |
+ --docdir=/usr/share/doc/${PF} \ |
189 |
+ --enable-debug \ |
190 |
+ $(use_with c-ares cares) \ |
191 |
+ $(use_enable debug cassert) \ |
192 |
+ $(use_with pam) \ |
193 |
+ $(use_with ssl openssl) \ |
194 |
+ $(use_with udns) |
195 |
+} |
196 |
+ |
197 |
+src_test() { |
198 |
+ cd "${S}/test" |
199 |
+ emake |
200 |
+} |
201 |
+ |
202 |
+src_install() { |
203 |
+ emake DESTDIR="${D}" install |
204 |
+ |
205 |
+ dodoc AUTHORS |
206 |
+ use doc && dodoc doc/*.rst |
207 |
+ |
208 |
+ newconfd "${FILESDIR}/${PN}.confd-r1" "${PN}" |
209 |
+ newinitd "${FILESDIR}/${PN}.initd-r2" "${PN}" |
210 |
+ |
211 |
+ insinto /etc |
212 |
+ doins etc/pgbouncer.ini |
213 |
+ |
214 |
+ insinto /etc/logrotate.d |
215 |
+ newins "${FILESDIR}/logrotate" pgbouncer |
216 |
+} |
217 |
+ |
218 |
+pkg_postinst() { |
219 |
+ if [[ -z ${REPLACING_VERSIONS} ]] ; then |
220 |
+ einfo "Please read the config.txt for Configuration Directives" |
221 |
+ einfo |
222 |
+ einfo "For Administration Commands, see:" |
223 |
+ einfo " man pgbouncer" |
224 |
+ einfo |
225 |
+ einfo "By default, PgBouncer does not have access to any database." |
226 |
+ einfo "GRANT the permissions needed for your application and make sure that it" |
227 |
+ einfo "exists in PgBouncer's auth_file." |
228 |
+ fi |
229 |
+} |