1 |
commit: 0c589d89d5916b41f547eb8889935d4a448ff8fe |
2 |
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Sep 23 20:48:37 2021 +0000 |
4 |
Commit: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Sep 23 20:48:37 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c589d89 |
7 |
|
8 |
dev-db/postgresql: Bump to 14_rc1 |
9 |
|
10 |
Signed-off-by: Aaron W. Swenson <titanofold <AT> gentoo.org> |
11 |
|
12 |
.../files/postgresql-14_rc1-no-server.patch | 151 +++++++ |
13 |
dev-db/postgresql/postgresql-14_rc1.ebuild | 467 +++++++++++++++++++++ |
14 |
2 files changed, 618 insertions(+) |
15 |
|
16 |
diff --git a/dev-db/postgresql/files/postgresql-14_rc1-no-server.patch b/dev-db/postgresql/files/postgresql-14_rc1-no-server.patch |
17 |
new file mode 100644 |
18 |
index 00000000000..4f2d388386a |
19 |
--- /dev/null |
20 |
+++ b/dev-db/postgresql/files/postgresql-14_rc1-no-server.patch |
21 |
@@ -0,0 +1,151 @@ |
22 |
+diff -Naruw a/contrib/Makefile b/contrib/Makefile |
23 |
+--- a/contrib/Makefile 2021-09-20 17:33:01.000000000 -0400 |
24 |
++++ b/contrib/Makefile 2021-09-23 16:28:52.919265033 -0400 |
25 |
+@@ -5,57 +5,9 @@ |
26 |
+ include $(top_builddir)/src/Makefile.global |
27 |
+ |
28 |
+ SUBDIRS = \ |
29 |
+- adminpack \ |
30 |
+- amcheck \ |
31 |
+- auth_delay \ |
32 |
+- auto_explain \ |
33 |
+- bloom \ |
34 |
+- btree_gin \ |
35 |
+- btree_gist \ |
36 |
+- citext \ |
37 |
+- cube \ |
38 |
+- dblink \ |
39 |
+- dict_int \ |
40 |
+- dict_xsyn \ |
41 |
+- earthdistance \ |
42 |
+- file_fdw \ |
43 |
+- fuzzystrmatch \ |
44 |
+- hstore \ |
45 |
+- intagg \ |
46 |
+- intarray \ |
47 |
+- isn \ |
48 |
+- lo \ |
49 |
+- ltree \ |
50 |
+ oid2name \ |
51 |
+- old_snapshot \ |
52 |
+- pageinspect \ |
53 |
+- passwordcheck \ |
54 |
+- pg_buffercache \ |
55 |
+- pg_freespacemap \ |
56 |
+- pg_prewarm \ |
57 |
+- pg_stat_statements \ |
58 |
+- pg_surgery \ |
59 |
+- pg_trgm \ |
60 |
+- pgcrypto \ |
61 |
+- pgrowlocks \ |
62 |
+- pgstattuple \ |
63 |
+- pg_visibility \ |
64 |
+- postgres_fdw \ |
65 |
+- seg \ |
66 |
+- spi \ |
67 |
+- tablefunc \ |
68 |
+- tcn \ |
69 |
+- test_decoding \ |
70 |
+- tsm_system_rows \ |
71 |
+- tsm_system_time \ |
72 |
+- unaccent \ |
73 |
+ vacuumlo |
74 |
+ |
75 |
+-ifeq ($(with_ssl),openssl) |
76 |
+-SUBDIRS += sslinfo |
77 |
+-else |
78 |
+-ALWAYS_SUBDIRS += sslinfo |
79 |
+-endif |
80 |
+ |
81 |
+ ifneq ($(with_uuid),no) |
82 |
+ SUBDIRS += uuid-ossp |
83 |
+diff -Naruw a/src/backend/Makefile b/src/backend/Makefile |
84 |
+--- a/src/backend/Makefile 2021-09-20 17:33:01.000000000 -0400 |
85 |
++++ b/src/backend/Makefile 2021-09-23 16:30:03.015728022 -0400 |
86 |
+@@ -56,7 +56,7 @@ |
87 |
+ |
88 |
+ ########################################################################## |
89 |
+ |
90 |
+-all: submake-libpgport submake-catalog-headers submake-utils-headers postgres $(POSTGRES_IMP) |
91 |
++all: generated-headers |
92 |
+ |
93 |
+ ifneq ($(PORTNAME), cygwin) |
94 |
+ ifneq ($(PORTNAME), win32) |
95 |
+@@ -194,23 +194,7 @@ |
96 |
+ |
97 |
+ ########################################################################## |
98 |
+ |
99 |
+-install: all installdirs install-bin |
100 |
+-ifeq ($(PORTNAME), cygwin) |
101 |
+-ifeq ($(MAKE_DLL), true) |
102 |
+- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a' |
103 |
+-endif |
104 |
+-endif |
105 |
+-ifeq ($(PORTNAME), win32) |
106 |
+-ifeq ($(MAKE_DLL), true) |
107 |
+- $(INSTALL_DATA) libpostgres.a '$(DESTDIR)$(libdir)/libpostgres.a' |
108 |
+-endif |
109 |
+-endif |
110 |
+- $(MAKE) -C catalog install-data |
111 |
+- $(MAKE) -C tsearch install-data |
112 |
+- $(MAKE) -C utils install-data |
113 |
+- $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample' |
114 |
+- $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample' |
115 |
+- $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample' |
116 |
++install: |
117 |
+ |
118 |
+ ifeq ($(with_llvm), yes) |
119 |
+ install-bin: install-postgres-bitcode |
120 |
+diff -Naruw a/src/bin/Makefile b/src/bin/Makefile |
121 |
+--- a/src/bin/Makefile 2021-09-20 17:33:01.000000000 -0400 |
122 |
++++ b/src/bin/Makefile 2021-09-23 16:30:50.718922745 -0400 |
123 |
+@@ -14,23 +14,8 @@ |
124 |
+ include $(top_builddir)/src/Makefile.global |
125 |
+ |
126 |
+ SUBDIRS = \ |
127 |
+- initdb \ |
128 |
+- pg_amcheck \ |
129 |
+- pg_archivecleanup \ |
130 |
+- pg_basebackup \ |
131 |
+- pg_checksums \ |
132 |
+ pg_config \ |
133 |
+- pg_controldata \ |
134 |
+- pg_ctl \ |
135 |
+ pg_dump \ |
136 |
+- pg_resetwal \ |
137 |
+- pg_rewind \ |
138 |
+- pg_test_fsync \ |
139 |
+- pg_test_timing \ |
140 |
+- pg_upgrade \ |
141 |
+- pg_verifybackup \ |
142 |
+- pg_waldump \ |
143 |
+- pgbench \ |
144 |
+ psql \ |
145 |
+ scripts |
146 |
+ |
147 |
+diff -Naruw a/src/Makefile b/src/Makefile |
148 |
+--- a/src/Makefile 2021-09-20 17:33:01.000000000 -0400 |
149 |
++++ b/src/Makefile 2021-09-23 16:31:41.842107531 -0400 |
150 |
+@@ -15,21 +15,12 @@ |
151 |
+ SUBDIRS = \ |
152 |
+ common \ |
153 |
+ port \ |
154 |
+- timezone \ |
155 |
+ backend \ |
156 |
+- backend/utils/mb/conversion_procs \ |
157 |
+- backend/snowball \ |
158 |
+ include \ |
159 |
+ interfaces \ |
160 |
+- backend/replication/libpqwalreceiver \ |
161 |
+- backend/replication/pgoutput \ |
162 |
+ fe_utils \ |
163 |
+ bin \ |
164 |
+- pl \ |
165 |
+- makefiles \ |
166 |
+- test/regress \ |
167 |
+- test/isolation \ |
168 |
+- test/perl |
169 |
++ makefiles |
170 |
+ |
171 |
+ ifeq ($(with_llvm), yes) |
172 |
+ SUBDIRS += backend/jit/llvm |
173 |
|
174 |
diff --git a/dev-db/postgresql/postgresql-14_rc1.ebuild b/dev-db/postgresql/postgresql-14_rc1.ebuild |
175 |
new file mode 100644 |
176 |
index 00000000000..2d16338b843 |
177 |
--- /dev/null |
178 |
+++ b/dev-db/postgresql/postgresql-14_rc1.ebuild |
179 |
@@ -0,0 +1,467 @@ |
180 |
+# Copyright 1999-2021 Gentoo Authors |
181 |
+# Distributed under the terms of the GNU General Public License v2 |
182 |
+ |
183 |
+EAPI=7 |
184 |
+ |
185 |
+PYTHON_COMPAT=( python3_{8,9,10} ) |
186 |
+ |
187 |
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd tmpfiles |
188 |
+ |
189 |
+KEYWORDS="" |
190 |
+ |
191 |
+SLOT=$(ver_cut 1) |
192 |
+ |
193 |
+MY_PV=${PV/_/} |
194 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
195 |
+ |
196 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
197 |
+ |
198 |
+LICENSE="POSTGRESQL GPL-2" |
199 |
+DESCRIPTION="PostgreSQL RDBMS" |
200 |
+HOMEPAGE="https://www.postgresql.org/" |
201 |
+ |
202 |
+IUSE="debug doc icu kerberos kernel_linux ldap llvm lz4 nls pam |
203 |
+ perl python +readline selinux +server systemd ssl static-libs tcl |
204 |
+ threads uuid xml zlib" |
205 |
+ |
206 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
207 |
+ |
208 |
+CDEPEND=" |
209 |
+>=app-eselect/eselect-postgresql-2.0 |
210 |
+acct-group/postgres |
211 |
+acct-user/postgres |
212 |
+sys-apps/less |
213 |
+virtual/libintl |
214 |
+icu? ( dev-libs/icu:= ) |
215 |
+kerberos? ( virtual/krb5 ) |
216 |
+ldap? ( net-nds/openldap ) |
217 |
+llvm? ( |
218 |
+ sys-devel/llvm:= |
219 |
+ sys-devel/clang:= |
220 |
+) |
221 |
+lz4? ( app-arch/lz4 ) |
222 |
+pam? ( sys-libs/pam ) |
223 |
+perl? ( >=dev-lang/perl-5.8:= ) |
224 |
+python? ( ${PYTHON_DEPS} ) |
225 |
+readline? ( sys-libs/readline:0= ) |
226 |
+server? ( systemd? ( sys-apps/systemd ) ) |
227 |
+ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
228 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
229 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
230 |
+zlib? ( sys-libs/zlib ) |
231 |
+" |
232 |
+ |
233 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
234 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
235 |
+# the libc includes UUID functions. |
236 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
237 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
238 |
+ |
239 |
+nest_usedep() { |
240 |
+ local front back |
241 |
+ while [[ ${#} -gt 1 ]]; do |
242 |
+ front+="${1}? ( " |
243 |
+ back+=" )" |
244 |
+ shift |
245 |
+ done |
246 |
+ echo "${front}${1}${back}" |
247 |
+} |
248 |
+ |
249 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
250 |
+CDEPEND+=" |
251 |
+uuid? ( |
252 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
253 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
254 |
+)" |
255 |
+ |
256 |
+DEPEND="${CDEPEND} |
257 |
+sys-devel/bison |
258 |
+sys-devel/flex |
259 |
+nls? ( sys-devel/gettext ) |
260 |
+xml? ( virtual/pkgconfig ) |
261 |
+" |
262 |
+ |
263 |
+RDEPEND="${CDEPEND} |
264 |
+selinux? ( sec-policy/selinux-postgresql ) |
265 |
+" |
266 |
+ |
267 |
+pkg_setup() { |
268 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
269 |
+ |
270 |
+ use python && python-single-r1_pkg_setup |
271 |
+} |
272 |
+ |
273 |
+src_prepare() { |
274 |
+ # Set proper run directory |
275 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
276 |
+ -i src/include/pg_config_manual.h || die |
277 |
+ |
278 |
+ # Rely on $PATH being in the proper order so that the correct |
279 |
+ # install program is used for modules utilizing PGXS in both |
280 |
+ # hardened and non-hardened environments. (Bug #528786) |
281 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
282 |
+ |
283 |
+ use server || eapply "${FILESDIR}/${PN}-14_rc1-no-server.patch" |
284 |
+ |
285 |
+ if use pam ; then |
286 |
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
287 |
+ -i src/backend/libpq/auth.c || \ |
288 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
289 |
+ fi |
290 |
+ |
291 |
+ eapply_user |
292 |
+} |
293 |
+ |
294 |
+src_configure() { |
295 |
+ case ${CHOST} in |
296 |
+ *-darwin*|*-solaris*) |
297 |
+ use nls && append-libs intl |
298 |
+ ;; |
299 |
+ esac |
300 |
+ |
301 |
+ export LDFLAGS_SL="${LDFLAGS}" |
302 |
+ export LDFLAGS_EX="${LDFLAGS}" |
303 |
+ |
304 |
+ local PO="${EPREFIX}" |
305 |
+ |
306 |
+ local i uuid_config="" |
307 |
+ if use uuid; then |
308 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
309 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
310 |
+ done |
311 |
+ for i in ${BSD_LIBC[@]}; do |
312 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
313 |
+ done |
314 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
315 |
+ fi |
316 |
+ |
317 |
+ local myconf="\ |
318 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
319 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
320 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
321 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
322 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
323 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
324 |
+ $(use_enable debug) \ |
325 |
+ $(use_enable threads thread-safety) \ |
326 |
+ $(use_with icu) \ |
327 |
+ $(use_with kerberos gssapi) \ |
328 |
+ $(use_with ldap) \ |
329 |
+ $(use_with llvm) \ |
330 |
+ $(use_with lz4) \ |
331 |
+ $(use_with pam) \ |
332 |
+ $(use_with perl) \ |
333 |
+ $(use_with python) \ |
334 |
+ $(use_with readline) \ |
335 |
+ $(use_with ssl openssl) \ |
336 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
337 |
+ $(use_with tcl) \ |
338 |
+ ${uuid_config} \ |
339 |
+ $(use_with xml libxml) \ |
340 |
+ $(use_with xml libxslt) \ |
341 |
+ $(use_with zlib) \ |
342 |
+ $(use_enable nls)" |
343 |
+ if use alpha; then |
344 |
+ myconf+=" --disable-spinlocks" |
345 |
+ else |
346 |
+ # Should be the default but just in case |
347 |
+ myconf+=" --enable-spinlocks" |
348 |
+ fi |
349 |
+ econf ${myconf} |
350 |
+} |
351 |
+ |
352 |
+src_compile() { |
353 |
+ emake |
354 |
+ emake -C contrib |
355 |
+} |
356 |
+ |
357 |
+src_install() { |
358 |
+ emake DESTDIR="${D}" install |
359 |
+ emake DESTDIR="${D}" install -C contrib |
360 |
+ |
361 |
+ dodoc README HISTORY |
362 |
+ |
363 |
+ # man pages are already built, but if we have the target make them, |
364 |
+ # they'll be generated from source before being installed so we |
365 |
+ # manually install man pages. |
366 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
367 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
368 |
+ doins -r doc/src/sgml/man{1,3,7} |
369 |
+ if ! use server; then |
370 |
+ # Remove man pages for non-existent binaries |
371 |
+ serverman=( |
372 |
+ initdb |
373 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
374 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
375 |
+ post{gres,master} |
376 |
+ ) |
377 |
+ for m in ${serverman[@]} ; do |
378 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
379 |
+ done |
380 |
+ fi |
381 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
382 |
+ |
383 |
+ # Create slot specific man pages |
384 |
+ local bn f mansec slotted_name |
385 |
+ for mansec in 1 3 7 ; do |
386 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
387 |
+ |
388 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
389 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
390 |
+ |
391 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
392 |
+ bn=$(basename "${f}") |
393 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
394 |
+ case ${bn} in |
395 |
+ TABLE.7|WITH.7) |
396 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
397 |
+ ;; |
398 |
+ *) |
399 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
400 |
+ ;; |
401 |
+ esac |
402 |
+ done |
403 |
+ |
404 |
+ popd > /dev/null |
405 |
+ done |
406 |
+ |
407 |
+ insinto /etc/postgresql-${SLOT} |
408 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
409 |
+ |
410 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
411 |
+ # needed by extensions utilizing PGXS. |
412 |
+ use static-libs || \ |
413 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
414 |
+ -delete |
415 |
+ |
416 |
+ # Make slot specific links to programs |
417 |
+ local f bn |
418 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
419 |
+ -mindepth 1 -maxdepth 1) |
420 |
+ do |
421 |
+ bn=$(basename "${f}") |
422 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
423 |
+ "/usr/bin/${bn}${SLOT/.}" |
424 |
+ done |
425 |
+ |
426 |
+ if use doc ; then |
427 |
+ docinto html |
428 |
+ dodoc doc/src/sgml/html/* |
429 |
+ fi |
430 |
+ |
431 |
+ if use server; then |
432 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
433 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
434 |
+ |
435 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
436 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
437 |
+ |
438 |
+ if use systemd; then |
439 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
440 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
441 |
+ systemd_newunit - ${PN}-${SLOT}.service |
442 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
443 |
+ newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
444 |
+ fi |
445 |
+ |
446 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
447 |
+ |
448 |
+ if use prefix ; then |
449 |
+ keepdir /run/postgresql |
450 |
+ fperms 1775 /run/postgresql |
451 |
+ fi |
452 |
+ fi |
453 |
+} |
454 |
+ |
455 |
+pkg_postinst() { |
456 |
+ use server && use systemd && tmpfiles_process ${PN}-${SLOT}.conf |
457 |
+ postgresql-config update |
458 |
+ |
459 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
460 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
461 |
+ |
462 |
+ if use server ; then |
463 |
+ elog |
464 |
+ elog "Gentoo specific documentation:" |
465 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
466 |
+ elog |
467 |
+ elog "Official documentation:" |
468 |
+ elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
469 |
+ elog |
470 |
+ elog "The default location of the Unix-domain socket is:" |
471 |
+ elog " ${EROOT}/run/postgresql/" |
472 |
+ elog |
473 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
474 |
+ elog "so that it contains your preferred locale in:" |
475 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
476 |
+ elog |
477 |
+ elog "Then, execute the following command to setup the initial database" |
478 |
+ elog "environment:" |
479 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
480 |
+ |
481 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
482 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
483 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
484 |
+ ewarn "the following command after upgrading:" |
485 |
+ ewarn |
486 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
487 |
+ fi |
488 |
+ fi |
489 |
+} |
490 |
+ |
491 |
+pkg_prerm() { |
492 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
493 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
494 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
495 |
+ |
496 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
497 |
+ sleep 10 |
498 |
+ eend 0 |
499 |
+ fi |
500 |
+} |
501 |
+ |
502 |
+pkg_postrm() { |
503 |
+ postgresql-config update |
504 |
+} |
505 |
+ |
506 |
+pkg_config() { |
507 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
508 |
+ |
509 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
510 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
511 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
512 |
+ [[ -z "${DATA_DIR}" ]] \ |
513 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
514 |
+ |
515 |
+ # environment.bz2 may not contain the same locale as the current system |
516 |
+ # locale. Unset and source from the current system locale. |
517 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
518 |
+ unset LANG |
519 |
+ unset LC_CTYPE |
520 |
+ unset LC_NUMERIC |
521 |
+ unset LC_TIME |
522 |
+ unset LC_COLLATE |
523 |
+ unset LC_MONETARY |
524 |
+ unset LC_MESSAGES |
525 |
+ unset LC_ALL |
526 |
+ source "${EROOT}/etc/env.d/02locale" |
527 |
+ [ -n "${LANG}" ] && export LANG |
528 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
529 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
530 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
531 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
532 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
533 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
534 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
535 |
+ fi |
536 |
+ |
537 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
538 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
539 |
+ einfo |
540 |
+ einfo "Information on options that can be passed to initdb are found at:" |
541 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
542 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
543 |
+ einfo |
544 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
545 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
546 |
+ einfo " (none)" |
547 |
+ else |
548 |
+ einfo " ${PG_INITDB_OPTS}" |
549 |
+ fi |
550 |
+ einfo |
551 |
+ einfo "Configuration files will be installed to:" |
552 |
+ einfo " ${PGDATA}" |
553 |
+ einfo |
554 |
+ einfo "The database cluster will be created in:" |
555 |
+ einfo " ${DATA_DIR}" |
556 |
+ einfo |
557 |
+ |
558 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
559 |
+ sleep 5 |
560 |
+ eend 0 |
561 |
+ |
562 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
563 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
564 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
565 |
+ die "${DATA_DIR} is not empty." |
566 |
+ fi |
567 |
+ |
568 |
+ einfo "Creating the data directory ..." |
569 |
+ if [[ ${EUID} == 0 ]] ; then |
570 |
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs" |
571 |
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR" |
572 |
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown" |
573 |
+ fi |
574 |
+ |
575 |
+ einfo "Initializing the database ..." |
576 |
+ |
577 |
+ if [[ ${EUID} == 0 ]] ; then |
578 |
+ su - postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
579 |
+ else |
580 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
581 |
+ fi |
582 |
+ |
583 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
584 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
585 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
586 |
+ fi |
587 |
+ |
588 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
589 |
+ # overridden in the initscript |
590 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
591 |
+ |
592 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
593 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
594 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
595 |
+ # characters in PL/Perl |
596 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
597 |
+ EOF |
598 |
+ |
599 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
600 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
601 |
+ einfo "by default. You can disable it in the cluster's:" |
602 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
603 |
+ einfo |
604 |
+ if ! use systemd; then |
605 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
606 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
607 |
+ einfo |
608 |
+ fi |
609 |
+ if use prefix ; then |
610 |
+ einfo "The location of the configuration files have moved to:" |
611 |
+ einfo " ${PGDATA}" |
612 |
+ einfo "To start the server:" |
613 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
614 |
+ einfo "To stop:" |
615 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
616 |
+ einfo |
617 |
+ einfo "Or move the configuration files back:" |
618 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
619 |
+ elif use systemd; then |
620 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
621 |
+ einfo "instead of 'pg_ctl'." |
622 |
+ else |
623 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
624 |
+ einfo "instead of 'pg_ctl'." |
625 |
+ fi |
626 |
+} |
627 |
+ |
628 |
+src_test() { |
629 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
630 |
+ # Some ICU tests fail if LC_CTYPE and LC_COLLATE aren't the same. We set |
631 |
+ # LC_CTYPE to be equal to LC_COLLATE since LC_COLLATE is set by Portage. |
632 |
+ local old_ctype=${LC_CTYPE} |
633 |
+ export LC_CTYPE=${LC_COLLATE} |
634 |
+ emake check |
635 |
+ export LC_CTYPE=${old_ctype} |
636 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
637 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
638 |
+ else |
639 |
+ use server || \ |
640 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
641 |
+ [[ ${UID} -eq 0 ]] || \ |
642 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
643 |
+ |
644 |
+ ewarn 'Skipping.' |
645 |
+ fi |
646 |
+} |