Gentoo Archives: gentoo-commits

From: Aaron Swenson <titanofold@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/postgresql/
Date: Tue, 15 Dec 2015 21:40:34
Message-Id: 1450215591.17eb751adda1ed29ae00e12e47199b09ff7f4673.titanofold@gentoo
1 commit: 17eb751adda1ed29ae00e12e47199b09ff7f4673
2 Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
3 AuthorDate: Tue Dec 15 21:39:51 2015 +0000
4 Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
5 CommitDate: Tue Dec 15 21:39:51 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=17eb751a
7
8 dev-db/postgresql: Hardcode install
9
10 Rely on $PATH being in the proper order so that the correct install
11 program is used for modules utilizing PGXS in both hardened and
12 non-hardened environments.
13
14 Bug: 528786
15
16 Package-Manager: portage-2.2.20.1
17
18 ...sql-9999.ebuild => postgresql-9.3.10-r2.ebuild} | 150 +++++++++-------
19 ...esql-9999.ebuild => postgresql-9.4.5-r2.ebuild} | 186 +++++++++++++-------
20 ...-9999.ebuild => postgresql-9.5_beta2-r1.ebuild} | 194 +++++++++++++--------
21 dev-db/postgresql/postgresql-9999.ebuild | 5 +
22 4 files changed, 334 insertions(+), 201 deletions(-)
23
24 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.3.10-r2.ebuild
25 similarity index 70%
26 copy from dev-db/postgresql/postgresql-9999.ebuild
27 copy to dev-db/postgresql/postgresql-9.3.10-r2.ebuild
28 index c2fe866..d08a3dd 100644
29 --- a/dev-db/postgresql/postgresql-9999.ebuild
30 +++ b/dev-db/postgresql/postgresql-9.3.10-r2.ebuild
31 @@ -6,15 +6,14 @@ EAPI="5"
32
33 PYTHON_COMPAT=( python{2_7,3_4} )
34
35 -inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \
36 - python-single-r1 systemd user versionator
37 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
38 + systemd user versionator
39
40 -KEYWORDS=""
41 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
42
43 -# Fix if needed
44 -SLOT="9.6"
45 +SLOT="$(get_version_component_range 1-2)"
46
47 -EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
48 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
49
50 LICENSE="POSTGRESQL GPL-2"
51 DESCRIPTION="PostgreSQL RDBMS"
52 @@ -22,7 +21,7 @@ HOMEPAGE="http://www.postgresql.org/"
53
54 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
55 zh_CN zh_TW"
56 -IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
57 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
58 +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
59
60 for lingua in ${LINGUAS}; do
61 @@ -61,23 +60,11 @@ zlib? ( sys-libs/zlib )
62
63 DEPEND="${CDEPEND}
64 !!<sys-apps/sandbox-2.0
65 ->=dev-lang/perl-5.8
66 -app-text/docbook-dsssl-stylesheets
67 -app-text/docbook-sgml-dtd:4.2
68 -app-text/docbook-xml-dtd:4.2
69 -app-text/docbook-xsl-stylesheets
70 -app-text/openjade
71 -dev-libs/libxml2
72 -dev-libs/libxslt
73 sys-devel/bison
74 sys-devel/flex
75 nls? ( sys-devel/gettext )
76 xml? ( virtual/pkgconfig )
77 "
78 -src_unpack() {
79 - base_src_unpack
80 - git-2_src_unpack
81 -}
82
83 RDEPEND="${CDEPEND}
84 !dev-db/postgresql-docs:${SLOT}
85 @@ -86,17 +73,8 @@ RDEPEND="${CDEPEND}
86 selinux? ( sec-policy/selinux-postgresql )
87 "
88
89 -pkg_pretend() {
90 - ewarn "You are using a live ebuild that uses the current source code as it is"
91 - ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
92 - ewarn "the GNU Makefiles may be altered by upstream without notice and the"
93 - ewarn "documentation for this live version is not readily available"
94 - ewarn "online. Ergo, the ebuild maintainers will not support building a"
95 - ewarn "client-only and/or document-free version."
96 -}
97 -
98 pkg_setup() {
99 - CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
100 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
101
102 enewgroup postgres 70
103 enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
104 @@ -112,6 +90,17 @@ src_prepare() {
105 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
106 -i src/include/pg_config_manual.h || die
107
108 + # Rely on $PATH being in the proper order so that the correct
109 + # install program is used for modules utilizing PGXS in both
110 + # hardened and non-hardened environments. (Bug #528786)
111 + sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
112 +
113 + use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
114 +
115 + # Fix bug 486556 where the server would crash at start up because of
116 + # an infinite loop caused by a self-referencing symlink.
117 + epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch"
118 +
119 if use pam ; then
120 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
121 -i src/backend/libpq/auth.c || \
122 @@ -144,6 +133,7 @@ src_configure() {
123 $(use_enable !pg_legacytimestamp integer-datetimes) \
124 $(use_enable threads thread-safety) \
125 $(use_with kerberos gssapi) \
126 + $(use_with kerberos krb5) \
127 $(use_with ldap) \
128 $(use_with pam) \
129 $(use_with perl) \
130 @@ -159,14 +149,30 @@ src_configure() {
131 }
132
133 src_compile() {
134 - emake world
135 + emake
136 + emake -C contrib
137 }
138
139 src_install() {
140 - emake DESTDIR="${D}" install-world
141 + emake DESTDIR="${D}" install
142 + emake DESTDIR="${D}" install -C contrib
143
144 dodoc README HISTORY doc/{TODO,bug.template}
145
146 + # man pages are already built, but if we have the target make them,
147 + # they'll be generated from source before being installed so we
148 + # manually install man pages.
149 + # We use ${SLOT} instead of doman for postgresql.eselect
150 + insinto /usr/share/postgresql-${SLOT}/man/
151 + doins -r doc/src/sgml/man{1,3,7}
152 + if ! use server; then
153 + # Remove man pages for non-existent binaries
154 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
155 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
156 + done
157 + fi
158 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
159 +
160 insinto /etc/postgresql-${SLOT}
161 newins src/bin/psql/psqlrc.sample psqlrc
162
163 @@ -176,23 +182,33 @@ src_install() {
164
165 use static-libs || find "${ED}" -name '*.a' -delete
166
167 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
168 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
169 + if use doc ; then
170 + docinto html
171 + dodoc doc/src/sgml/html/*
172
173 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
174 - "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT}
175 + docinto sgml
176 + dodoc doc/src/sgml/*.{sgml,dsl}
177 + fi
178
179 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
180 - "${FILESDIR}/${PN}.service" | \
181 - systemd_newunit - ${PN}-${SLOT}.service
182 + if use server; then
183 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
184 + "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
185
186 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
187 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
188 + "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT}
189
190 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
191 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
192 + "${FILESDIR}/${PN}.service" | \
193 + systemd_newunit - ${PN}-${SLOT}.service
194
195 - if use prefix ; then
196 - keepdir /run/postgresql
197 - fperms 0775 /run/postgresql
198 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
199 +
200 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
201 +
202 + if use prefix ; then
203 + keepdir /run/postgresql
204 + fperms 0775 /run/postgresql
205 + fi
206 fi
207 }
208
209 @@ -210,27 +226,29 @@ pkg_postinst() {
210 elog " source /etc/profile"
211 fi
212
213 - elog
214 - elog "Gentoo specific documentation:"
215 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
216 - elog
217 - elog "Official documentation:"
218 - elog "${EROOT%/}/usr/share/doc/${PF}/html"
219 - elog
220 - elog "The default location of the Unix-domain socket is:"
221 - elog " ${EROOT%/}/run/postgresql/"
222 - elog
223 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
224 - elog "so that it contains your preferred locale, and other options, in:"
225 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
226 - elog
227 - elog "Then, execute the following command to setup the initial database"
228 - elog "environment:"
229 - elog " emerge --config =${CATEGORY}/${PF}"
230 + if use server ; then
231 + elog
232 + elog "Gentoo specific documentation:"
233 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
234 + elog
235 + elog "Official documentation:"
236 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
237 + elog
238 + elog "The default location of the Unix-domain socket is:"
239 + elog " ${EROOT%/}/run/postgresql/"
240 + elog
241 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
242 + elog "so that it contains your preferred locale in:"
243 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
244 + elog
245 + elog "Then, execute the following command to setup the initial database"
246 + elog "environment:"
247 + elog " emerge --config =${CATEGORY}/${PF}"
248 + fi
249 }
250
251 pkg_prerm() {
252 - if [[ -z ${REPLACED_BY_VERSION} ]] ; then
253 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
254 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
255 ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
256
257 @@ -245,6 +263,8 @@ pkg_postrm() {
258 }
259
260 pkg_config() {
261 + use server || die "USE flag 'server' not enabled. Nothing to configure."
262 +
263 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
264 && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
265 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
266 @@ -365,15 +385,17 @@ pkg_config() {
267 src_test() {
268 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
269
270 - if [[ ${UID} -ne 0 ]] ; then
271 + if use server && [[ ${UID} -ne 0 ]] ; then
272 emake check
273
274 einfo "If you think other tests besides the regression tests are necessary, please"
275 einfo "submit a bug including a patch for this ebuild to enable them."
276 else
277 + use server || \
278 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
279 [[ ${UID} -eq 0 ]] || \
280 - ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
281 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
282
283 - ewarn "Skipping."
284 + ewarn 'Skipping.'
285 fi
286 }
287
288 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.4.5-r2.ebuild
289 similarity index 65%
290 copy from dev-db/postgresql/postgresql-9999.ebuild
291 copy to dev-db/postgresql/postgresql-9.4.5-r2.ebuild
292 index c2fe866..3a8c797 100644
293 --- a/dev-db/postgresql/postgresql-9999.ebuild
294 +++ b/dev-db/postgresql/postgresql-9.4.5-r2.ebuild
295 @@ -6,15 +6,14 @@ EAPI="5"
296
297 PYTHON_COMPAT=( python{2_7,3_4} )
298
299 -inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \
300 - python-single-r1 systemd user versionator
301 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
302 + systemd user versionator
303
304 -KEYWORDS=""
305 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
306
307 -# Fix if needed
308 -SLOT="9.6"
309 +SLOT="$(get_version_component_range 1-2)"
310
311 -EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
312 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
313
314 LICENSE="POSTGRESQL GPL-2"
315 DESCRIPTION="PostgreSQL RDBMS"
316 @@ -22,7 +21,7 @@ HOMEPAGE="http://www.postgresql.org/"
317
318 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
319 zh_CN zh_TW"
320 -IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
321 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
322 +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
323
324 for lingua in ${LINGUAS}; do
325 @@ -54,30 +53,40 @@ ssl? (
326 libressl? ( dev-libs/libressl:= )
327 )
328 tcl? ( >=dev-lang/tcl-8:0= )
329 -uuid? ( dev-libs/ossp-uuid )
330 xml? ( dev-libs/libxml2 dev-libs/libxslt )
331 zlib? ( sys-libs/zlib )
332 "
333
334 +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
335 +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
336 +# the libc includes UUID functions.
337 +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
338 +BSD_LIBC=( elibc_{Free,Net,Open}BSD )
339 +
340 +nest_usedep() {
341 + local front back
342 + while [[ ${#} -gt 1 ]]; do
343 + front+="${1}? ( "
344 + back+=" )"
345 + shift
346 + done
347 + echo "${front}${1}${back}"
348 +}
349 +
350 +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
351 +CDEPEND+="
352 +uuid? (
353 + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
354 + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
355 +)"
356 +
357 DEPEND="${CDEPEND}
358 !!<sys-apps/sandbox-2.0
359 ->=dev-lang/perl-5.8
360 -app-text/docbook-dsssl-stylesheets
361 -app-text/docbook-sgml-dtd:4.2
362 -app-text/docbook-xml-dtd:4.2
363 -app-text/docbook-xsl-stylesheets
364 -app-text/openjade
365 -dev-libs/libxml2
366 -dev-libs/libxslt
367 sys-devel/bison
368 sys-devel/flex
369 nls? ( sys-devel/gettext )
370 xml? ( virtual/pkgconfig )
371 "
372 -src_unpack() {
373 - base_src_unpack
374 - git-2_src_unpack
375 -}
376
377 RDEPEND="${CDEPEND}
378 !dev-db/postgresql-docs:${SLOT}
379 @@ -86,17 +95,8 @@ RDEPEND="${CDEPEND}
380 selinux? ( sec-policy/selinux-postgresql )
381 "
382
383 -pkg_pretend() {
384 - ewarn "You are using a live ebuild that uses the current source code as it is"
385 - ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
386 - ewarn "the GNU Makefiles may be altered by upstream without notice and the"
387 - ewarn "documentation for this live version is not readily available"
388 - ewarn "online. Ergo, the ebuild maintainers will not support building a"
389 - ewarn "client-only and/or document-free version."
390 -}
391 -
392 pkg_setup() {
393 - CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
394 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
395
396 enewgroup postgres 70
397 enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
398 @@ -112,6 +112,17 @@ src_prepare() {
399 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
400 -i src/include/pg_config_manual.h || die
401
402 + # Rely on $PATH being in the proper order so that the correct
403 + # install program is used for modules utilizing PGXS in both
404 + # hardened and non-hardened environments. (Bug #528786)
405 + sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
406 +
407 + use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
408 +
409 + # Fix bug 486556 where the server would crash at start up because of
410 + # an infinite loop caused by a self-referencing symlink.
411 + epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch"
412 +
413 if use pam ; then
414 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
415 -i src/backend/libpq/auth.c || \
416 @@ -133,6 +144,17 @@ src_configure() {
417
418 local PO="${EPREFIX%/}"
419
420 + local i uuid_config=""
421 + if use uuid; then
422 + for i in ${UTIL_LINUX_LIBC[@]}; do
423 + use ${i} && uuid_config="--with-uuid=e2fs"
424 + done
425 + for i in ${BSD_LIBC[@]}; do
426 + use ${i} && uuid_config="--with-uuid=bsd"
427 + done
428 + [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
429 + fi
430 +
431 econf \
432 --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
433 --datadir="${PO}/usr/share/postgresql-${SLOT}" \
434 @@ -151,7 +173,7 @@ src_configure() {
435 $(use_with readline) \
436 $(use_with ssl openssl) \
437 $(use_with tcl) \
438 - $(use_with uuid ossp-uuid) \
439 + ${uuid_config} \
440 $(use_with xml libxml) \
441 $(use_with xml libxslt) \
442 $(use_with zlib) \
443 @@ -159,14 +181,30 @@ src_configure() {
444 }
445
446 src_compile() {
447 - emake world
448 + emake
449 + emake -C contrib
450 }
451
452 src_install() {
453 - emake DESTDIR="${D}" install-world
454 + emake DESTDIR="${D}" install
455 + emake DESTDIR="${D}" install -C contrib
456
457 dodoc README HISTORY doc/{TODO,bug.template}
458
459 + # man pages are already built, but if we have the target make them,
460 + # they'll be generated from source before being installed so we
461 + # manually install man pages.
462 + # We use ${SLOT} instead of doman for postgresql.eselect
463 + insinto /usr/share/postgresql-${SLOT}/man/
464 + doins -r doc/src/sgml/man{1,3,7}
465 + if ! use server; then
466 + # Remove man pages for non-existent binaries
467 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
468 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
469 + done
470 + fi
471 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
472 +
473 insinto /etc/postgresql-${SLOT}
474 newins src/bin/psql/psqlrc.sample psqlrc
475
476 @@ -176,23 +214,33 @@ src_install() {
477
478 use static-libs || find "${ED}" -name '*.a' -delete
479
480 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
481 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
482 + if use doc ; then
483 + docinto html
484 + dodoc doc/src/sgml/html/*
485 +
486 + docinto sgml
487 + dodoc doc/src/sgml/*.{sgml,dsl}
488 + fi
489
490 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
491 - "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT}
492 + if use server; then
493 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
494 + "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
495
496 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
497 - "${FILESDIR}/${PN}.service" | \
498 - systemd_newunit - ${PN}-${SLOT}.service
499 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
500 + "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT}
501
502 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
503 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
504 + "${FILESDIR}/${PN}.service" | \
505 + systemd_newunit - ${PN}-${SLOT}.service
506
507 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
508 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
509
510 - if use prefix ; then
511 - keepdir /run/postgresql
512 - fperms 0775 /run/postgresql
513 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
514 +
515 + if use prefix ; then
516 + keepdir /run/postgresql
517 + fperms 0775 /run/postgresql
518 + fi
519 fi
520 }
521
522 @@ -210,27 +258,29 @@ pkg_postinst() {
523 elog " source /etc/profile"
524 fi
525
526 - elog
527 - elog "Gentoo specific documentation:"
528 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
529 - elog
530 - elog "Official documentation:"
531 - elog "${EROOT%/}/usr/share/doc/${PF}/html"
532 - elog
533 - elog "The default location of the Unix-domain socket is:"
534 - elog " ${EROOT%/}/run/postgresql/"
535 - elog
536 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
537 - elog "so that it contains your preferred locale, and other options, in:"
538 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
539 - elog
540 - elog "Then, execute the following command to setup the initial database"
541 - elog "environment:"
542 - elog " emerge --config =${CATEGORY}/${PF}"
543 + if use server ; then
544 + elog
545 + elog "Gentoo specific documentation:"
546 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
547 + elog
548 + elog "Official documentation:"
549 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
550 + elog
551 + elog "The default location of the Unix-domain socket is:"
552 + elog " ${EROOT%/}/run/postgresql/"
553 + elog
554 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
555 + elog "so that it contains your preferred locale in:"
556 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
557 + elog
558 + elog "Then, execute the following command to setup the initial database"
559 + elog "environment:"
560 + elog " emerge --config =${CATEGORY}/${PF}"
561 + fi
562 }
563
564 pkg_prerm() {
565 - if [[ -z ${REPLACED_BY_VERSION} ]] ; then
566 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
567 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
568 ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
569
570 @@ -245,6 +295,8 @@ pkg_postrm() {
571 }
572
573 pkg_config() {
574 + use server || die "USE flag 'server' not enabled. Nothing to configure."
575 +
576 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
577 && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
578 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
579 @@ -365,15 +417,17 @@ pkg_config() {
580 src_test() {
581 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
582
583 - if [[ ${UID} -ne 0 ]] ; then
584 + if use server && [[ ${UID} -ne 0 ]] ; then
585 emake check
586
587 einfo "If you think other tests besides the regression tests are necessary, please"
588 einfo "submit a bug including a patch for this ebuild to enable them."
589 else
590 + use server || \
591 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
592 [[ ${UID} -eq 0 ]] || \
593 - ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
594 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
595
596 - ewarn "Skipping."
597 + ewarn 'Skipping.'
598 fi
599 }
600
601 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.5_beta2-r1.ebuild
602 similarity index 64%
603 copy from dev-db/postgresql/postgresql-9999.ebuild
604 copy to dev-db/postgresql/postgresql-9.5_beta2-r1.ebuild
605 index c2fe866..181c72e 100644
606 --- a/dev-db/postgresql/postgresql-9999.ebuild
607 +++ b/dev-db/postgresql/postgresql-9.5_beta2-r1.ebuild
608 @@ -6,15 +6,20 @@ EAPI="5"
609
610 PYTHON_COMPAT=( python{2_7,3_4} )
611
612 -inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \
613 - python-single-r1 systemd user versionator
614 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
615 + systemd user versionator
616
617 +# This is a prerelease version, so no keywords please
618 KEYWORDS=""
619 +#KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
620
621 -# Fix if needed
622 -SLOT="9.6"
623 +SLOT="$(get_version_component_range 1-2)"
624
625 -EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
626 +MY_PV=${PV/_/}
627 +
628 +S=${WORKDIR}/${PN}-${MY_PV}
629 +
630 +SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
631
632 LICENSE="POSTGRESQL GPL-2"
633 DESCRIPTION="PostgreSQL RDBMS"
634 @@ -22,7 +27,7 @@ HOMEPAGE="http://www.postgresql.org/"
635
636 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
637 zh_CN zh_TW"
638 -IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
639 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
640 +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
641
642 for lingua in ${LINGUAS}; do
643 @@ -54,30 +59,40 @@ ssl? (
644 libressl? ( dev-libs/libressl:= )
645 )
646 tcl? ( >=dev-lang/tcl-8:0= )
647 -uuid? ( dev-libs/ossp-uuid )
648 xml? ( dev-libs/libxml2 dev-libs/libxslt )
649 zlib? ( sys-libs/zlib )
650 "
651
652 +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
653 +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
654 +# the libc includes UUID functions.
655 +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
656 +BSD_LIBC=( elibc_{Free,Net,Open}BSD )
657 +
658 +nest_usedep() {
659 + local front back
660 + while [[ ${#} -gt 1 ]]; do
661 + front+="${1}? ( "
662 + back+=" )"
663 + shift
664 + done
665 + echo "${front}${1}${back}"
666 +}
667 +
668 +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
669 +CDEPEND+="
670 +uuid? (
671 + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
672 + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
673 +)"
674 +
675 DEPEND="${CDEPEND}
676 !!<sys-apps/sandbox-2.0
677 ->=dev-lang/perl-5.8
678 -app-text/docbook-dsssl-stylesheets
679 -app-text/docbook-sgml-dtd:4.2
680 -app-text/docbook-xml-dtd:4.2
681 -app-text/docbook-xsl-stylesheets
682 -app-text/openjade
683 -dev-libs/libxml2
684 -dev-libs/libxslt
685 sys-devel/bison
686 sys-devel/flex
687 nls? ( sys-devel/gettext )
688 xml? ( virtual/pkgconfig )
689 "
690 -src_unpack() {
691 - base_src_unpack
692 - git-2_src_unpack
693 -}
694
695 RDEPEND="${CDEPEND}
696 !dev-db/postgresql-docs:${SLOT}
697 @@ -86,17 +101,8 @@ RDEPEND="${CDEPEND}
698 selinux? ( sec-policy/selinux-postgresql )
699 "
700
701 -pkg_pretend() {
702 - ewarn "You are using a live ebuild that uses the current source code as it is"
703 - ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
704 - ewarn "the GNU Makefiles may be altered by upstream without notice and the"
705 - ewarn "documentation for this live version is not readily available"
706 - ewarn "online. Ergo, the ebuild maintainers will not support building a"
707 - ewarn "client-only and/or document-free version."
708 -}
709 -
710 pkg_setup() {
711 - CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
712 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
713
714 enewgroup postgres 70
715 enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
716 @@ -112,6 +118,17 @@ src_prepare() {
717 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
718 -i src/include/pg_config_manual.h || die
719
720 + # Rely on $PATH being in the proper order so that the correct
721 + # install program is used for modules utilizing PGXS in both
722 + # hardened and non-hardened environments. (Bug #528786)
723 + sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
724 +
725 + use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
726 +
727 + # Fix bug 486556 where the server would crash at start up because of
728 + # an infinite loop caused by a self-referencing symlink.
729 + epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch"
730 +
731 if use pam ; then
732 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
733 -i src/backend/libpq/auth.c || \
734 @@ -133,6 +150,17 @@ src_configure() {
735
736 local PO="${EPREFIX%/}"
737
738 + local i uuid_config=""
739 + if use uuid; then
740 + for i in ${UTIL_LINUX_LIBC[@]}; do
741 + use ${i} && uuid_config="--with-uuid=e2fs"
742 + done
743 + for i in ${BSD_LIBC[@]}; do
744 + use ${i} && uuid_config="--with-uuid=bsd"
745 + done
746 + [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
747 + fi
748 +
749 econf \
750 --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
751 --datadir="${PO}/usr/share/postgresql-${SLOT}" \
752 @@ -151,7 +179,7 @@ src_configure() {
753 $(use_with readline) \
754 $(use_with ssl openssl) \
755 $(use_with tcl) \
756 - $(use_with uuid ossp-uuid) \
757 + ${uuid_config} \
758 $(use_with xml libxml) \
759 $(use_with xml libxslt) \
760 $(use_with zlib) \
761 @@ -159,14 +187,30 @@ src_configure() {
762 }
763
764 src_compile() {
765 - emake world
766 + emake
767 + emake -C contrib
768 }
769
770 src_install() {
771 - emake DESTDIR="${D}" install-world
772 + emake DESTDIR="${D}" install
773 + emake DESTDIR="${D}" install -C contrib
774
775 dodoc README HISTORY doc/{TODO,bug.template}
776
777 + # man pages are already built, but if we have the target make them,
778 + # they'll be generated from source before being installed so we
779 + # manually install man pages.
780 + # We use ${SLOT} instead of doman for postgresql.eselect
781 + insinto /usr/share/postgresql-${SLOT}/man/
782 + doins -r doc/src/sgml/man{1,3,7}
783 + if ! use server; then
784 + # Remove man pages for non-existent binaries
785 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
786 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
787 + done
788 + fi
789 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
790 +
791 insinto /etc/postgresql-${SLOT}
792 newins src/bin/psql/psqlrc.sample psqlrc
793
794 @@ -176,23 +220,33 @@ src_install() {
795
796 use static-libs || find "${ED}" -name '*.a' -delete
797
798 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
799 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
800 + if use doc ; then
801 + docinto html
802 + dodoc doc/src/sgml/html/*
803
804 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
805 - "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT}
806 + docinto sgml
807 + dodoc doc/src/sgml/*.{sgml,dsl}
808 + fi
809
810 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
811 - "${FILESDIR}/${PN}.service" | \
812 - systemd_newunit - ${PN}-${SLOT}.service
813 + if use server; then
814 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
815 + "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
816
817 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
818 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
819 + "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT}
820
821 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
822 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
823 + "${FILESDIR}/${PN}.service" | \
824 + systemd_newunit - ${PN}-${SLOT}.service
825
826 - if use prefix ; then
827 - keepdir /run/postgresql
828 - fperms 0775 /run/postgresql
829 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
830 +
831 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
832 +
833 + if use prefix ; then
834 + keepdir /run/postgresql
835 + fperms 0775 /run/postgresql
836 + fi
837 fi
838 }
839
840 @@ -202,35 +256,29 @@ pkg_postinst() {
841 elog "If you need a global psqlrc-file, you can place it in:"
842 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
843
844 - if [[ -z ${REPLACING_VERSIONS} ]] ; then
845 + if use server ; then
846 elog
847 - elog "It looks like this is your first time installing PostgreSQL. Run the"
848 - elog "following command in all active shells to pick up changes to the default"
849 - elog "environemnt:"
850 - elog " source /etc/profile"
851 + elog "Gentoo specific documentation:"
852 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
853 + elog
854 + elog "Official documentation:"
855 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
856 + elog
857 + elog "The default location of the Unix-domain socket is:"
858 + elog " ${EROOT%/}/run/postgresql/"
859 + elog
860 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
861 + elog "so that it contains your preferred locale in:"
862 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
863 + elog
864 + elog "Then, execute the following command to setup the initial database"
865 + elog "environment:"
866 + elog " emerge --config =${CATEGORY}/${PF}"
867 fi
868 -
869 - elog
870 - elog "Gentoo specific documentation:"
871 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
872 - elog
873 - elog "Official documentation:"
874 - elog "${EROOT%/}/usr/share/doc/${PF}/html"
875 - elog
876 - elog "The default location of the Unix-domain socket is:"
877 - elog " ${EROOT%/}/run/postgresql/"
878 - elog
879 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
880 - elog "so that it contains your preferred locale, and other options, in:"
881 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
882 - elog
883 - elog "Then, execute the following command to setup the initial database"
884 - elog "environment:"
885 - elog " emerge --config =${CATEGORY}/${PF}"
886 }
887
888 pkg_prerm() {
889 - if [[ -z ${REPLACED_BY_VERSION} ]] ; then
890 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
891 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
892 ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
893
894 @@ -245,6 +293,8 @@ pkg_postrm() {
895 }
896
897 pkg_config() {
898 + use server || die "USE flag 'server' not enabled. Nothing to configure."
899 +
900 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
901 && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
902 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
903 @@ -365,15 +415,17 @@ pkg_config() {
904 src_test() {
905 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
906
907 - if [[ ${UID} -ne 0 ]] ; then
908 + if use server && [[ ${UID} -ne 0 ]] ; then
909 emake check
910
911 einfo "If you think other tests besides the regression tests are necessary, please"
912 einfo "submit a bug including a patch for this ebuild to enable them."
913 else
914 + use server || \
915 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
916 [[ ${UID} -eq 0 ]] || \
917 - ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
918 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
919
920 - ewarn "Skipping."
921 + ewarn 'Skipping.'
922 fi
923 }
924
925 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9999.ebuild
926 index c2fe866..addb7aa 100644
927 --- a/dev-db/postgresql/postgresql-9999.ebuild
928 +++ b/dev-db/postgresql/postgresql-9999.ebuild
929 @@ -112,6 +112,11 @@ src_prepare() {
930 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
931 -i src/include/pg_config_manual.h || die
932
933 + # Rely on $PATH being in the proper order so that the correct
934 + # install program is used for modules utilizing PGXS in both
935 + # hardened and non-hardened environments. (Bug #528786)
936 + sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
937 +
938 if use pam ; then
939 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
940 -i src/backend/libpq/auth.c || \