1 |
commit: f1b07f8816c2f0346d07468bdb4c5b9ce4ffada7 |
2 |
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Apr 17 13:09:56 2017 +0000 |
4 |
Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Apr 17 15:40:58 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f1b07f88 |
7 |
|
8 |
dev-db/postgresql: Eselect and security related fixes |
9 |
|
10 |
Dependency bumped on app-eselect/eselect-postgresql to 2.0. Some of |
11 |
its work has been shifted into the ebuild as the files/links don’t |
12 |
change until this package is reemerge, unmerged, or updated. |
13 |
|
14 |
Security issues addressed in the initscripts per bugs 603716 and 603720. |
15 |
|
16 |
Bugs: 603716, 603720 |
17 |
|
18 |
Package-Manager: portage-2.3.0 |
19 |
|
20 |
dev-db/postgresql/files/postgresql.confd-9.2 | 65 +++++ |
21 |
dev-db/postgresql/files/postgresql.confd-9.3 | 65 +++++ |
22 |
dev-db/postgresql/files/postgresql.init-9.2 | 153 ++++++++++++ |
23 |
dev-db/postgresql/files/postgresql.init-9.3-r1 | 158 ++++++++++++ |
24 |
...sql-9999.ebuild => postgresql-9.2.20-r1.ebuild} | 239 +++++++++++------- |
25 |
...sql-9999.ebuild => postgresql-9.3.16-r1.ebuild} | 236 +++++++++++------- |
26 |
...sql-9999.ebuild => postgresql-9.4.11-r1.ebuild} | 272 +++++++++++++------- |
27 |
...esql-9999.ebuild => postgresql-9.5.6-r1.ebuild} | 276 ++++++++++++++------- |
28 |
...esql-9999.ebuild => postgresql-9.6.2-r1.ebuild} | 273 +++++++++++++------- |
29 |
dev-db/postgresql/postgresql-9999.ebuild | 101 +++++--- |
30 |
10 files changed, 1338 insertions(+), 500 deletions(-) |
31 |
|
32 |
diff --git a/dev-db/postgresql/files/postgresql.confd-9.2 b/dev-db/postgresql/files/postgresql.confd-9.2 |
33 |
new file mode 100644 |
34 |
index 00000000000..7753eeae3a8 |
35 |
--- /dev/null |
36 |
+++ b/dev-db/postgresql/files/postgresql.confd-9.2 |
37 |
@@ -0,0 +1,65 @@ |
38 |
+# Directory that contains the unix socket. Created and controlled by |
39 |
+# the related initscript. The directory created will be owned |
40 |
+# root:postgres with mode 1775. |
41 |
+# |
42 |
+# /run/postgresql is the default directory. |
43 |
+PG_SOCKET_DIRECTORY="/run/postgresql" |
44 |
+ |
45 |
+# Which port and socket to bind PostgreSQL |
46 |
+PGPORT="5432" |
47 |
+ |
48 |
+# How long to wait for server to start in seconds |
49 |
+START_TIMEOUT=10 |
50 |
+ |
51 |
+# NICE_QUIT ignores new connections and wait for clients to disconnect from |
52 |
+# server before shutting down. NICE_TIMEOUT in seconds determines how long to |
53 |
+# wait for this to succeed. |
54 |
+NICE_TIMEOUT=60 |
55 |
+ |
56 |
+# Forecfully disconnect clients from server and shut down. This is performed |
57 |
+# after NICE_QUIT. Terminated client connections have their open transactions |
58 |
+# rolled back. |
59 |
+# Set RUDE_QUIT to "NO" to disable. RUDE_TIMEOUT in seconds. |
60 |
+RUDE_QUIT="YES" |
61 |
+RUDE_TIMEOUT=30 |
62 |
+ |
63 |
+# If the server still fails to shutdown, you can force it to quit by setting |
64 |
+# this to YES and a recover-run will execute on the next startup. |
65 |
+# Set FORCE_QUIT to "YES" to enable. FORCE_TIMEOUT in seconds. |
66 |
+FORCE_QUIT="NO" |
67 |
+FORCE_TIMEOUT=2 |
68 |
+ |
69 |
+# Extra options to run postmaster with, e.g.: |
70 |
+# -N is the maximal number of client connections |
71 |
+# -B is the number of shared buffers and has to be at least 2x the value for -N |
72 |
+# Please read the man-page to postmaster for more options. Many of these |
73 |
+# options can be set directly in the configuration file. |
74 |
+#PGOPTS="-N 512 -B 1024" |
75 |
+ |
76 |
+# Pass extra environment variables. If you have to export environment variables |
77 |
+# for the database process, this can be done here. |
78 |
+# Don't forget to escape quotes. |
79 |
+#PG_EXTRA_ENV="PGPASSFILE=\"/path/to/.pgpass\"" |
80 |
+ |
81 |
+############################################################################## |
82 |
+# |
83 |
+# The following values should not be arbitrarily changed. |
84 |
+# |
85 |
+# `emerge --config dev-db/postgresql:@SLOT@' uses these values to |
86 |
+# determine where to create the data directory, where to place the |
87 |
+# configuration files, and any additional options to pass to initdb. |
88 |
+# |
89 |
+# The initscript also uses these variables to inform PostgreSQL where to find |
90 |
+# its data directory and configuration files. |
91 |
+# |
92 |
+############################################################################## |
93 |
+ |
94 |
+# Location of configuration files |
95 |
+PGDATA="/etc/postgresql-@SLOT@/" |
96 |
+ |
97 |
+# Where the data directory is located/to be created |
98 |
+DATA_DIR="/var/lib/postgresql/@SLOT@/data" |
99 |
+ |
100 |
+# Additional options to pass to initdb. |
101 |
+# See `man initdb' for available options. |
102 |
+PG_INITDB_OPTS="--encoding=UTF8" |
103 |
|
104 |
diff --git a/dev-db/postgresql/files/postgresql.confd-9.3 b/dev-db/postgresql/files/postgresql.confd-9.3 |
105 |
new file mode 100644 |
106 |
index 00000000000..8b6d2a09728 |
107 |
--- /dev/null |
108 |
+++ b/dev-db/postgresql/files/postgresql.confd-9.3 |
109 |
@@ -0,0 +1,65 @@ |
110 |
+# Comma-separated list of directories that contain a unix |
111 |
+# socket. Created and controlled by the related initscript. The |
112 |
+# directories created will be owned root:postgres with mode 1775. |
113 |
+# |
114 |
+# /run/postgresql is the default directory. |
115 |
+PG_SOCKET_DIRECTORIES="/run/postgresql" |
116 |
+ |
117 |
+# Which port and socket to bind PostgreSQL |
118 |
+PGPORT="5432" |
119 |
+ |
120 |
+# How long to wait for server to start in seconds |
121 |
+START_TIMEOUT=10 |
122 |
+ |
123 |
+# NICE_QUIT ignores new connections and wait for clients to disconnect from |
124 |
+# server before shutting down. NICE_TIMEOUT in seconds determines how long to |
125 |
+# wait for this to succeed. |
126 |
+NICE_TIMEOUT=60 |
127 |
+ |
128 |
+# Forecfully disconnect clients from server and shut down. This is performed |
129 |
+# after NICE_QUIT. Terminated client connections have their open transactions |
130 |
+# rolled back. |
131 |
+# Set RUDE_QUIT to "NO" to disable. RUDE_TIMEOUT in seconds. |
132 |
+RUDE_QUIT="YES" |
133 |
+RUDE_TIMEOUT=30 |
134 |
+ |
135 |
+# If the server still fails to shutdown, you can force it to quit by setting |
136 |
+# this to YES and a recover-run will execute on the next startup. |
137 |
+# Set FORCE_QUIT to "YES" to enable. FORCE_TIMEOUT in seconds. |
138 |
+FORCE_QUIT="NO" |
139 |
+FORCE_TIMEOUT=2 |
140 |
+ |
141 |
+# Extra options to run postmaster with, e.g.: |
142 |
+# -N is the maximal number of client connections |
143 |
+# -B is the number of shared buffers and has to be at least 2x the value for -N |
144 |
+# Please read the man-page to postmaster for more options. Many of these |
145 |
+# options can be set directly in the configuration file. |
146 |
+#PGOPTS="-N 512 -B 1024" |
147 |
+ |
148 |
+# Pass extra environment variables. If you have to export environment variables |
149 |
+# for the database process, this can be done here. |
150 |
+# Don't forget to escape quotes. |
151 |
+#PG_EXTRA_ENV="PGPASSFILE=\"/path/to/.pgpass\"" |
152 |
+ |
153 |
+############################################################################## |
154 |
+# |
155 |
+# The following values should not be arbitrarily changed. |
156 |
+# |
157 |
+# `emerge --config dev-db/postgresql:@SLOT@' uses these values to |
158 |
+# determine where to create the data directory, where to place the |
159 |
+# configuration files, and any additional options to pass to initdb. |
160 |
+# |
161 |
+# The initscript also uses these variables to inform PostgreSQL where to find |
162 |
+# its data directory and configuration files. |
163 |
+# |
164 |
+############################################################################## |
165 |
+ |
166 |
+# Location of configuration files |
167 |
+PGDATA="/etc/postgresql-@SLOT@/" |
168 |
+ |
169 |
+# Where the data directory is located/to be created |
170 |
+DATA_DIR="/var/lib/postgresql/@SLOT@/data" |
171 |
+ |
172 |
+# Additional options to pass to initdb. |
173 |
+# See `man initdb' for available options. |
174 |
+PG_INITDB_OPTS="--encoding=UTF8" |
175 |
|
176 |
diff --git a/dev-db/postgresql/files/postgresql.init-9.2 b/dev-db/postgresql/files/postgresql.init-9.2 |
177 |
new file mode 100755 |
178 |
index 00000000000..0b257049008 |
179 |
--- /dev/null |
180 |
+++ b/dev-db/postgresql/files/postgresql.init-9.2 |
181 |
@@ -0,0 +1,153 @@ |
182 |
+#!/sbin/openrc-run |
183 |
+# Copyright 1999-2017 Gentoo Foundation |
184 |
+# Distributed under the terms of the GNU General Public License v2 |
185 |
+# $Id$ |
186 |
+ |
187 |
+extra_started_commands="reload promote" |
188 |
+ |
189 |
+PG_CTL="/usr/@LIBDIR@/postgresql-@SLOT@/bin/pg_ctl" |
190 |
+ |
191 |
+description="PostgreSQL @SLOT@ -- the world's most advanced open source database -- |
192 |
+${RC_SERVICE} is a wrapper around pg_ctl with additional administrative checks |
193 |
+and convenience" |
194 |
+ |
195 |
+get_config() { |
196 |
+ [ -f "${PGDATA%/}/postgresql.conf" ] || return 1 |
197 |
+ |
198 |
+ eval echo $(sed -e 's:#.*::' "${PGDATA%/}/postgresql.conf" \ |
199 |
+ | awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }') |
200 |
+} |
201 |
+ |
202 |
+depend() { |
203 |
+ use net |
204 |
+ provide postgresql |
205 |
+ |
206 |
+ if [ "$(get_config log_destination)" = "syslog" ]; then |
207 |
+ use logger |
208 |
+ fi |
209 |
+} |
210 |
+ |
211 |
+configured_port=$(get_config port) |
212 |
+: ${configured_port:=${PGPORT}} |
213 |
+ |
214 |
+checkconfig() { |
215 |
+ # Check that DATA_DIR has been set |
216 |
+ if [ -z "${DATA_DIR}" ] ; then |
217 |
+ eerror "DATA_DIR not set" |
218 |
+ eerror "HINT: Perhaps you need to update /etc/conf.d/postgresql-@SLOT@" |
219 |
+ return 1 |
220 |
+ fi |
221 |
+ |
222 |
+ # Check that DATA_DIR exists |
223 |
+ if [ ! -d "${DATA_DIR}" ] ; then |
224 |
+ eerror "Directory not found: ${DATA_DIR}" |
225 |
+ eerror "HINT: Ensure that DATA_DIR points to the right path." |
226 |
+ eerror "HINT: Or perhaps you need to create the database cluster:" |
227 |
+ eerror " emerge --config dev-db/postgresql:@SLOT@" |
228 |
+ return 1 |
229 |
+ fi |
230 |
+ |
231 |
+ # Check for the existence of PostgreSQL's config files, and set the |
232 |
+ # proper mode and ownership. |
233 |
+ # Only three files should be checked as potentially other files |
234 |
+ # may be in PGDATA that should not be touched. |
235 |
+ local file |
236 |
+ for file in postgresql pg_hba pg_ident ; do |
237 |
+ file="${PGDATA%/}/${file}.conf" |
238 |
+ if [ -f "${file}" ] ; then |
239 |
+ checkpath -f -m 0600 -o postgres:postgres "${file}" |
240 |
+ else |
241 |
+ eerror "${file} not found" |
242 |
+ eerror "HINT: mv ${DATA_DIR%/}/*.conf ${PGDATA}" |
243 |
+ return 1 |
244 |
+ fi |
245 |
+ done |
246 |
+ |
247 |
+ # Set the proper permission for the socket path and create it if |
248 |
+ # it doesn't exist. |
249 |
+ checkpath -d -m 1775 -o root:postgres "${PG_SOCKET_DIRECTORY}" |
250 |
+ if [ -e "${PG_SOCKET_DIRECTORY%/}/.s.PGSQL.${configured_port}" ] ; then |
251 |
+ eerror "Socket conflict." |
252 |
+ eerror "A server is already listening on:" |
253 |
+ eerror " ${PG_SOCKET_DIRECTORY%/}/.s.PGSQL.${configured_port}" |
254 |
+ eerror "HINT: Change PGPORT to listen on a different socket." |
255 |
+ return 1 |
256 |
+ fi |
257 |
+} |
258 |
+ |
259 |
+start() { |
260 |
+ checkconfig || return 1 |
261 |
+ |
262 |
+ ebegin "Starting PostgreSQL @SLOT@" |
263 |
+ |
264 |
+ rm -f "${DATA_DIR%/}/postmaster.pid" |
265 |
+ |
266 |
+ su - postgres -c \ |
267 |
+ "PGPORT=${configured_port} ${PG_EXTRA_ENV} ${PG_CTL} start \ |
268 |
+ -s -w -t ${START_TIMEOUT} -l ${DATA_DIR%/}/postmaster.log \ |
269 |
+ -D ${PGDATA} \ |
270 |
+ -o '--data-directory=${DATA_DIR} \ |
271 |
+ --unix-socket-directory=${PG_SOCKET_DIRECTORY} \ |
272 |
+ ${PGOPTS}'" |
273 |
+ |
274 |
+ local retval=$? |
275 |
+ |
276 |
+ if [ $retval -ne 0 ] ; then |
277 |
+ eerror "Check the log for a possible explanation of the above error." |
278 |
+ eerror "The log may be located at:" |
279 |
+ eerror " ${DATA_DIR%/}/postmaster.log" |
280 |
+ eerror "Or wherever you configured PostgreSQL @SLOT@ to log." |
281 |
+ fi |
282 |
+ |
283 |
+ eend $retval |
284 |
+} |
285 |
+ |
286 |
+stop() { |
287 |
+ local seconds=$(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} )) |
288 |
+ ebegin "Stopping PostgreSQL @SLOT@ (this can take up to ${seconds} seconds)" |
289 |
+ |
290 |
+ su - postgres -c \ |
291 |
+ "${PG_CTL} stop -t ${NICE_TIMEOUT} -s -D ${DATA_DIR} -m smart" |
292 |
+ local retval=$? |
293 |
+ |
294 |
+ if [ "${RUDE_QUIT}" != "NO" -a ${retval} -ne 0 ] ; then |
295 |
+ einfo "Previous attempt failed. Trying RUDE_QUIT." |
296 |
+ su - postgres -c \ |
297 |
+ "${PG_CTL} stop -t ${RUDE_TIMEOUT} -s -D ${DATA_DIR} -m fast" |
298 |
+ retval=$? |
299 |
+ fi |
300 |
+ |
301 |
+ if [ "${FORCE_QUIT}" = "YES" -a ${retval} -ne 0 ] ; then |
302 |
+ einfo "Previous step failed. Trying FORCE_QUIT." |
303 |
+ ewarn "A recover-run might be executed on next startup." |
304 |
+ su - postgres -c \ |
305 |
+ "${PG_CTL} stop -t ${FORCE_TIMEOUT} -s -D ${DATA_DIR} -m immediate" |
306 |
+ retval=$? |
307 |
+ fi |
308 |
+ |
309 |
+ eend ${retval} |
310 |
+} |
311 |
+ |
312 |
+status() { |
313 |
+ ebegin "Checking PostgreSQL @SLOT@ status" |
314 |
+ su - postgres -c "${PG_CTL} status -D ${DATA_DIR}" |
315 |
+ eend $? |
316 |
+} |
317 |
+ |
318 |
+description_reload="Simply sends the postgres process a SIGHUP signal, causing |
319 |
+ it to reread its configuration files (postgresql.conf, pg_hba.conf, |
320 |
+ etc.). This allows changing of configuration-file options that do not |
321 |
+ require a complete restart to take effect." |
322 |
+reload() { |
323 |
+ ebegin "Reloading PostgreSQL @SLOT@ configuration" |
324 |
+ su - postgres -c "${PG_CTL} reload -s -D ${DATA_DIR}" |
325 |
+ eend $? |
326 |
+} |
327 |
+ |
328 |
+description_promote="If the server is in standby, it is commanded to exit |
329 |
+ recovery and begin read-write operations." |
330 |
+promote() { |
331 |
+ ebegin "Promoting PostgreSQL @SLOT@" |
332 |
+ su - postgres -c "${PG_CTL} promote -s -D ${DATA_DIR}" |
333 |
+ eend $? |
334 |
+} |
335 |
|
336 |
diff --git a/dev-db/postgresql/files/postgresql.init-9.3-r1 b/dev-db/postgresql/files/postgresql.init-9.3-r1 |
337 |
new file mode 100755 |
338 |
index 00000000000..b7a08990bf6 |
339 |
--- /dev/null |
340 |
+++ b/dev-db/postgresql/files/postgresql.init-9.3-r1 |
341 |
@@ -0,0 +1,158 @@ |
342 |
+#!/sbin/openrc-run |
343 |
+# Copyright 1999-2017 Gentoo Foundation |
344 |
+# Distributed under the terms of the GNU General Public License v2 |
345 |
+# $Id$ |
346 |
+ |
347 |
+extra_started_commands="reload promote" |
348 |
+ |
349 |
+PG_CTL="/usr/@LIBDIR@/postgresql-@SLOT@/bin/pg_ctl" |
350 |
+ |
351 |
+description="PostgreSQL @SLOT@ -- the world's most advanced open source database -- |
352 |
+${RC_SERVICE} is a wrapper around pg_ctl with additional administrative checks |
353 |
+and convenience" |
354 |
+ |
355 |
+get_config() { |
356 |
+ [ -f "${PGDATA%/}/postgresql.conf" ] || return 1 |
357 |
+ |
358 |
+ eval echo $(sed -e 's:#.*::' "${PGDATA%/}/postgresql.conf" \ |
359 |
+ | awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }') |
360 |
+} |
361 |
+ |
362 |
+depend() { |
363 |
+ use net |
364 |
+ provide postgresql |
365 |
+ |
366 |
+ if [ "$(get_config log_destination)" = "syslog" ]; then |
367 |
+ use logger |
368 |
+ fi |
369 |
+} |
370 |
+ |
371 |
+configured_port=$(get_config port) |
372 |
+: ${configured_port:=${PGPORT}} |
373 |
+ |
374 |
+checkconfig() { |
375 |
+ # Check that DATA_DIR has been set |
376 |
+ if [ -z "${DATA_DIR}" ] ; then |
377 |
+ eerror "DATA_DIR not set" |
378 |
+ eerror "HINT: Perhaps you need to update /etc/conf.d/postgresql-@SLOT@" |
379 |
+ return 1 |
380 |
+ fi |
381 |
+ |
382 |
+ # Check that DATA_DIR exists |
383 |
+ if [ ! -d "${DATA_DIR}" ] ; then |
384 |
+ eerror "Directory not found: ${DATA_DIR}" |
385 |
+ eerror "HINT: Ensure that DATA_DIR points to the right path." |
386 |
+ eerror "HINT: Or perhaps you need to create the database cluster:" |
387 |
+ eerror " emerge --config dev-db/postgresql:@SLOT@" |
388 |
+ return 1 |
389 |
+ fi |
390 |
+ |
391 |
+ # Check for the existence of PostgreSQL's config files, and set the |
392 |
+ # proper mode and ownership. |
393 |
+ # Only three files should be checked as potentially other files |
394 |
+ # may be in PGDATA that should not be touched. |
395 |
+ local file |
396 |
+ for file in postgresql pg_hba pg_ident ; do |
397 |
+ file="${PGDATA%/}/${file}.conf" |
398 |
+ if [ -f "${file}" ] ; then |
399 |
+ checkpath -f -m 0600 -o postgres:postgres "${file}" |
400 |
+ else |
401 |
+ eerror "${file} not found" |
402 |
+ eerror "HINT: mv ${DATA_DIR%/}/*.conf ${PGDATA}" |
403 |
+ return 1 |
404 |
+ fi |
405 |
+ done |
406 |
+ |
407 |
+ # Set the proper permission for the socket paths and create it if |
408 |
+ # it doesn't exist. |
409 |
+ set -f; IFS=',' |
410 |
+ local s |
411 |
+ for s in ${PG_SOCKET_DIRECTORIES}; do |
412 |
+ checkpath -d -m 1775 -o root:postgres "${s}" |
413 |
+ if [ -e "${s%/}/.s.PGSQL.${configured_port}" ] ; then |
414 |
+ eerror "Socket conflict." |
415 |
+ eerror "A server is already listening on:" |
416 |
+ eerror " ${s%/}/.s.PGSQL.${configured_port}" |
417 |
+ eerror "HINT: Change PGPORT to listen on a different socket." |
418 |
+ return 1 |
419 |
+ fi |
420 |
+ done |
421 |
+ set +f; unset IFS |
422 |
+} |
423 |
+ |
424 |
+start() { |
425 |
+ checkconfig || return 1 |
426 |
+ |
427 |
+ ebegin "Starting PostgreSQL @SLOT@" |
428 |
+ |
429 |
+ rm -f "${DATA_DIR%/}/postmaster.pid" |
430 |
+ |
431 |
+ su - postgres -c \ |
432 |
+ "PGPORT=${configured_port} ${PG_EXTRA_ENV} ${PG_CTL} start \ |
433 |
+ -s -w -t ${START_TIMEOUT} -l ${DATA_DIR%/}/postmaster.log \ |
434 |
+ -D ${PGDATA} \ |
435 |
+ -o '--data-directory=${DATA_DIR} \ |
436 |
+ --unix-socket-directories=${PG_SOCKET_DIRECTORIES} \ |
437 |
+ ${PGOPTS}'" |
438 |
+ |
439 |
+ local retval=$? |
440 |
+ |
441 |
+ if [ $retval -ne 0 ] ; then |
442 |
+ eerror "Check the log for a possible explanation of the above error." |
443 |
+ eerror "The log may be located at:" |
444 |
+ eerror " ${DATA_DIR%/}/postmaster.log" |
445 |
+ eerror "Or wherever you configured PostgreSQL @SLOT@ to log." |
446 |
+ fi |
447 |
+ |
448 |
+ eend $retval |
449 |
+} |
450 |
+ |
451 |
+stop() { |
452 |
+ local seconds=$(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} )) |
453 |
+ ebegin "Stopping PostgreSQL @SLOT@ (this can take up to ${seconds} seconds)" |
454 |
+ |
455 |
+ su - postgres -c \ |
456 |
+ "${PG_CTL} stop -t ${NICE_TIMEOUT} -s -D ${DATA_DIR} -m smart" |
457 |
+ local retval=$? |
458 |
+ |
459 |
+ if [ "${RUDE_QUIT}" != "NO" -a ${retval} -ne 0 ] ; then |
460 |
+ einfo "Previous attempt failed. Trying RUDE_QUIT." |
461 |
+ su - postgres -c \ |
462 |
+ "${PG_CTL} stop -t ${RUDE_TIMEOUT} -s -D ${DATA_DIR} -m fast" |
463 |
+ retval=$? |
464 |
+ fi |
465 |
+ |
466 |
+ if [ "${FORCE_QUIT}" = "YES" -a ${retval} -ne 0 ] ; then |
467 |
+ einfo "Previous step failed. Trying FORCE_QUIT." |
468 |
+ ewarn "A recover-run might be executed on next startup." |
469 |
+ su - postgres -c \ |
470 |
+ "${PG_CTL} stop -t ${FORCE_TIMEOUT} -s -D ${DATA_DIR} -m immediate" |
471 |
+ retval=$? |
472 |
+ fi |
473 |
+ |
474 |
+ eend ${retval} |
475 |
+} |
476 |
+ |
477 |
+status() { |
478 |
+ ebegin "Checking PostgreSQL @SLOT@ status" |
479 |
+ su - postgres -c "${PG_CTL} status -D ${DATA_DIR}" |
480 |
+ eend $? |
481 |
+} |
482 |
+ |
483 |
+description_reload="Simply sends the postgres process a SIGHUP signal, causing |
484 |
+ it to reread its configuration files (postgresql.conf, pg_hba.conf, |
485 |
+ etc.). This allows changing of configuration-file options that do not |
486 |
+ require a complete restart to take effect." |
487 |
+reload() { |
488 |
+ ebegin "Reloading PostgreSQL @SLOT@ configuration" |
489 |
+ su - postgres -c "${PG_CTL} reload -s -D ${DATA_DIR}" |
490 |
+ eend $? |
491 |
+} |
492 |
+ |
493 |
+description_promote="If the server is in standby, it is commanded to exit |
494 |
+ recovery and begin read-write operations." |
495 |
+promote() { |
496 |
+ ebegin "Promoting PostgreSQL @SLOT@" |
497 |
+ su - postgres -c "${PG_CTL} promote -s -D ${DATA_DIR}" |
498 |
+ eend $? |
499 |
+} |
500 |
|
501 |
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.2.20-r1.ebuild |
502 |
similarity index 58% |
503 |
copy from dev-db/postgresql/postgresql-9999.ebuild |
504 |
copy to dev-db/postgresql/postgresql-9.2.20-r1.ebuild |
505 |
index 6a995c154ba..09d00f4a78a 100644 |
506 |
--- a/dev-db/postgresql/postgresql-9999.ebuild |
507 |
+++ b/dev-db/postgresql/postgresql-9.2.20-r1.ebuild |
508 |
@@ -3,17 +3,16 @@ |
509 |
|
510 |
EAPI="5" |
511 |
|
512 |
-PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) |
513 |
+PYTHON_COMPAT=( python{2_7,3_4} ) |
514 |
|
515 |
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \ |
516 |
- python-single-r1 systemd user versionator |
517 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
518 |
+ systemd user versionator |
519 |
|
520 |
-KEYWORDS="" |
521 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
522 |
|
523 |
-# Fix if needed |
524 |
-SLOT="9.7" |
525 |
+SLOT="$(get_version_component_range 1-2)" |
526 |
|
527 |
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git" |
528 |
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
529 |
|
530 |
LICENSE="POSTGRESQL GPL-2" |
531 |
DESCRIPTION="PostgreSQL RDBMS" |
532 |
@@ -21,7 +20,7 @@ HOMEPAGE="http://www.postgresql.org/" |
533 |
|
534 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
535 |
zh_CN zh_TW" |
536 |
-IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
537 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
538 |
+readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
539 |
|
540 |
for lingua in ${LINGUAS}; do |
541 |
@@ -39,7 +38,7 @@ wanted_languages() { |
542 |
} |
543 |
|
544 |
CDEPEND=" |
545 |
->=app-eselect/eselect-postgresql-1.2.0 |
546 |
+>=app-eselect/eselect-postgresql-2.0 |
547 |
sys-apps/less |
548 |
virtual/libintl |
549 |
kerberos? ( virtual/krb5 ) |
550 |
@@ -60,23 +59,11 @@ zlib? ( sys-libs/zlib ) |
551 |
|
552 |
DEPEND="${CDEPEND} |
553 |
!!<sys-apps/sandbox-2.0 |
554 |
->=dev-lang/perl-5.8 |
555 |
-app-text/docbook-dsssl-stylesheets |
556 |
-app-text/docbook-sgml-dtd:4.2 |
557 |
-app-text/docbook-xml-dtd:4.2 |
558 |
-app-text/docbook-xsl-stylesheets |
559 |
-app-text/openjade |
560 |
-dev-libs/libxml2 |
561 |
-dev-libs/libxslt |
562 |
sys-devel/bison |
563 |
sys-devel/flex |
564 |
nls? ( sys-devel/gettext ) |
565 |
xml? ( virtual/pkgconfig ) |
566 |
" |
567 |
-src_unpack() { |
568 |
- base_src_unpack |
569 |
- git-2_src_unpack |
570 |
-} |
571 |
|
572 |
RDEPEND="${CDEPEND} |
573 |
!dev-db/postgresql-docs:${SLOT} |
574 |
@@ -85,17 +72,8 @@ RDEPEND="${CDEPEND} |
575 |
selinux? ( sec-policy/selinux-postgresql ) |
576 |
" |
577 |
|
578 |
-pkg_pretend() { |
579 |
- ewarn "You are using a live ebuild that uses the current source code as it is" |
580 |
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such," |
581 |
- ewarn "the GNU Makefiles may be altered by upstream without notice and the" |
582 |
- ewarn "documentation for this live version is not readily available" |
583 |
- ewarn "online. Ergo, the ebuild maintainers will not support building a" |
584 |
- ewarn "client-only and/or document-free version." |
585 |
-} |
586 |
- |
587 |
pkg_setup() { |
588 |
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
589 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
590 |
|
591 |
enewgroup postgres 70 |
592 |
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
593 |
@@ -111,10 +89,11 @@ src_prepare() { |
594 |
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
595 |
-i src/include/pg_config_manual.h || die |
596 |
|
597 |
- # Rely on $PATH being in the proper order so that the correct |
598 |
- # install program is used for modules utilizing PGXS in both |
599 |
- # hardened and non-hardened environments. (Bug #528786) |
600 |
- sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
601 |
+ use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
602 |
+ |
603 |
+ # Fix bug 486556 where the server would crash at start up because of |
604 |
+ # an infinite loop caused by a self-referencing symlink. |
605 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
606 |
|
607 |
if use pam ; then |
608 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
609 |
@@ -148,6 +127,7 @@ src_configure() { |
610 |
$(use_enable !pg_legacytimestamp integer-datetimes) \ |
611 |
$(use_enable threads thread-safety) \ |
612 |
$(use_with kerberos gssapi) \ |
613 |
+ $(use_with kerberos krb5) \ |
614 |
$(use_with ldap) \ |
615 |
$(use_with pam) \ |
616 |
$(use_with perl) \ |
617 |
@@ -163,78 +143,150 @@ src_configure() { |
618 |
} |
619 |
|
620 |
src_compile() { |
621 |
- emake world |
622 |
+ emake |
623 |
+ emake -C contrib |
624 |
} |
625 |
|
626 |
src_install() { |
627 |
- emake DESTDIR="${D}" install-world |
628 |
+ emake DESTDIR="${D}" install |
629 |
+ emake DESTDIR="${D}" install -C contrib |
630 |
|
631 |
dodoc README HISTORY doc/{TODO,bug.template} |
632 |
|
633 |
+ # man pages are already built, but if we have the target make them, |
634 |
+ # they'll be generated from source before being installed so we |
635 |
+ # manually install man pages. |
636 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
637 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
638 |
+ doins -r doc/src/sgml/man{1,3,7} |
639 |
+ if ! use server; then |
640 |
+ # Remove man pages for non-existent binaries |
641 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
642 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
643 |
+ done |
644 |
+ fi |
645 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
646 |
+ |
647 |
insinto /etc/postgresql-${SLOT} |
648 |
newins src/bin/psql/psqlrc.sample psqlrc |
649 |
|
650 |
- dodir /etc/eselect/postgresql/slots/${SLOT} |
651 |
- echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
652 |
- "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
653 |
- |
654 |
use static-libs || find "${ED}" -name '*.a' -delete |
655 |
|
656 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
657 |
- "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
658 |
+ local f bn |
659 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
660 |
+ -mindepth 1 -maxdepth 1) |
661 |
+ do |
662 |
+ bn=$(basename "${f}") |
663 |
+ # Temporarily tack on tmp to workaround a file collision |
664 |
+ # issue. This is only necessary for 9.7 and earlier. 10 never |
665 |
+ # had this issue. |
666 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
667 |
+ "/usr/bin/${bn}${SLOT/.}tmp" |
668 |
+ done |
669 |
|
670 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
671 |
- "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
672 |
+ local linkname mansec |
673 |
+ for mansec in {1,3,7} ; do |
674 |
+ for f in "${ED}"/usr/share/postgresql-${SLOT}/man/man${mansec}/* ; do |
675 |
+ bn=$(basename "${f}") |
676 |
+ linkname=${bn/%.${mansec}/${SLOT/.}.${mansec}} |
677 |
+ dosym ../../postgresql-${SLOT}/man/man${mansec}/$bn \ |
678 |
+ /usr/share/man/man${mansec}/${linkname} |
679 |
+ done |
680 |
+ done |
681 |
|
682 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
683 |
- "${FILESDIR}/${PN}.service" | \ |
684 |
- systemd_newunit - ${PN}-${SLOT}.service |
685 |
+ if use doc ; then |
686 |
+ docinto html |
687 |
+ dodoc doc/src/sgml/html/* |
688 |
|
689 |
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
690 |
+ docinto sgml |
691 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
692 |
+ fi |
693 |
|
694 |
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
695 |
+ if use server; then |
696 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
697 |
+ "${FILESDIR}/${PN}.confd-9.2" | newconfd - ${PN}-${SLOT} |
698 |
|
699 |
- if use prefix ; then |
700 |
- keepdir /run/postgresql |
701 |
- fperms 0775 /run/postgresql |
702 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
703 |
+ "${FILESDIR}/${PN}.init-9.2" | newinitd - ${PN}-${SLOT} |
704 |
+ |
705 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
706 |
+ "${FILESDIR}/${PN}.service" | \ |
707 |
+ systemd_newunit - ${PN}-${SLOT}.service |
708 |
+ |
709 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
710 |
+ |
711 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
712 |
+ |
713 |
+ if use prefix ; then |
714 |
+ keepdir /run/postgresql |
715 |
+ fperms 0775 /run/postgresql |
716 |
+ fi |
717 |
fi |
718 |
} |
719 |
|
720 |
+pkg_preinst() { |
721 |
+ # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., |
722 |
+ # /usr/bin/psql96). They may have been created by the |
723 |
+ # postgresql.eselect module, but they're handled within this ebuild |
724 |
+ # now. It's alright if we momentarily delete /usr/bin/psql as it |
725 |
+ # will be recreated by the eselect module in pkg_ppostinst(). This |
726 |
+ # is only necessary for 9.7 and earlier. 10 and later were never |
727 |
+ # handled in this manner. |
728 |
+ local canonicalise |
729 |
+ if type -p realpath > /dev/null; then |
730 |
+ canonicalise=realpath |
731 |
+ elif type -p readlink > /dev/null; then |
732 |
+ canonicalise='readlink -f' |
733 |
+ else |
734 |
+ # can't die, subshell |
735 |
+ die "No readlink nor realpath found, cannot canonicalise" |
736 |
+ fi |
737 |
+ |
738 |
+ local l |
739 |
+ # First remove any symlinks in /usr/bin that may have been created |
740 |
+ # by the old eselect |
741 |
+ for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do |
742 |
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then |
743 |
+ rm "${l}" || ewarn "Couldn't remove ${l}" |
744 |
+ fi |
745 |
+ done |
746 |
+ |
747 |
+ # Then move the symlinks created by the ebuild to their proper place. |
748 |
+ for l in "${ED}"/usr/bin/*tmp ; do |
749 |
+ mv "${l}" "${l%tmp}" \ |
750 |
+ || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" |
751 |
+ done |
752 |
+} |
753 |
+ |
754 |
pkg_postinst() { |
755 |
postgresql-config update |
756 |
|
757 |
elog "If you need a global psqlrc-file, you can place it in:" |
758 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
759 |
|
760 |
- if [[ -z ${REPLACING_VERSIONS} ]] ; then |
761 |
+ if use server ; then |
762 |
+ elog |
763 |
+ elog "Gentoo specific documentation:" |
764 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
765 |
+ elog |
766 |
+ elog "Official documentation:" |
767 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
768 |
+ elog |
769 |
+ elog "The default location of the Unix-domain socket is:" |
770 |
+ elog " ${EROOT%/}/run/postgresql/" |
771 |
elog |
772 |
- elog "It looks like this is your first time installing PostgreSQL. Run the" |
773 |
- elog "following command in all active shells to pick up changes to the default" |
774 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
775 |
+ elog "so that it contains your preferred locale in:" |
776 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
777 |
+ elog |
778 |
+ elog "Then, execute the following command to setup the initial database" |
779 |
elog "environment:" |
780 |
- elog " source /etc/profile" |
781 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
782 |
fi |
783 |
- |
784 |
- elog |
785 |
- elog "Gentoo specific documentation:" |
786 |
- elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
787 |
- elog |
788 |
- elog "Official documentation:" |
789 |
- elog "${EROOT%/}/usr/share/doc/${PF}/html" |
790 |
- elog |
791 |
- elog "The default location of the Unix-domain socket is:" |
792 |
- elog " ${EROOT%/}/run/postgresql/" |
793 |
- elog |
794 |
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
795 |
- elog "so that it contains your preferred locale, and other options, in:" |
796 |
- elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
797 |
- elog |
798 |
- elog "Then, execute the following command to setup the initial database" |
799 |
- elog "environment:" |
800 |
- elog " emerge --config =${CATEGORY}/${PF}" |
801 |
} |
802 |
|
803 |
pkg_prerm() { |
804 |
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then |
805 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
806 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
807 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
808 |
|
809 |
@@ -249,6 +301,8 @@ pkg_postrm() { |
810 |
} |
811 |
|
812 |
pkg_config() { |
813 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
814 |
+ |
815 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
816 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
817 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
818 |
@@ -297,21 +351,10 @@ pkg_config() { |
819 |
einfo "The database cluster will be created in:" |
820 |
einfo " ${DATA_DIR}" |
821 |
einfo |
822 |
- if [ -z "$PG_AUTOCONFIG" ] ; then |
823 |
- while [ "$correct" != "true" ] ; do |
824 |
- einfo "Are you ready to continue? (y/n)" |
825 |
- read answer |
826 |
- if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
827 |
- correct="true" |
828 |
- elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
829 |
- die "Aborting initialization." |
830 |
- else |
831 |
- echo "Answer not recognized" |
832 |
- fi |
833 |
- done |
834 |
- else |
835 |
- einfo "PG_AUTOCONFIG set, not prompting" |
836 |
- fi |
837 |
+ |
838 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
839 |
+ sleep 5 |
840 |
+ eend 0 |
841 |
|
842 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
843 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
844 |
@@ -339,6 +382,10 @@ pkg_config() { |
845 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
846 |
fi |
847 |
|
848 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
849 |
+ # overridden in the initscript |
850 |
+ sed '/^#unix_socket_directory/d' -i "${PGDATA%/}"/postgresql.conf |
851 |
+ |
852 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
853 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
854 |
# On the off-chance that you might need to work with UTF-8 encoded |
855 |
@@ -371,17 +418,17 @@ pkg_config() { |
856 |
} |
857 |
|
858 |
src_test() { |
859 |
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
860 |
- |
861 |
- if [[ ${UID} -ne 0 ]] ; then |
862 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
863 |
emake check |
864 |
|
865 |
einfo "If you think other tests besides the regression tests are necessary, please" |
866 |
einfo "submit a bug including a patch for this ebuild to enable them." |
867 |
else |
868 |
+ use server || \ |
869 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
870 |
[[ ${UID} -eq 0 ]] || \ |
871 |
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES." |
872 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
873 |
|
874 |
- ewarn "Skipping." |
875 |
+ ewarn 'Skipping.' |
876 |
fi |
877 |
} |
878 |
|
879 |
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.3.16-r1.ebuild |
880 |
similarity index 59% |
881 |
copy from dev-db/postgresql/postgresql-9999.ebuild |
882 |
copy to dev-db/postgresql/postgresql-9.3.16-r1.ebuild |
883 |
index 6a995c154ba..0055c0e30d9 100644 |
884 |
--- a/dev-db/postgresql/postgresql-9999.ebuild |
885 |
+++ b/dev-db/postgresql/postgresql-9.3.16-r1.ebuild |
886 |
@@ -3,17 +3,16 @@ |
887 |
|
888 |
EAPI="5" |
889 |
|
890 |
-PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) |
891 |
+PYTHON_COMPAT=( python{2_7,3_4} ) |
892 |
|
893 |
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \ |
894 |
- python-single-r1 systemd user versionator |
895 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
896 |
+ systemd user versionator |
897 |
|
898 |
-KEYWORDS="" |
899 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
900 |
|
901 |
-# Fix if needed |
902 |
-SLOT="9.7" |
903 |
+SLOT="$(get_version_component_range 1-2)" |
904 |
|
905 |
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git" |
906 |
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
907 |
|
908 |
LICENSE="POSTGRESQL GPL-2" |
909 |
DESCRIPTION="PostgreSQL RDBMS" |
910 |
@@ -21,7 +20,7 @@ HOMEPAGE="http://www.postgresql.org/" |
911 |
|
912 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
913 |
zh_CN zh_TW" |
914 |
-IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
915 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
916 |
+readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
917 |
|
918 |
for lingua in ${LINGUAS}; do |
919 |
@@ -39,7 +38,7 @@ wanted_languages() { |
920 |
} |
921 |
|
922 |
CDEPEND=" |
923 |
->=app-eselect/eselect-postgresql-1.2.0 |
924 |
+>=app-eselect/eselect-postgresql-2.0 |
925 |
sys-apps/less |
926 |
virtual/libintl |
927 |
kerberos? ( virtual/krb5 ) |
928 |
@@ -60,23 +59,11 @@ zlib? ( sys-libs/zlib ) |
929 |
|
930 |
DEPEND="${CDEPEND} |
931 |
!!<sys-apps/sandbox-2.0 |
932 |
->=dev-lang/perl-5.8 |
933 |
-app-text/docbook-dsssl-stylesheets |
934 |
-app-text/docbook-sgml-dtd:4.2 |
935 |
-app-text/docbook-xml-dtd:4.2 |
936 |
-app-text/docbook-xsl-stylesheets |
937 |
-app-text/openjade |
938 |
-dev-libs/libxml2 |
939 |
-dev-libs/libxslt |
940 |
sys-devel/bison |
941 |
sys-devel/flex |
942 |
nls? ( sys-devel/gettext ) |
943 |
xml? ( virtual/pkgconfig ) |
944 |
" |
945 |
-src_unpack() { |
946 |
- base_src_unpack |
947 |
- git-2_src_unpack |
948 |
-} |
949 |
|
950 |
RDEPEND="${CDEPEND} |
951 |
!dev-db/postgresql-docs:${SLOT} |
952 |
@@ -85,17 +72,8 @@ RDEPEND="${CDEPEND} |
953 |
selinux? ( sec-policy/selinux-postgresql ) |
954 |
" |
955 |
|
956 |
-pkg_pretend() { |
957 |
- ewarn "You are using a live ebuild that uses the current source code as it is" |
958 |
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such," |
959 |
- ewarn "the GNU Makefiles may be altered by upstream without notice and the" |
960 |
- ewarn "documentation for this live version is not readily available" |
961 |
- ewarn "online. Ergo, the ebuild maintainers will not support building a" |
962 |
- ewarn "client-only and/or document-free version." |
963 |
-} |
964 |
- |
965 |
pkg_setup() { |
966 |
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
967 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
968 |
|
969 |
enewgroup postgres 70 |
970 |
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
971 |
@@ -116,6 +94,12 @@ src_prepare() { |
972 |
# hardened and non-hardened environments. (Bug #528786) |
973 |
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
974 |
|
975 |
+ use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
976 |
+ |
977 |
+ # Fix bug 486556 where the server would crash at start up because of |
978 |
+ # an infinite loop caused by a self-referencing symlink. |
979 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
980 |
+ |
981 |
if use pam ; then |
982 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
983 |
-i src/backend/libpq/auth.c || \ |
984 |
@@ -148,6 +132,7 @@ src_configure() { |
985 |
$(use_enable !pg_legacytimestamp integer-datetimes) \ |
986 |
$(use_enable threads thread-safety) \ |
987 |
$(use_with kerberos gssapi) \ |
988 |
+ $(use_with kerberos krb5) \ |
989 |
$(use_with ldap) \ |
990 |
$(use_with pam) \ |
991 |
$(use_with perl) \ |
992 |
@@ -163,41 +148,119 @@ src_configure() { |
993 |
} |
994 |
|
995 |
src_compile() { |
996 |
- emake world |
997 |
+ emake |
998 |
+ emake -C contrib |
999 |
} |
1000 |
|
1001 |
src_install() { |
1002 |
- emake DESTDIR="${D}" install-world |
1003 |
+ emake DESTDIR="${D}" install |
1004 |
+ emake DESTDIR="${D}" install -C contrib |
1005 |
|
1006 |
dodoc README HISTORY doc/{TODO,bug.template} |
1007 |
|
1008 |
+ # man pages are already built, but if we have the target make them, |
1009 |
+ # they'll be generated from source before being installed so we |
1010 |
+ # manually install man pages. |
1011 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
1012 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
1013 |
+ doins -r doc/src/sgml/man{1,3,7} |
1014 |
+ if ! use server; then |
1015 |
+ # Remove man pages for non-existent binaries |
1016 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
1017 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1018 |
+ done |
1019 |
+ fi |
1020 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1021 |
+ |
1022 |
insinto /etc/postgresql-${SLOT} |
1023 |
newins src/bin/psql/psqlrc.sample psqlrc |
1024 |
|
1025 |
- dodir /etc/eselect/postgresql/slots/${SLOT} |
1026 |
- echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
1027 |
- "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
1028 |
- |
1029 |
use static-libs || find "${ED}" -name '*.a' -delete |
1030 |
|
1031 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1032 |
- "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
1033 |
+ local f bn |
1034 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
1035 |
+ -mindepth 1 -maxdepth 1) |
1036 |
+ do |
1037 |
+ bn=$(basename "${f}") |
1038 |
+ # Temporarily tack on tmp to workaround a file collision |
1039 |
+ # issue. This is only necessary for 9.7 and earlier. 10 never |
1040 |
+ # had this issue. |
1041 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
1042 |
+ "/usr/bin/${bn}${SLOT/.}tmp" |
1043 |
+ done |
1044 |
|
1045 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1046 |
- "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
1047 |
+ local linkname mansec |
1048 |
+ for mansec in {1,3,7} ; do |
1049 |
+ for f in "${ED}"/usr/share/postgresql-${SLOT}/man/man${mansec}/* ; do |
1050 |
+ bn=$(basename "${f}") |
1051 |
+ linkname=${bn/%.${mansec}/${SLOT/.}.${mansec}} |
1052 |
+ dosym ../../postgresql-${SLOT}/man/man${mansec}/$bn \ |
1053 |
+ /usr/share/man/man${mansec}/${linkname} |
1054 |
+ done |
1055 |
+ done |
1056 |
|
1057 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1058 |
- "${FILESDIR}/${PN}.service" | \ |
1059 |
- systemd_newunit - ${PN}-${SLOT}.service |
1060 |
+ if use doc ; then |
1061 |
+ docinto html |
1062 |
+ dodoc doc/src/sgml/html/* |
1063 |
|
1064 |
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1065 |
+ docinto sgml |
1066 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
1067 |
+ fi |
1068 |
|
1069 |
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1070 |
+ if use server; then |
1071 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1072 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
1073 |
|
1074 |
- if use prefix ; then |
1075 |
- keepdir /run/postgresql |
1076 |
- fperms 0775 /run/postgresql |
1077 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1078 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
1079 |
+ |
1080 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1081 |
+ "${FILESDIR}/${PN}.service" | \ |
1082 |
+ systemd_newunit - ${PN}-${SLOT}.service |
1083 |
+ |
1084 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1085 |
+ |
1086 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1087 |
+ |
1088 |
+ if use prefix ; then |
1089 |
+ keepdir /run/postgresql |
1090 |
+ fperms 0775 /run/postgresql |
1091 |
+ fi |
1092 |
+ fi |
1093 |
+} |
1094 |
+ |
1095 |
+pkg_preinst() { |
1096 |
+ # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., |
1097 |
+ # /usr/bin/psql96). They may have been created by the |
1098 |
+ # postgresql.eselect module, but they're handled within this ebuild |
1099 |
+ # now. It's alright if we momentarily delete /usr/bin/psql as it |
1100 |
+ # will be recreated by the eselect module in pkg_ppostinst(). This |
1101 |
+ # is only necessary for 9.7 and earlier. 10 and later were never |
1102 |
+ # handled in this manner. |
1103 |
+ local canonicalise |
1104 |
+ if type -p realpath > /dev/null; then |
1105 |
+ canonicalise=realpath |
1106 |
+ elif type -p readlink > /dev/null; then |
1107 |
+ canonicalise='readlink -f' |
1108 |
+ else |
1109 |
+ # can't die, subshell |
1110 |
+ die "No readlink nor realpath found, cannot canonicalise" |
1111 |
fi |
1112 |
+ |
1113 |
+ local l |
1114 |
+ # First remove any symlinks in /usr/bin that may have been created |
1115 |
+ # by the old eselect |
1116 |
+ for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do |
1117 |
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then |
1118 |
+ rm "${l}" || ewarn "Couldn't remove ${l}" |
1119 |
+ fi |
1120 |
+ done |
1121 |
+ |
1122 |
+ # Then move the symlinks created by the ebuild to their proper place. |
1123 |
+ for l in "${ED}"/usr/bin/*tmp ; do |
1124 |
+ mv "${l}" "${l%tmp}" \ |
1125 |
+ || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" |
1126 |
+ done |
1127 |
} |
1128 |
|
1129 |
pkg_postinst() { |
1130 |
@@ -206,35 +269,29 @@ pkg_postinst() { |
1131 |
elog "If you need a global psqlrc-file, you can place it in:" |
1132 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
1133 |
|
1134 |
- if [[ -z ${REPLACING_VERSIONS} ]] ; then |
1135 |
+ if use server ; then |
1136 |
+ elog |
1137 |
+ elog "Gentoo specific documentation:" |
1138 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1139 |
+ elog |
1140 |
+ elog "Official documentation:" |
1141 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1142 |
+ elog |
1143 |
+ elog "The default location of the Unix-domain socket is:" |
1144 |
+ elog " ${EROOT%/}/run/postgresql/" |
1145 |
elog |
1146 |
- elog "It looks like this is your first time installing PostgreSQL. Run the" |
1147 |
- elog "following command in all active shells to pick up changes to the default" |
1148 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1149 |
+ elog "so that it contains your preferred locale in:" |
1150 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1151 |
+ elog |
1152 |
+ elog "Then, execute the following command to setup the initial database" |
1153 |
elog "environment:" |
1154 |
- elog " source /etc/profile" |
1155 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
1156 |
fi |
1157 |
- |
1158 |
- elog |
1159 |
- elog "Gentoo specific documentation:" |
1160 |
- elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1161 |
- elog |
1162 |
- elog "Official documentation:" |
1163 |
- elog "${EROOT%/}/usr/share/doc/${PF}/html" |
1164 |
- elog |
1165 |
- elog "The default location of the Unix-domain socket is:" |
1166 |
- elog " ${EROOT%/}/run/postgresql/" |
1167 |
- elog |
1168 |
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1169 |
- elog "so that it contains your preferred locale, and other options, in:" |
1170 |
- elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1171 |
- elog |
1172 |
- elog "Then, execute the following command to setup the initial database" |
1173 |
- elog "environment:" |
1174 |
- elog " emerge --config =${CATEGORY}/${PF}" |
1175 |
} |
1176 |
|
1177 |
pkg_prerm() { |
1178 |
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1179 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1180 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1181 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1182 |
|
1183 |
@@ -249,6 +306,8 @@ pkg_postrm() { |
1184 |
} |
1185 |
|
1186 |
pkg_config() { |
1187 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
1188 |
+ |
1189 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1190 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1191 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
1192 |
@@ -297,21 +356,10 @@ pkg_config() { |
1193 |
einfo "The database cluster will be created in:" |
1194 |
einfo " ${DATA_DIR}" |
1195 |
einfo |
1196 |
- if [ -z "$PG_AUTOCONFIG" ] ; then |
1197 |
- while [ "$correct" != "true" ] ; do |
1198 |
- einfo "Are you ready to continue? (y/n)" |
1199 |
- read answer |
1200 |
- if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
1201 |
- correct="true" |
1202 |
- elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
1203 |
- die "Aborting initialization." |
1204 |
- else |
1205 |
- echo "Answer not recognized" |
1206 |
- fi |
1207 |
- done |
1208 |
- else |
1209 |
- einfo "PG_AUTOCONFIG set, not prompting" |
1210 |
- fi |
1211 |
+ |
1212 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
1213 |
+ sleep 5 |
1214 |
+ eend 0 |
1215 |
|
1216 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1217 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
1218 |
@@ -339,6 +387,10 @@ pkg_config() { |
1219 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1220 |
fi |
1221 |
|
1222 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
1223 |
+ # overridden in the initscript |
1224 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
1225 |
+ |
1226 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1227 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1228 |
# On the off-chance that you might need to work with UTF-8 encoded |
1229 |
@@ -371,17 +423,17 @@ pkg_config() { |
1230 |
} |
1231 |
|
1232 |
src_test() { |
1233 |
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
1234 |
- |
1235 |
- if [[ ${UID} -ne 0 ]] ; then |
1236 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
1237 |
emake check |
1238 |
|
1239 |
einfo "If you think other tests besides the regression tests are necessary, please" |
1240 |
einfo "submit a bug including a patch for this ebuild to enable them." |
1241 |
else |
1242 |
+ use server || \ |
1243 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1244 |
[[ ${UID} -eq 0 ]] || \ |
1245 |
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES." |
1246 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1247 |
|
1248 |
- ewarn "Skipping." |
1249 |
+ ewarn 'Skipping.' |
1250 |
fi |
1251 |
} |
1252 |
|
1253 |
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.4.11-r1.ebuild |
1254 |
similarity index 55% |
1255 |
copy from dev-db/postgresql/postgresql-9999.ebuild |
1256 |
copy to dev-db/postgresql/postgresql-9.4.11-r1.ebuild |
1257 |
index 6a995c154ba..538724b3677 100644 |
1258 |
--- a/dev-db/postgresql/postgresql-9999.ebuild |
1259 |
+++ b/dev-db/postgresql/postgresql-9.4.11-r1.ebuild |
1260 |
@@ -3,17 +3,16 @@ |
1261 |
|
1262 |
EAPI="5" |
1263 |
|
1264 |
-PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) |
1265 |
+PYTHON_COMPAT=( python{2_7,3_4} ) |
1266 |
|
1267 |
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \ |
1268 |
- python-single-r1 systemd user versionator |
1269 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
1270 |
+ systemd user versionator |
1271 |
|
1272 |
-KEYWORDS="" |
1273 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
1274 |
|
1275 |
-# Fix if needed |
1276 |
-SLOT="9.7" |
1277 |
+SLOT="$(get_version_component_range 1-2)" |
1278 |
|
1279 |
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git" |
1280 |
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
1281 |
|
1282 |
LICENSE="POSTGRESQL GPL-2" |
1283 |
DESCRIPTION="PostgreSQL RDBMS" |
1284 |
@@ -21,7 +20,7 @@ HOMEPAGE="http://www.postgresql.org/" |
1285 |
|
1286 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
1287 |
zh_CN zh_TW" |
1288 |
-IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
1289 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
1290 |
+readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
1291 |
|
1292 |
for lingua in ${LINGUAS}; do |
1293 |
@@ -39,7 +38,7 @@ wanted_languages() { |
1294 |
} |
1295 |
|
1296 |
CDEPEND=" |
1297 |
->=app-eselect/eselect-postgresql-1.2.0 |
1298 |
+>=app-eselect/eselect-postgresql-2.0 |
1299 |
sys-apps/less |
1300 |
virtual/libintl |
1301 |
kerberos? ( virtual/krb5 ) |
1302 |
@@ -53,30 +52,40 @@ ssl? ( |
1303 |
libressl? ( dev-libs/libressl:= ) |
1304 |
) |
1305 |
tcl? ( >=dev-lang/tcl-8:0= ) |
1306 |
-uuid? ( dev-libs/ossp-uuid ) |
1307 |
xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1308 |
zlib? ( sys-libs/zlib ) |
1309 |
" |
1310 |
|
1311 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1312 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1313 |
+# the libc includes UUID functions. |
1314 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
1315 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
1316 |
+ |
1317 |
+nest_usedep() { |
1318 |
+ local front back |
1319 |
+ while [[ ${#} -gt 1 ]]; do |
1320 |
+ front+="${1}? ( " |
1321 |
+ back+=" )" |
1322 |
+ shift |
1323 |
+ done |
1324 |
+ echo "${front}${1}${back}" |
1325 |
+} |
1326 |
+ |
1327 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
1328 |
+CDEPEND+=" |
1329 |
+uuid? ( |
1330 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1331 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1332 |
+)" |
1333 |
+ |
1334 |
DEPEND="${CDEPEND} |
1335 |
!!<sys-apps/sandbox-2.0 |
1336 |
->=dev-lang/perl-5.8 |
1337 |
-app-text/docbook-dsssl-stylesheets |
1338 |
-app-text/docbook-sgml-dtd:4.2 |
1339 |
-app-text/docbook-xml-dtd:4.2 |
1340 |
-app-text/docbook-xsl-stylesheets |
1341 |
-app-text/openjade |
1342 |
-dev-libs/libxml2 |
1343 |
-dev-libs/libxslt |
1344 |
sys-devel/bison |
1345 |
sys-devel/flex |
1346 |
nls? ( sys-devel/gettext ) |
1347 |
xml? ( virtual/pkgconfig ) |
1348 |
" |
1349 |
-src_unpack() { |
1350 |
- base_src_unpack |
1351 |
- git-2_src_unpack |
1352 |
-} |
1353 |
|
1354 |
RDEPEND="${CDEPEND} |
1355 |
!dev-db/postgresql-docs:${SLOT} |
1356 |
@@ -85,17 +94,8 @@ RDEPEND="${CDEPEND} |
1357 |
selinux? ( sec-policy/selinux-postgresql ) |
1358 |
" |
1359 |
|
1360 |
-pkg_pretend() { |
1361 |
- ewarn "You are using a live ebuild that uses the current source code as it is" |
1362 |
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such," |
1363 |
- ewarn "the GNU Makefiles may be altered by upstream without notice and the" |
1364 |
- ewarn "documentation for this live version is not readily available" |
1365 |
- ewarn "online. Ergo, the ebuild maintainers will not support building a" |
1366 |
- ewarn "client-only and/or document-free version." |
1367 |
-} |
1368 |
- |
1369 |
pkg_setup() { |
1370 |
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1371 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1372 |
|
1373 |
enewgroup postgres 70 |
1374 |
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
1375 |
@@ -116,6 +116,12 @@ src_prepare() { |
1376 |
# hardened and non-hardened environments. (Bug #528786) |
1377 |
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
1378 |
|
1379 |
+ use server || epatch "${FILESDIR}/${PN}-9.4.10-no-server.patch" |
1380 |
+ |
1381 |
+ # Fix bug 486556 where the server would crash at start up because of |
1382 |
+ # an infinite loop caused by a self-referencing symlink. |
1383 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
1384 |
+ |
1385 |
if use pam ; then |
1386 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1387 |
-i src/backend/libpq/auth.c || \ |
1388 |
@@ -137,6 +143,17 @@ src_configure() { |
1389 |
|
1390 |
local PO="${EPREFIX%/}" |
1391 |
|
1392 |
+ local i uuid_config="" |
1393 |
+ if use uuid; then |
1394 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
1395 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
1396 |
+ done |
1397 |
+ for i in ${BSD_LIBC[@]}; do |
1398 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
1399 |
+ done |
1400 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
1401 |
+ fi |
1402 |
+ |
1403 |
econf \ |
1404 |
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1405 |
--datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1406 |
@@ -155,7 +172,7 @@ src_configure() { |
1407 |
$(use_with readline) \ |
1408 |
$(use_with ssl openssl) \ |
1409 |
$(use_with tcl) \ |
1410 |
- $(use_with uuid ossp-uuid) \ |
1411 |
+ ${uuid_config} \ |
1412 |
$(use_with xml libxml) \ |
1413 |
$(use_with xml libxslt) \ |
1414 |
$(use_with zlib) \ |
1415 |
@@ -163,41 +180,119 @@ src_configure() { |
1416 |
} |
1417 |
|
1418 |
src_compile() { |
1419 |
- emake world |
1420 |
+ emake |
1421 |
+ emake -C contrib |
1422 |
} |
1423 |
|
1424 |
src_install() { |
1425 |
- emake DESTDIR="${D}" install-world |
1426 |
+ emake DESTDIR="${D}" install |
1427 |
+ emake DESTDIR="${D}" install -C contrib |
1428 |
|
1429 |
dodoc README HISTORY doc/{TODO,bug.template} |
1430 |
|
1431 |
+ # man pages are already built, but if we have the target make them, |
1432 |
+ # they'll be generated from source before being installed so we |
1433 |
+ # manually install man pages. |
1434 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
1435 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
1436 |
+ doins -r doc/src/sgml/man{1,3,7} |
1437 |
+ if ! use server; then |
1438 |
+ # Remove man pages for non-existent binaries |
1439 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
1440 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1441 |
+ done |
1442 |
+ fi |
1443 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1444 |
+ |
1445 |
insinto /etc/postgresql-${SLOT} |
1446 |
newins src/bin/psql/psqlrc.sample psqlrc |
1447 |
|
1448 |
- dodir /etc/eselect/postgresql/slots/${SLOT} |
1449 |
- echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
1450 |
- "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
1451 |
- |
1452 |
use static-libs || find "${ED}" -name '*.a' -delete |
1453 |
|
1454 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1455 |
- "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
1456 |
+ local f bn |
1457 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
1458 |
+ -mindepth 1 -maxdepth 1) |
1459 |
+ do |
1460 |
+ bn=$(basename "${f}") |
1461 |
+ # Temporarily tack on tmp to workaround a file collision |
1462 |
+ # issue. This is only necessary for 9.7 and earlier. 10 never |
1463 |
+ # had this issue. |
1464 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
1465 |
+ "/usr/bin/${bn}${SLOT/.}tmp" |
1466 |
+ done |
1467 |
|
1468 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1469 |
- "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
1470 |
+ local linkname mansec |
1471 |
+ for mansec in {1,3,7} ; do |
1472 |
+ for f in "${ED}"/usr/share/postgresql-${SLOT}/man/man${mansec}/* ; do |
1473 |
+ bn=$(basename "${f}") |
1474 |
+ linkname=${bn/%.${mansec}/${SLOT/.}.${mansec}} |
1475 |
+ dosym ../../postgresql-${SLOT}/man/man${mansec}/$bn \ |
1476 |
+ /usr/share/man/man${mansec}/${linkname} |
1477 |
+ done |
1478 |
+ done |
1479 |
|
1480 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1481 |
- "${FILESDIR}/${PN}.service" | \ |
1482 |
- systemd_newunit - ${PN}-${SLOT}.service |
1483 |
+ if use doc ; then |
1484 |
+ docinto html |
1485 |
+ dodoc doc/src/sgml/html/* |
1486 |
|
1487 |
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1488 |
+ docinto sgml |
1489 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
1490 |
+ fi |
1491 |
|
1492 |
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1493 |
+ if use server; then |
1494 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1495 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
1496 |
|
1497 |
- if use prefix ; then |
1498 |
- keepdir /run/postgresql |
1499 |
- fperms 0775 /run/postgresql |
1500 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1501 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
1502 |
+ |
1503 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1504 |
+ "${FILESDIR}/${PN}.service" | \ |
1505 |
+ systemd_newunit - ${PN}-${SLOT}.service |
1506 |
+ |
1507 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1508 |
+ |
1509 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1510 |
+ |
1511 |
+ if use prefix ; then |
1512 |
+ keepdir /run/postgresql |
1513 |
+ fperms 0775 /run/postgresql |
1514 |
+ fi |
1515 |
+ fi |
1516 |
+} |
1517 |
+ |
1518 |
+pkg_preinst() { |
1519 |
+ # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., |
1520 |
+ # /usr/bin/psql96). They may have been created by the |
1521 |
+ # postgresql.eselect module, but they're handled within this ebuild |
1522 |
+ # now. It's alright if we momentarily delete /usr/bin/psql as it |
1523 |
+ # will be recreated by the eselect module in pkg_ppostinst(). This |
1524 |
+ # is only necessary for 9.7 and earlier. 10 and later were never |
1525 |
+ # handled in this manner. |
1526 |
+ local canonicalise |
1527 |
+ if type -p realpath > /dev/null; then |
1528 |
+ canonicalise=realpath |
1529 |
+ elif type -p readlink > /dev/null; then |
1530 |
+ canonicalise='readlink -f' |
1531 |
+ else |
1532 |
+ # can't die, subshell |
1533 |
+ die "No readlink nor realpath found, cannot canonicalise" |
1534 |
fi |
1535 |
+ |
1536 |
+ local l |
1537 |
+ # First remove any symlinks in /usr/bin that may have been created |
1538 |
+ # by the old eselect |
1539 |
+ for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do |
1540 |
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then |
1541 |
+ rm "${l}" || ewarn "Couldn't remove ${l}" |
1542 |
+ fi |
1543 |
+ done |
1544 |
+ |
1545 |
+ # Then move the symlinks created by the ebuild to their proper place. |
1546 |
+ for l in "${ED}"/usr/bin/*tmp ; do |
1547 |
+ mv "${l}" "${l%tmp}" \ |
1548 |
+ || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" |
1549 |
+ done |
1550 |
} |
1551 |
|
1552 |
pkg_postinst() { |
1553 |
@@ -206,35 +301,29 @@ pkg_postinst() { |
1554 |
elog "If you need a global psqlrc-file, you can place it in:" |
1555 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
1556 |
|
1557 |
- if [[ -z ${REPLACING_VERSIONS} ]] ; then |
1558 |
+ if use server ; then |
1559 |
+ elog |
1560 |
+ elog "Gentoo specific documentation:" |
1561 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1562 |
elog |
1563 |
- elog "It looks like this is your first time installing PostgreSQL. Run the" |
1564 |
- elog "following command in all active shells to pick up changes to the default" |
1565 |
+ elog "Official documentation:" |
1566 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1567 |
+ elog |
1568 |
+ elog "The default location of the Unix-domain socket is:" |
1569 |
+ elog " ${EROOT%/}/run/postgresql/" |
1570 |
+ elog |
1571 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1572 |
+ elog "so that it contains your preferred locale in:" |
1573 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1574 |
+ elog |
1575 |
+ elog "Then, execute the following command to setup the initial database" |
1576 |
elog "environment:" |
1577 |
- elog " source /etc/profile" |
1578 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
1579 |
fi |
1580 |
- |
1581 |
- elog |
1582 |
- elog "Gentoo specific documentation:" |
1583 |
- elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1584 |
- elog |
1585 |
- elog "Official documentation:" |
1586 |
- elog "${EROOT%/}/usr/share/doc/${PF}/html" |
1587 |
- elog |
1588 |
- elog "The default location of the Unix-domain socket is:" |
1589 |
- elog " ${EROOT%/}/run/postgresql/" |
1590 |
- elog |
1591 |
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1592 |
- elog "so that it contains your preferred locale, and other options, in:" |
1593 |
- elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1594 |
- elog |
1595 |
- elog "Then, execute the following command to setup the initial database" |
1596 |
- elog "environment:" |
1597 |
- elog " emerge --config =${CATEGORY}/${PF}" |
1598 |
} |
1599 |
|
1600 |
pkg_prerm() { |
1601 |
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1602 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1603 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1604 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1605 |
|
1606 |
@@ -249,6 +338,8 @@ pkg_postrm() { |
1607 |
} |
1608 |
|
1609 |
pkg_config() { |
1610 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
1611 |
+ |
1612 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1613 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1614 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
1615 |
@@ -297,21 +388,10 @@ pkg_config() { |
1616 |
einfo "The database cluster will be created in:" |
1617 |
einfo " ${DATA_DIR}" |
1618 |
einfo |
1619 |
- if [ -z "$PG_AUTOCONFIG" ] ; then |
1620 |
- while [ "$correct" != "true" ] ; do |
1621 |
- einfo "Are you ready to continue? (y/n)" |
1622 |
- read answer |
1623 |
- if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
1624 |
- correct="true" |
1625 |
- elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
1626 |
- die "Aborting initialization." |
1627 |
- else |
1628 |
- echo "Answer not recognized" |
1629 |
- fi |
1630 |
- done |
1631 |
- else |
1632 |
- einfo "PG_AUTOCONFIG set, not prompting" |
1633 |
- fi |
1634 |
+ |
1635 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
1636 |
+ sleep 5 |
1637 |
+ eend 0 |
1638 |
|
1639 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1640 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
1641 |
@@ -339,6 +419,10 @@ pkg_config() { |
1642 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1643 |
fi |
1644 |
|
1645 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
1646 |
+ # overridden in the initscript |
1647 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
1648 |
+ |
1649 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1650 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1651 |
# On the off-chance that you might need to work with UTF-8 encoded |
1652 |
@@ -371,17 +455,17 @@ pkg_config() { |
1653 |
} |
1654 |
|
1655 |
src_test() { |
1656 |
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
1657 |
- |
1658 |
- if [[ ${UID} -ne 0 ]] ; then |
1659 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
1660 |
emake check |
1661 |
|
1662 |
einfo "If you think other tests besides the regression tests are necessary, please" |
1663 |
einfo "submit a bug including a patch for this ebuild to enable them." |
1664 |
else |
1665 |
+ use server || \ |
1666 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1667 |
[[ ${UID} -eq 0 ]] || \ |
1668 |
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES." |
1669 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1670 |
|
1671 |
- ewarn "Skipping." |
1672 |
+ ewarn 'Skipping.' |
1673 |
fi |
1674 |
} |
1675 |
|
1676 |
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.5.6-r1.ebuild |
1677 |
similarity index 55% |
1678 |
copy from dev-db/postgresql/postgresql-9999.ebuild |
1679 |
copy to dev-db/postgresql/postgresql-9.5.6-r1.ebuild |
1680 |
index 6a995c154ba..fdfc66fd9bd 100644 |
1681 |
--- a/dev-db/postgresql/postgresql-9999.ebuild |
1682 |
+++ b/dev-db/postgresql/postgresql-9.5.6-r1.ebuild |
1683 |
@@ -5,15 +5,14 @@ EAPI="5" |
1684 |
|
1685 |
PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) |
1686 |
|
1687 |
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \ |
1688 |
- python-single-r1 systemd user versionator |
1689 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
1690 |
+ systemd user versionator |
1691 |
|
1692 |
-KEYWORDS="" |
1693 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
1694 |
|
1695 |
-# Fix if needed |
1696 |
-SLOT="9.7" |
1697 |
+SLOT="$(get_version_component_range 1-2)" |
1698 |
|
1699 |
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git" |
1700 |
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
1701 |
|
1702 |
LICENSE="POSTGRESQL GPL-2" |
1703 |
DESCRIPTION="PostgreSQL RDBMS" |
1704 |
@@ -21,7 +20,7 @@ HOMEPAGE="http://www.postgresql.org/" |
1705 |
|
1706 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
1707 |
zh_CN zh_TW" |
1708 |
-IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
1709 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
1710 |
+readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
1711 |
|
1712 |
for lingua in ${LINGUAS}; do |
1713 |
@@ -39,7 +38,7 @@ wanted_languages() { |
1714 |
} |
1715 |
|
1716 |
CDEPEND=" |
1717 |
->=app-eselect/eselect-postgresql-1.2.0 |
1718 |
+>=app-eselect/eselect-postgresql-2.0 |
1719 |
sys-apps/less |
1720 |
virtual/libintl |
1721 |
kerberos? ( virtual/krb5 ) |
1722 |
@@ -53,30 +52,40 @@ ssl? ( |
1723 |
libressl? ( dev-libs/libressl:= ) |
1724 |
) |
1725 |
tcl? ( >=dev-lang/tcl-8:0= ) |
1726 |
-uuid? ( dev-libs/ossp-uuid ) |
1727 |
xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1728 |
zlib? ( sys-libs/zlib ) |
1729 |
" |
1730 |
|
1731 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1732 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1733 |
+# the libc includes UUID functions. |
1734 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
1735 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
1736 |
+ |
1737 |
+nest_usedep() { |
1738 |
+ local front back |
1739 |
+ while [[ ${#} -gt 1 ]]; do |
1740 |
+ front+="${1}? ( " |
1741 |
+ back+=" )" |
1742 |
+ shift |
1743 |
+ done |
1744 |
+ echo "${front}${1}${back}" |
1745 |
+} |
1746 |
+ |
1747 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
1748 |
+CDEPEND+=" |
1749 |
+uuid? ( |
1750 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1751 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1752 |
+)" |
1753 |
+ |
1754 |
DEPEND="${CDEPEND} |
1755 |
!!<sys-apps/sandbox-2.0 |
1756 |
->=dev-lang/perl-5.8 |
1757 |
-app-text/docbook-dsssl-stylesheets |
1758 |
-app-text/docbook-sgml-dtd:4.2 |
1759 |
-app-text/docbook-xml-dtd:4.2 |
1760 |
-app-text/docbook-xsl-stylesheets |
1761 |
-app-text/openjade |
1762 |
-dev-libs/libxml2 |
1763 |
-dev-libs/libxslt |
1764 |
sys-devel/bison |
1765 |
sys-devel/flex |
1766 |
nls? ( sys-devel/gettext ) |
1767 |
xml? ( virtual/pkgconfig ) |
1768 |
" |
1769 |
-src_unpack() { |
1770 |
- base_src_unpack |
1771 |
- git-2_src_unpack |
1772 |
-} |
1773 |
|
1774 |
RDEPEND="${CDEPEND} |
1775 |
!dev-db/postgresql-docs:${SLOT} |
1776 |
@@ -85,17 +94,8 @@ RDEPEND="${CDEPEND} |
1777 |
selinux? ( sec-policy/selinux-postgresql ) |
1778 |
" |
1779 |
|
1780 |
-pkg_pretend() { |
1781 |
- ewarn "You are using a live ebuild that uses the current source code as it is" |
1782 |
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such," |
1783 |
- ewarn "the GNU Makefiles may be altered by upstream without notice and the" |
1784 |
- ewarn "documentation for this live version is not readily available" |
1785 |
- ewarn "online. Ergo, the ebuild maintainers will not support building a" |
1786 |
- ewarn "client-only and/or document-free version." |
1787 |
-} |
1788 |
- |
1789 |
pkg_setup() { |
1790 |
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1791 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1792 |
|
1793 |
enewgroup postgres 70 |
1794 |
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
1795 |
@@ -116,6 +116,12 @@ src_prepare() { |
1796 |
# hardened and non-hardened environments. (Bug #528786) |
1797 |
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
1798 |
|
1799 |
+ use server || epatch "${FILESDIR}/${PN}-9.5.5-no-server.patch" |
1800 |
+ |
1801 |
+ # Fix bug 486556 where the server would crash at start up because of |
1802 |
+ # an infinite loop caused by a self-referencing symlink. |
1803 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
1804 |
+ |
1805 |
if use pam ; then |
1806 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1807 |
-i src/backend/libpq/auth.c || \ |
1808 |
@@ -137,6 +143,17 @@ src_configure() { |
1809 |
|
1810 |
local PO="${EPREFIX%/}" |
1811 |
|
1812 |
+ local i uuid_config="" |
1813 |
+ if use uuid; then |
1814 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
1815 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
1816 |
+ done |
1817 |
+ for i in ${BSD_LIBC[@]}; do |
1818 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
1819 |
+ done |
1820 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
1821 |
+ fi |
1822 |
+ |
1823 |
econf \ |
1824 |
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1825 |
--datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1826 |
@@ -145,6 +162,7 @@ src_configure() { |
1827 |
--mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1828 |
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1829 |
--with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1830 |
+ $(use_enable !alpha spinlocks) \ |
1831 |
$(use_enable !pg_legacytimestamp integer-datetimes) \ |
1832 |
$(use_enable threads thread-safety) \ |
1833 |
$(use_with kerberos gssapi) \ |
1834 |
@@ -155,7 +173,7 @@ src_configure() { |
1835 |
$(use_with readline) \ |
1836 |
$(use_with ssl openssl) \ |
1837 |
$(use_with tcl) \ |
1838 |
- $(use_with uuid ossp-uuid) \ |
1839 |
+ ${uuid_config} \ |
1840 |
$(use_with xml libxml) \ |
1841 |
$(use_with xml libxslt) \ |
1842 |
$(use_with zlib) \ |
1843 |
@@ -163,78 +181,155 @@ src_configure() { |
1844 |
} |
1845 |
|
1846 |
src_compile() { |
1847 |
- emake world |
1848 |
+ emake |
1849 |
+ emake -C contrib |
1850 |
} |
1851 |
|
1852 |
src_install() { |
1853 |
- emake DESTDIR="${D}" install-world |
1854 |
+ emake DESTDIR="${D}" install |
1855 |
+ emake DESTDIR="${D}" install -C contrib |
1856 |
|
1857 |
dodoc README HISTORY doc/{TODO,bug.template} |
1858 |
|
1859 |
+ # man pages are already built, but if we have the target make them, |
1860 |
+ # they'll be generated from source before being installed so we |
1861 |
+ # manually install man pages. |
1862 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
1863 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
1864 |
+ doins -r doc/src/sgml/man{1,3,7} |
1865 |
+ if ! use server; then |
1866 |
+ # Remove man pages for non-existent binaries |
1867 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
1868 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1869 |
+ done |
1870 |
+ fi |
1871 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1872 |
+ |
1873 |
insinto /etc/postgresql-${SLOT} |
1874 |
newins src/bin/psql/psqlrc.sample psqlrc |
1875 |
|
1876 |
- dodir /etc/eselect/postgresql/slots/${SLOT} |
1877 |
- echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
1878 |
- "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
1879 |
- |
1880 |
use static-libs || find "${ED}" -name '*.a' -delete |
1881 |
|
1882 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1883 |
- "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
1884 |
+ local f bn |
1885 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
1886 |
+ -mindepth 1 -maxdepth 1) |
1887 |
+ do |
1888 |
+ bn=$(basename "${f}") |
1889 |
+ # Temporarily tack on tmp to workaround a file collision |
1890 |
+ # issue. This is only necessary for 9.7 and earlier. 10 never |
1891 |
+ # had this issue. |
1892 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
1893 |
+ "/usr/bin/${bn}${SLOT/.}tmp" |
1894 |
+ done |
1895 |
+ |
1896 |
+ local linkname mansec |
1897 |
+ for mansec in {1,3,7} ; do |
1898 |
+ for f in "${ED}"/usr/share/postgresql-${SLOT}/man/man${mansec}/* ; do |
1899 |
+ bn=$(basename "${f}") |
1900 |
+ linkname=${bn/%.${mansec}/${SLOT/.}.${mansec}} |
1901 |
+ dosym ../../postgresql-${SLOT}/man/man${mansec}/$bn \ |
1902 |
+ /usr/share/man/man${mansec}/${linkname} |
1903 |
+ done |
1904 |
+ done |
1905 |
+ |
1906 |
+ if use doc ; then |
1907 |
+ docinto html |
1908 |
+ dodoc doc/src/sgml/html/* |
1909 |
|
1910 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1911 |
- "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
1912 |
+ docinto sgml |
1913 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
1914 |
+ fi |
1915 |
|
1916 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1917 |
- "${FILESDIR}/${PN}.service" | \ |
1918 |
- systemd_newunit - ${PN}-${SLOT}.service |
1919 |
+ if use server; then |
1920 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1921 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
1922 |
|
1923 |
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1924 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1925 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
1926 |
|
1927 |
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1928 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1929 |
+ "${FILESDIR}/${PN}.service" | \ |
1930 |
+ systemd_newunit - ${PN}-${SLOT}.service |
1931 |
|
1932 |
- if use prefix ; then |
1933 |
- keepdir /run/postgresql |
1934 |
- fperms 0775 /run/postgresql |
1935 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1936 |
+ |
1937 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1938 |
+ |
1939 |
+ if use prefix ; then |
1940 |
+ keepdir /run/postgresql |
1941 |
+ fperms 0775 /run/postgresql |
1942 |
+ fi |
1943 |
+ fi |
1944 |
+} |
1945 |
+ |
1946 |
+pkg_preinst() { |
1947 |
+ # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., |
1948 |
+ # /usr/bin/psql96). They may have been created by the |
1949 |
+ # postgresql.eselect module, but they're handled within this ebuild |
1950 |
+ # now. It's alright if we momentarily delete /usr/bin/psql as it |
1951 |
+ # will be recreated by the eselect module in pkg_ppostinst(). This |
1952 |
+ # is only necessary for 9.7 and earlier. 10 and later were never |
1953 |
+ # handled in this manner. |
1954 |
+ local canonicalise |
1955 |
+ if type -p realpath > /dev/null; then |
1956 |
+ canonicalise=realpath |
1957 |
+ elif type -p readlink > /dev/null; then |
1958 |
+ canonicalise='readlink -f' |
1959 |
+ else |
1960 |
+ # can't die, subshell |
1961 |
+ die "No readlink nor realpath found, cannot canonicalise" |
1962 |
fi |
1963 |
+ |
1964 |
+ local l |
1965 |
+ # First remove any symlinks in /usr/bin that may have been created |
1966 |
+ # by the old eselect |
1967 |
+ for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do |
1968 |
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then |
1969 |
+ rm "${l}" || ewarn "Couldn't remove ${l}" |
1970 |
+ fi |
1971 |
+ done |
1972 |
+ |
1973 |
+ # Then move the symlinks created by the ebuild to their proper place. |
1974 |
+ for l in "${ED}"/usr/bin/*tmp ; do |
1975 |
+ mv "${l}" "${l%tmp}" \ |
1976 |
+ || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" |
1977 |
+ done |
1978 |
} |
1979 |
|
1980 |
pkg_postinst() { |
1981 |
postgresql-config update |
1982 |
|
1983 |
+ if use alpha && use server ; then |
1984 |
+ ewarn "PostgreSQL 9.5+ no longer has native spinlock support on Alpha platforms." |
1985 |
+ ewarn "As a result, performance will be extremely degraded." |
1986 |
+ fi |
1987 |
+ |
1988 |
elog "If you need a global psqlrc-file, you can place it in:" |
1989 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
1990 |
|
1991 |
- if [[ -z ${REPLACING_VERSIONS} ]] ; then |
1992 |
+ if use server ; then |
1993 |
elog |
1994 |
- elog "It looks like this is your first time installing PostgreSQL. Run the" |
1995 |
- elog "following command in all active shells to pick up changes to the default" |
1996 |
+ elog "Gentoo specific documentation:" |
1997 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1998 |
+ elog |
1999 |
+ elog "Official documentation:" |
2000 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
2001 |
+ elog |
2002 |
+ elog "The default location of the Unix-domain socket is:" |
2003 |
+ elog " ${EROOT%/}/run/postgresql/" |
2004 |
+ elog |
2005 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
2006 |
+ elog "so that it contains your preferred locale in:" |
2007 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2008 |
+ elog |
2009 |
+ elog "Then, execute the following command to setup the initial database" |
2010 |
elog "environment:" |
2011 |
- elog " source /etc/profile" |
2012 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
2013 |
fi |
2014 |
- |
2015 |
- elog |
2016 |
- elog "Gentoo specific documentation:" |
2017 |
- elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
2018 |
- elog |
2019 |
- elog "Official documentation:" |
2020 |
- elog "${EROOT%/}/usr/share/doc/${PF}/html" |
2021 |
- elog |
2022 |
- elog "The default location of the Unix-domain socket is:" |
2023 |
- elog " ${EROOT%/}/run/postgresql/" |
2024 |
- elog |
2025 |
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
2026 |
- elog "so that it contains your preferred locale, and other options, in:" |
2027 |
- elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2028 |
- elog |
2029 |
- elog "Then, execute the following command to setup the initial database" |
2030 |
- elog "environment:" |
2031 |
- elog " emerge --config =${CATEGORY}/${PF}" |
2032 |
} |
2033 |
|
2034 |
pkg_prerm() { |
2035 |
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then |
2036 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
2037 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
2038 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
2039 |
|
2040 |
@@ -249,6 +344,8 @@ pkg_postrm() { |
2041 |
} |
2042 |
|
2043 |
pkg_config() { |
2044 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
2045 |
+ |
2046 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
2047 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2048 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
2049 |
@@ -297,21 +394,10 @@ pkg_config() { |
2050 |
einfo "The database cluster will be created in:" |
2051 |
einfo " ${DATA_DIR}" |
2052 |
einfo |
2053 |
- if [ -z "$PG_AUTOCONFIG" ] ; then |
2054 |
- while [ "$correct" != "true" ] ; do |
2055 |
- einfo "Are you ready to continue? (y/n)" |
2056 |
- read answer |
2057 |
- if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
2058 |
- correct="true" |
2059 |
- elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
2060 |
- die "Aborting initialization." |
2061 |
- else |
2062 |
- echo "Answer not recognized" |
2063 |
- fi |
2064 |
- done |
2065 |
- else |
2066 |
- einfo "PG_AUTOCONFIG set, not prompting" |
2067 |
- fi |
2068 |
+ |
2069 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
2070 |
+ sleep 5 |
2071 |
+ eend 0 |
2072 |
|
2073 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
2074 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
2075 |
@@ -339,6 +425,10 @@ pkg_config() { |
2076 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
2077 |
fi |
2078 |
|
2079 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
2080 |
+ # overridden in the initscript |
2081 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
2082 |
+ |
2083 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
2084 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
2085 |
# On the off-chance that you might need to work with UTF-8 encoded |
2086 |
@@ -371,17 +461,17 @@ pkg_config() { |
2087 |
} |
2088 |
|
2089 |
src_test() { |
2090 |
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
2091 |
- |
2092 |
- if [[ ${UID} -ne 0 ]] ; then |
2093 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
2094 |
emake check |
2095 |
|
2096 |
einfo "If you think other tests besides the regression tests are necessary, please" |
2097 |
einfo "submit a bug including a patch for this ebuild to enable them." |
2098 |
else |
2099 |
+ use server || \ |
2100 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
2101 |
[[ ${UID} -eq 0 ]] || \ |
2102 |
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES." |
2103 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
2104 |
|
2105 |
- ewarn "Skipping." |
2106 |
+ ewarn 'Skipping.' |
2107 |
fi |
2108 |
} |
2109 |
|
2110 |
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.6.2-r1.ebuild |
2111 |
similarity index 55% |
2112 |
copy from dev-db/postgresql/postgresql-9999.ebuild |
2113 |
copy to dev-db/postgresql/postgresql-9.6.2-r1.ebuild |
2114 |
index 6a995c154ba..07527caf315 100644 |
2115 |
--- a/dev-db/postgresql/postgresql-9999.ebuild |
2116 |
+++ b/dev-db/postgresql/postgresql-9.6.2-r1.ebuild |
2117 |
@@ -5,15 +5,17 @@ EAPI="5" |
2118 |
|
2119 |
PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) |
2120 |
|
2121 |
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \ |
2122 |
- python-single-r1 systemd user versionator |
2123 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
2124 |
+ systemd user versionator |
2125 |
|
2126 |
-KEYWORDS="" |
2127 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
2128 |
|
2129 |
-# Fix if needed |
2130 |
-SLOT="9.7" |
2131 |
+SLOT="$(get_version_component_range 1-2)" |
2132 |
|
2133 |
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git" |
2134 |
+MY_PV=${PV/_/} |
2135 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
2136 |
+ |
2137 |
+SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
2138 |
|
2139 |
LICENSE="POSTGRESQL GPL-2" |
2140 |
DESCRIPTION="PostgreSQL RDBMS" |
2141 |
@@ -21,7 +23,7 @@ HOMEPAGE="http://www.postgresql.org/" |
2142 |
|
2143 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
2144 |
zh_CN zh_TW" |
2145 |
-IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
2146 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
2147 |
+readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
2148 |
|
2149 |
for lingua in ${LINGUAS}; do |
2150 |
@@ -39,7 +41,7 @@ wanted_languages() { |
2151 |
} |
2152 |
|
2153 |
CDEPEND=" |
2154 |
->=app-eselect/eselect-postgresql-1.2.0 |
2155 |
+>=app-eselect/eselect-postgresql-2.0 |
2156 |
sys-apps/less |
2157 |
virtual/libintl |
2158 |
kerberos? ( virtual/krb5 ) |
2159 |
@@ -53,30 +55,40 @@ ssl? ( |
2160 |
libressl? ( dev-libs/libressl:= ) |
2161 |
) |
2162 |
tcl? ( >=dev-lang/tcl-8:0= ) |
2163 |
-uuid? ( dev-libs/ossp-uuid ) |
2164 |
xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
2165 |
zlib? ( sys-libs/zlib ) |
2166 |
" |
2167 |
|
2168 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
2169 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
2170 |
+# the libc includes UUID functions. |
2171 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
2172 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
2173 |
+ |
2174 |
+nest_usedep() { |
2175 |
+ local front back |
2176 |
+ while [[ ${#} -gt 1 ]]; do |
2177 |
+ front+="${1}? ( " |
2178 |
+ back+=" )" |
2179 |
+ shift |
2180 |
+ done |
2181 |
+ echo "${front}${1}${back}" |
2182 |
+} |
2183 |
+ |
2184 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
2185 |
+CDEPEND+=" |
2186 |
+uuid? ( |
2187 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
2188 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
2189 |
+)" |
2190 |
+ |
2191 |
DEPEND="${CDEPEND} |
2192 |
!!<sys-apps/sandbox-2.0 |
2193 |
->=dev-lang/perl-5.8 |
2194 |
-app-text/docbook-dsssl-stylesheets |
2195 |
-app-text/docbook-sgml-dtd:4.2 |
2196 |
-app-text/docbook-xml-dtd:4.2 |
2197 |
-app-text/docbook-xsl-stylesheets |
2198 |
-app-text/openjade |
2199 |
-dev-libs/libxml2 |
2200 |
-dev-libs/libxslt |
2201 |
sys-devel/bison |
2202 |
sys-devel/flex |
2203 |
nls? ( sys-devel/gettext ) |
2204 |
xml? ( virtual/pkgconfig ) |
2205 |
" |
2206 |
-src_unpack() { |
2207 |
- base_src_unpack |
2208 |
- git-2_src_unpack |
2209 |
-} |
2210 |
|
2211 |
RDEPEND="${CDEPEND} |
2212 |
!dev-db/postgresql-docs:${SLOT} |
2213 |
@@ -85,17 +97,8 @@ RDEPEND="${CDEPEND} |
2214 |
selinux? ( sec-policy/selinux-postgresql ) |
2215 |
" |
2216 |
|
2217 |
-pkg_pretend() { |
2218 |
- ewarn "You are using a live ebuild that uses the current source code as it is" |
2219 |
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such," |
2220 |
- ewarn "the GNU Makefiles may be altered by upstream without notice and the" |
2221 |
- ewarn "documentation for this live version is not readily available" |
2222 |
- ewarn "online. Ergo, the ebuild maintainers will not support building a" |
2223 |
- ewarn "client-only and/or document-free version." |
2224 |
-} |
2225 |
- |
2226 |
pkg_setup() { |
2227 |
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
2228 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
2229 |
|
2230 |
enewgroup postgres 70 |
2231 |
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
2232 |
@@ -116,6 +119,12 @@ src_prepare() { |
2233 |
# hardened and non-hardened environments. (Bug #528786) |
2234 |
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
2235 |
|
2236 |
+ use server || epatch "${FILESDIR}/${PN}-${SLOT}.1-no-server.patch" |
2237 |
+ |
2238 |
+ # Fix bug 486556 where the server would crash at start up because of |
2239 |
+ # an infinite loop caused by a self-referencing symlink. |
2240 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
2241 |
+ |
2242 |
if use pam ; then |
2243 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
2244 |
-i src/backend/libpq/auth.c || \ |
2245 |
@@ -137,6 +146,17 @@ src_configure() { |
2246 |
|
2247 |
local PO="${EPREFIX%/}" |
2248 |
|
2249 |
+ local i uuid_config="" |
2250 |
+ if use uuid; then |
2251 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
2252 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
2253 |
+ done |
2254 |
+ for i in ${BSD_LIBC[@]}; do |
2255 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
2256 |
+ done |
2257 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
2258 |
+ fi |
2259 |
+ |
2260 |
econf \ |
2261 |
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
2262 |
--datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
2263 |
@@ -155,7 +175,7 @@ src_configure() { |
2264 |
$(use_with readline) \ |
2265 |
$(use_with ssl openssl) \ |
2266 |
$(use_with tcl) \ |
2267 |
- $(use_with uuid ossp-uuid) \ |
2268 |
+ ${uuid_config} \ |
2269 |
$(use_with xml libxml) \ |
2270 |
$(use_with xml libxslt) \ |
2271 |
$(use_with zlib) \ |
2272 |
@@ -163,41 +183,119 @@ src_configure() { |
2273 |
} |
2274 |
|
2275 |
src_compile() { |
2276 |
- emake world |
2277 |
+ emake |
2278 |
+ emake -C contrib |
2279 |
} |
2280 |
|
2281 |
src_install() { |
2282 |
- emake DESTDIR="${D}" install-world |
2283 |
+ emake DESTDIR="${D}" install |
2284 |
+ emake DESTDIR="${D}" install -C contrib |
2285 |
|
2286 |
dodoc README HISTORY doc/{TODO,bug.template} |
2287 |
|
2288 |
+ # man pages are already built, but if we have the target make them, |
2289 |
+ # they'll be generated from source before being installed so we |
2290 |
+ # manually install man pages. |
2291 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
2292 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
2293 |
+ doins -r doc/src/sgml/man{1,3,7} |
2294 |
+ if ! use server; then |
2295 |
+ # Remove man pages for non-existent binaries |
2296 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
2297 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
2298 |
+ done |
2299 |
+ fi |
2300 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
2301 |
+ |
2302 |
insinto /etc/postgresql-${SLOT} |
2303 |
newins src/bin/psql/psqlrc.sample psqlrc |
2304 |
|
2305 |
- dodir /etc/eselect/postgresql/slots/${SLOT} |
2306 |
- echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
2307 |
- "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
2308 |
- |
2309 |
use static-libs || find "${ED}" -name '*.a' -delete |
2310 |
|
2311 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2312 |
- "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
2313 |
+ local f bn |
2314 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
2315 |
+ -mindepth 1 -maxdepth 1) |
2316 |
+ do |
2317 |
+ bn=$(basename "${f}") |
2318 |
+ # Temporarily tack on tmp to workaround a file collision |
2319 |
+ # issue. This is only necessary for 9.7 and earlier. 10 never |
2320 |
+ # had this issue. |
2321 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
2322 |
+ "/usr/bin/${bn}${SLOT/.}tmp" |
2323 |
+ done |
2324 |
+ |
2325 |
+ local linkname mansec |
2326 |
+ for mansec in {1,3,7} ; do |
2327 |
+ for f in "${ED}"/usr/share/postgresql-${SLOT}/man/man${mansec}/* ; do |
2328 |
+ bn=$(basename "${f}") |
2329 |
+ linkname=${bn/%.${mansec}/${SLOT/.}.${mansec}} |
2330 |
+ dosym ../../postgresql-${SLOT}/man/man${mansec}/$bn \ |
2331 |
+ /usr/share/man/man${mansec}/${linkname} |
2332 |
+ done |
2333 |
+ done |
2334 |
|
2335 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2336 |
- "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
2337 |
+ if use doc ; then |
2338 |
+ docinto html |
2339 |
+ dodoc doc/src/sgml/html/* |
2340 |
|
2341 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2342 |
- "${FILESDIR}/${PN}.service" | \ |
2343 |
- systemd_newunit - ${PN}-${SLOT}.service |
2344 |
+ docinto sgml |
2345 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
2346 |
+ fi |
2347 |
|
2348 |
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
2349 |
+ if use server; then |
2350 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2351 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
2352 |
|
2353 |
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
2354 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2355 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
2356 |
|
2357 |
- if use prefix ; then |
2358 |
- keepdir /run/postgresql |
2359 |
- fperms 0775 /run/postgresql |
2360 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2361 |
+ "${FILESDIR}/${PN}.service" | \ |
2362 |
+ systemd_newunit - ${PN}-${SLOT}.service |
2363 |
+ |
2364 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
2365 |
+ |
2366 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
2367 |
+ |
2368 |
+ if use prefix ; then |
2369 |
+ keepdir /run/postgresql |
2370 |
+ fperms 0775 /run/postgresql |
2371 |
+ fi |
2372 |
+ fi |
2373 |
+} |
2374 |
+ |
2375 |
+pkg_preinst() { |
2376 |
+ # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., |
2377 |
+ # /usr/bin/psql96). They may have been created by the |
2378 |
+ # postgresql.eselect module, but they're handled within this ebuild |
2379 |
+ # now. It's alright if we momentarily delete /usr/bin/psql as it |
2380 |
+ # will be recreated by the eselect module in pkg_ppostinst(). This |
2381 |
+ # is only necessary for 9.7 and earlier. 10 and later were never |
2382 |
+ # handled in this manner. |
2383 |
+ local canonicalise |
2384 |
+ if type -p realpath > /dev/null; then |
2385 |
+ canonicalise=realpath |
2386 |
+ elif type -p readlink > /dev/null; then |
2387 |
+ canonicalise='readlink -f' |
2388 |
+ else |
2389 |
+ # can't die, subshell |
2390 |
+ die "No readlink nor realpath found, cannot canonicalise" |
2391 |
fi |
2392 |
+ |
2393 |
+ local l |
2394 |
+ # First remove any symlinks in /usr/bin that may have been created |
2395 |
+ # by the old eselect |
2396 |
+ for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do |
2397 |
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then |
2398 |
+ rm "${l}" || ewarn "Couldn't remove ${l}" |
2399 |
+ fi |
2400 |
+ done |
2401 |
+ |
2402 |
+ # Then move the symlinks created by the ebuild to their proper place. |
2403 |
+ for l in "${ED}"/usr/bin/*tmp ; do |
2404 |
+ mv "${l}" "${l%tmp}" \ |
2405 |
+ || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" |
2406 |
+ done |
2407 |
} |
2408 |
|
2409 |
pkg_postinst() { |
2410 |
@@ -206,35 +304,29 @@ pkg_postinst() { |
2411 |
elog "If you need a global psqlrc-file, you can place it in:" |
2412 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
2413 |
|
2414 |
- if [[ -z ${REPLACING_VERSIONS} ]] ; then |
2415 |
+ if use server ; then |
2416 |
+ elog |
2417 |
+ elog "Gentoo specific documentation:" |
2418 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
2419 |
elog |
2420 |
- elog "It looks like this is your first time installing PostgreSQL. Run the" |
2421 |
- elog "following command in all active shells to pick up changes to the default" |
2422 |
+ elog "Official documentation:" |
2423 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
2424 |
+ elog |
2425 |
+ elog "The default location of the Unix-domain socket is:" |
2426 |
+ elog " ${EROOT%/}/run/postgresql/" |
2427 |
+ elog |
2428 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
2429 |
+ elog "so that it contains your preferred locale in:" |
2430 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2431 |
+ elog |
2432 |
+ elog "Then, execute the following command to setup the initial database" |
2433 |
elog "environment:" |
2434 |
- elog " source /etc/profile" |
2435 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
2436 |
fi |
2437 |
- |
2438 |
- elog |
2439 |
- elog "Gentoo specific documentation:" |
2440 |
- elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
2441 |
- elog |
2442 |
- elog "Official documentation:" |
2443 |
- elog "${EROOT%/}/usr/share/doc/${PF}/html" |
2444 |
- elog |
2445 |
- elog "The default location of the Unix-domain socket is:" |
2446 |
- elog " ${EROOT%/}/run/postgresql/" |
2447 |
- elog |
2448 |
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
2449 |
- elog "so that it contains your preferred locale, and other options, in:" |
2450 |
- elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2451 |
- elog |
2452 |
- elog "Then, execute the following command to setup the initial database" |
2453 |
- elog "environment:" |
2454 |
- elog " emerge --config =${CATEGORY}/${PF}" |
2455 |
} |
2456 |
|
2457 |
pkg_prerm() { |
2458 |
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then |
2459 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
2460 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
2461 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
2462 |
|
2463 |
@@ -249,6 +341,8 @@ pkg_postrm() { |
2464 |
} |
2465 |
|
2466 |
pkg_config() { |
2467 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
2468 |
+ |
2469 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
2470 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2471 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
2472 |
@@ -297,21 +391,10 @@ pkg_config() { |
2473 |
einfo "The database cluster will be created in:" |
2474 |
einfo " ${DATA_DIR}" |
2475 |
einfo |
2476 |
- if [ -z "$PG_AUTOCONFIG" ] ; then |
2477 |
- while [ "$correct" != "true" ] ; do |
2478 |
- einfo "Are you ready to continue? (y/n)" |
2479 |
- read answer |
2480 |
- if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
2481 |
- correct="true" |
2482 |
- elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
2483 |
- die "Aborting initialization." |
2484 |
- else |
2485 |
- echo "Answer not recognized" |
2486 |
- fi |
2487 |
- done |
2488 |
- else |
2489 |
- einfo "PG_AUTOCONFIG set, not prompting" |
2490 |
- fi |
2491 |
+ |
2492 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
2493 |
+ sleep 5 |
2494 |
+ eend 0 |
2495 |
|
2496 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
2497 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
2498 |
@@ -339,6 +422,10 @@ pkg_config() { |
2499 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
2500 |
fi |
2501 |
|
2502 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
2503 |
+ # overridden in the initscript |
2504 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
2505 |
+ |
2506 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
2507 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
2508 |
# On the off-chance that you might need to work with UTF-8 encoded |
2509 |
@@ -371,17 +458,17 @@ pkg_config() { |
2510 |
} |
2511 |
|
2512 |
src_test() { |
2513 |
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
2514 |
- |
2515 |
- if [[ ${UID} -ne 0 ]] ; then |
2516 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
2517 |
emake check |
2518 |
|
2519 |
einfo "If you think other tests besides the regression tests are necessary, please" |
2520 |
einfo "submit a bug including a patch for this ebuild to enable them." |
2521 |
else |
2522 |
+ use server || \ |
2523 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
2524 |
[[ ${UID} -eq 0 ]] || \ |
2525 |
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES." |
2526 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
2527 |
|
2528 |
- ewarn "Skipping." |
2529 |
+ ewarn 'Skipping.' |
2530 |
fi |
2531 |
} |
2532 |
|
2533 |
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9999.ebuild |
2534 |
index 6a995c154ba..4ef8157f431 100644 |
2535 |
--- a/dev-db/postgresql/postgresql-9999.ebuild |
2536 |
+++ b/dev-db/postgresql/postgresql-9999.ebuild |
2537 |
@@ -10,8 +10,8 @@ inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \ |
2538 |
|
2539 |
KEYWORDS="" |
2540 |
|
2541 |
-# Fix if needed |
2542 |
-SLOT="9.7" |
2543 |
+# Bump when rc released. |
2544 |
+SLOT="10" |
2545 |
|
2546 |
EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git" |
2547 |
|
2548 |
@@ -39,7 +39,7 @@ wanted_languages() { |
2549 |
} |
2550 |
|
2551 |
CDEPEND=" |
2552 |
->=app-eselect/eselect-postgresql-1.2.0 |
2553 |
+>=app-eselect/eselect-postgresql-2.0 |
2554 |
sys-apps/less |
2555 |
virtual/libintl |
2556 |
kerberos? ( virtual/krb5 ) |
2557 |
@@ -174,17 +174,13 @@ src_install() { |
2558 |
insinto /etc/postgresql-${SLOT} |
2559 |
newins src/bin/psql/psqlrc.sample psqlrc |
2560 |
|
2561 |
- dodir /etc/eselect/postgresql/slots/${SLOT} |
2562 |
- echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
2563 |
- "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
2564 |
- |
2565 |
use static-libs || find "${ED}" -name '*.a' -delete |
2566 |
|
2567 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2568 |
- "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
2569 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
2570 |
|
2571 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2572 |
- "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
2573 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
2574 |
|
2575 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2576 |
"${FILESDIR}/${PN}.service" | \ |
2577 |
@@ -194,26 +190,74 @@ src_install() { |
2578 |
|
2579 |
use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
2580 |
|
2581 |
+ local f bn |
2582 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
2583 |
+ -mindepth 1 -maxdepth 1) |
2584 |
+ do |
2585 |
+ bn=$(basename "${f}") |
2586 |
+ # Temporarily tack on tmp to workaround a file collision |
2587 |
+ # issue. This is only necessary for 9.7 and earlier. 10 never |
2588 |
+ # had this issue. |
2589 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
2590 |
+ "/usr/bin/${bn}${SLOT/.}tmp" |
2591 |
+ done |
2592 |
+ |
2593 |
+ local linkname mansec |
2594 |
+ for mansec in {1,3,7} ; do |
2595 |
+ for f in "${ED}"/usr/share/postgresql-${SLOT}/man/man${mansec}/* ; do |
2596 |
+ bn=$(basename "${f}") |
2597 |
+ linkname=${bn/%.${mansec}/${SLOT/.}.${mansec}} |
2598 |
+ dosym ../../postgresql-${SLOT}/man/man${mansec}/$bn \ |
2599 |
+ /usr/share/man/man${mansec}/${linkname} |
2600 |
+ done |
2601 |
+ done |
2602 |
+ |
2603 |
if use prefix ; then |
2604 |
keepdir /run/postgresql |
2605 |
fperms 0775 /run/postgresql |
2606 |
fi |
2607 |
} |
2608 |
|
2609 |
+pkg_preinst() { |
2610 |
+ # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., |
2611 |
+ # /usr/bin/psql97). They may have been created by the |
2612 |
+ # postgresql.eselect module, but they're handled within this ebuild |
2613 |
+ # now. It's alright if we momentarily delete /usr/bin/psql as it |
2614 |
+ # will be recreated by the eselect module in pkg_ppostinst(). We |
2615 |
+ # only worry about the 9.7 slot as that's the last slot that had its |
2616 |
+ # slot-specific links generated by eselect. |
2617 |
+ # |
2618 |
+ # This can be removed when 10 is the lowest slot in the tree. |
2619 |
+ local canonicalise |
2620 |
+ if type -p realpath > /dev/null; then |
2621 |
+ canonicalise=realpath |
2622 |
+ elif type -p readlink > /dev/null; then |
2623 |
+ canonicalise='readlink -f' |
2624 |
+ else |
2625 |
+ # can't die, subshell |
2626 |
+ die "No readlink nor realpath found, cannot canonicalise" |
2627 |
+ fi |
2628 |
+ |
2629 |
+ local l |
2630 |
+ # First remove any symlinks in /usr/bin that may have been created |
2631 |
+ # by the old eselect |
2632 |
+ for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do |
2633 |
+ [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}" |
2634 |
+ done |
2635 |
+ |
2636 |
+ # Then move the symlinks created by the ebuild to their proper place. |
2637 |
+ for l in "${ED}"/usr/bin/*tmp ; do |
2638 |
+ mv "${l}" "${l%tmp}" \ |
2639 |
+ || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})" |
2640 |
+ done |
2641 |
+} |
2642 |
+ |
2643 |
pkg_postinst() { |
2644 |
postgresql-config update |
2645 |
|
2646 |
elog "If you need a global psqlrc-file, you can place it in:" |
2647 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
2648 |
|
2649 |
- if [[ -z ${REPLACING_VERSIONS} ]] ; then |
2650 |
- elog |
2651 |
- elog "It looks like this is your first time installing PostgreSQL. Run the" |
2652 |
- elog "following command in all active shells to pick up changes to the default" |
2653 |
- elog "environment:" |
2654 |
- elog " source /etc/profile" |
2655 |
- fi |
2656 |
- |
2657 |
elog |
2658 |
elog "Gentoo specific documentation:" |
2659 |
elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
2660 |
@@ -297,21 +341,10 @@ pkg_config() { |
2661 |
einfo "The database cluster will be created in:" |
2662 |
einfo " ${DATA_DIR}" |
2663 |
einfo |
2664 |
- if [ -z "$PG_AUTOCONFIG" ] ; then |
2665 |
- while [ "$correct" != "true" ] ; do |
2666 |
- einfo "Are you ready to continue? (y/n)" |
2667 |
- read answer |
2668 |
- if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
2669 |
- correct="true" |
2670 |
- elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
2671 |
- die "Aborting initialization." |
2672 |
- else |
2673 |
- echo "Answer not recognized" |
2674 |
- fi |
2675 |
- done |
2676 |
- else |
2677 |
- einfo "PG_AUTOCONFIG set, not prompting" |
2678 |
- fi |
2679 |
+ |
2680 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
2681 |
+ sleep 5 |
2682 |
+ eend 0 |
2683 |
|
2684 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
2685 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
2686 |
@@ -339,6 +372,10 @@ pkg_config() { |
2687 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
2688 |
fi |
2689 |
|
2690 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
2691 |
+ # overridden in the initscript |
2692 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
2693 |
+ |
2694 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
2695 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
2696 |
# On the off-chance that you might need to work with UTF-8 encoded |