Gentoo Archives: gentoo-commits

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