Gentoo Archives: gentoo-commits

From: Julian Ospald <hasufell@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/postgresql/
Date: Sun, 04 Oct 2015 20:48:01
Message-Id: 1443991611.88f82c7a279e6222a7801862c48a99f249b503d7.hasufell@gentoo
1 commit: 88f82c7a279e6222a7801862c48a99f249b503d7
2 Author: Julian Ospald <hasufell <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 4 20:46:51 2015 +0000
4 Commit: Julian Ospald <hasufell <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 4 20:46:51 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88f82c7a
7
8 dev-db/postgresql: add libressl support
9
10 ...sql-9999.ebuild => postgresql-9.0.22-r1.ebuild} | 164 ++++++++---------
11 ...sql-9999.ebuild => postgresql-9.1.18-r1.ebuild} | 168 +++++++++---------
12 ...sql-9999.ebuild => postgresql-9.2.13-r1.ebuild} | 154 +++++++++-------
13 ...esql-9999.ebuild => postgresql-9.3.9-r1.ebuild} | 154 +++++++++-------
14 ...esql-9999.ebuild => postgresql-9.4.4-r2.ebuild} | 193 ++++++++++++--------
15 ...9999.ebuild => postgresql-9.5_alpha1-r1.ebuild} | 194 +++++++++++++--------
16 dev-db/postgresql/postgresql-9999.ebuild | 9 +-
17 7 files changed, 602 insertions(+), 434 deletions(-)
18
19 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.0.22-r1.ebuild
20 similarity index 71%
21 copy from dev-db/postgresql/postgresql-9999.ebuild
22 copy to dev-db/postgresql/postgresql-9.0.22-r1.ebuild
23 index 5272ee4..66d27da 100644
24 --- a/dev-db/postgresql/postgresql-9999.ebuild
25 +++ b/dev-db/postgresql/postgresql-9.0.22-r1.ebuild
26 @@ -4,17 +4,20 @@
27
28 EAPI="5"
29
30 -PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
31 +# Testing within Portage's environment is broken, and the patch no
32 +# longer applies cleanly.
33 +RESTRICT="test"
34
35 -inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \
36 - python-single-r1 systemd user versionator
37 +PYTHON_COMPAT=( python{2_7,3_4} )
38
39 -KEYWORDS=""
40 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
41 + systemd user versionator
42
43 -# Fix if needed
44 -SLOT="9.6"
45 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
46
47 -EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
48 +SLOT="$(get_version_component_range 1-2)"
49 +
50 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
51
52 LICENSE="POSTGRESQL GPL-2"
53 DESCRIPTION="PostgreSQL RDBMS"
54 @@ -22,7 +25,7 @@ HOMEPAGE="http://www.postgresql.org/"
55
56 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
57 zh_CN zh_TW"
58 -IUSE="kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python
59 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
60 +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
61
62 for lingua in ${LINGUAS}; do
63 @@ -49,7 +52,10 @@ pam? ( virtual/pam )
64 perl? ( >=dev-lang/perl-5.8 )
65 python? ( ${PYTHON_DEPS} )
66 readline? ( sys-libs/readline:0= )
67 -ssl? ( >=dev-libs/openssl-0.9.6-r1:0= )
68 +ssl? (
69 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
70 + libressl? ( dev-libs/libressl:= )
71 +)
72 tcl? ( >=dev-lang/tcl-8:0= )
73 uuid? ( dev-libs/ossp-uuid )
74 xml? ( dev-libs/libxml2 dev-libs/libxslt )
75 @@ -58,23 +64,11 @@ zlib? ( sys-libs/zlib )
76
77 DEPEND="${CDEPEND}
78 !!<sys-apps/sandbox-2.0
79 ->=dev-lang/perl-5.8
80 -app-text/docbook-dsssl-stylesheets
81 -app-text/docbook-sgml-dtd:4.2
82 -app-text/docbook-xml-dtd:4.2
83 -app-text/docbook-xsl-stylesheets
84 -app-text/openjade
85 -dev-libs/libxml2
86 -dev-libs/libxslt
87 sys-devel/bison
88 sys-devel/flex
89 nls? ( sys-devel/gettext )
90 xml? ( virtual/pkgconfig )
91 "
92 -src_unpack() {
93 - base_src_unpack
94 - git-2_src_unpack
95 -}
96
97 RDEPEND="${CDEPEND}
98 !dev-db/postgresql-docs:${SLOT}
99 @@ -83,17 +77,8 @@ RDEPEND="${CDEPEND}
100 selinux? ( sec-policy/selinux-postgresql )
101 "
102
103 -pkg_pretend() {
104 - ewarn "You are using a live ebuild that uses the current source code as it is"
105 - ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
106 - ewarn "the GNU Makefiles may be altered by upstream without notice and the"
107 - ewarn "documentation for this live version is not readily available"
108 - ewarn "online. Ergo, the ebuild maintainers will not support building a"
109 - ewarn "client-only and/or document-free version."
110 -}
111 -
112 pkg_setup() {
113 - CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
114 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
115
116 enewgroup postgres 70
117 enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
118 @@ -109,6 +94,10 @@ src_prepare() {
119 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
120 -i src/include/pg_config_manual.h || die
121
122 + epatch "${FILESDIR}/pg_ctl-exit-status.patch"
123 +
124 + use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
125 +
126 if use pam ; then
127 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
128 -i src/backend/libpq/auth.c || \
129 @@ -141,6 +130,7 @@ src_configure() {
130 $(use_enable !pg_legacytimestamp integer-datetimes) \
131 $(use_enable threads thread-safety) \
132 $(use_with kerberos gssapi) \
133 + $(use_with kerberos krb5) \
134 $(use_with ldap) \
135 $(use_with pam) \
136 $(use_with perl) \
137 @@ -156,14 +146,30 @@ src_configure() {
138 }
139
140 src_compile() {
141 - emake world
142 + emake
143 + emake -C contrib
144 }
145
146 src_install() {
147 - emake DESTDIR="${D}" install-world
148 + emake DESTDIR="${D}" install
149 + emake DESTDIR="${D}" install -C contrib
150
151 dodoc README HISTORY doc/{TODO,bug.template}
152
153 + # man pages are already built, but if we have the target make them,
154 + # they'll be generated from source before being installed so we
155 + # manually install man pages.
156 + # We use ${SLOT} instead of doman for postgresql.eselect
157 + insinto /usr/share/postgresql-${SLOT}/man/
158 + doins -r doc/src/sgml/man{1,3,7}
159 + if ! use server; then
160 + # Remove man pages for non-existent binaries
161 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
162 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
163 + done
164 + fi
165 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
166 +
167 insinto /etc/postgresql-${SLOT}
168 newins src/bin/psql/psqlrc.sample psqlrc
169
170 @@ -173,25 +179,35 @@ src_install() {
171
172 use static-libs || find "${ED}" -name '*.a' -delete
173
174 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
175 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
176 + if use doc ; then
177 + docinto html
178 + dodoc doc/src/sgml/html/*
179
180 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
181 - "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT}
182 + docinto sgml
183 + dodoc doc/src/sgml/*.{sgml,dsl}
184 + fi
185
186 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
187 - "${FILESDIR}/${PN}.service" | \
188 - systemd_newunit - ${PN}-${SLOT}.service
189 + if use server; then
190 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
191 + "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
192
193 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
194 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
195 + "${FILESDIR}/${PN}.init-pre_9.2" | newinitd - ${PN}-${SLOT}
196
197 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
198 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
199 + "${FILESDIR}/${PN}.service" | \
200 + systemd_newunit - ${PN}-${SLOT}.service
201
202 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
203 + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
204
205 - if use prefix ; then
206 - keepdir /run/postgresql
207 - fperms 0775 /run/postgresql
208 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
209 +
210 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
211 +
212 + if use prefix ; then
213 + keepdir /run/postgresql
214 + fperms 0775 /run/postgresql
215 + fi
216 fi
217 }
218
219 @@ -201,27 +217,29 @@ pkg_postinst() {
220 elog "If you need a global psqlrc-file, you can place it in:"
221 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
222
223 - elog
224 - elog "Gentoo specific documentation:"
225 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
226 - elog
227 - elog "Official documentation:"
228 - elog "${EROOT%/}/usr/share/doc/${PF}/html"
229 - elog
230 - elog "The default location of the Unix-domain socket is:"
231 - elog " ${EROOT%/}/run/postgresql/"
232 - elog
233 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
234 - elog "so that it contains your preferred locale, and other options, in:"
235 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
236 - elog
237 - elog "Then, execute the following command to setup the initial database"
238 - elog "environment:"
239 - elog " emerge --config =${CATEGORY}/${PF}"
240 + if use server ; then
241 + elog
242 + elog "Gentoo specific documentation:"
243 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
244 + elog
245 + elog "Official documentation:"
246 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
247 + elog
248 + elog "The default location of the Unix-domain socket is:"
249 + elog " ${EROOT%/}/run/postgresql/"
250 + elog
251 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
252 + elog "so that it contains your preferred locale in:"
253 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
254 + elog
255 + elog "Then, execute the following command to setup the initial database"
256 + elog "environment:"
257 + elog " emerge --config =${CATEGORY}/${PF}"
258 + fi
259 }
260
261 pkg_prerm() {
262 - if [[ -z ${REPLACED_BY_VERSION} ]] ; then
263 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
264 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
265 ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
266
267 @@ -236,6 +254,8 @@ pkg_postrm() {
268 }
269
270 pkg_config() {
271 + use server || die "USE flag 'server' not enabled. Nothing to configure."
272 +
273 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
274 && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
275 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
276 @@ -352,19 +372,3 @@ pkg_config() {
277 einfo "instead of 'pg_ctl'."
278 fi
279 }
280 -
281 -src_test() {
282 - einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
283 -
284 - if [[ ${UID} -ne 0 ]] ; then
285 - emake check
286 -
287 - einfo "If you think other tests besides the regression tests are necessary, please"
288 - einfo "submit a bug including a patch for this ebuild to enable them."
289 - else
290 - [[ ${UID} -eq 0 ]] || \
291 - ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
292 -
293 - ewarn "Skipping."
294 - fi
295 -}
296
297 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.1.18-r1.ebuild
298 similarity index 69%
299 copy from dev-db/postgresql/postgresql-9999.ebuild
300 copy to dev-db/postgresql/postgresql-9.1.18-r1.ebuild
301 index 5272ee4..94d6120 100644
302 --- a/dev-db/postgresql/postgresql-9999.ebuild
303 +++ b/dev-db/postgresql/postgresql-9.1.18-r1.ebuild
304 @@ -4,17 +4,20 @@
305
306 EAPI="5"
307
308 -PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
309 +# Testing within Portage's environment is broken, and the patch no
310 +# longer applies cleanly.
311 +RESTRICT="test"
312
313 -inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \
314 - python-single-r1 systemd user versionator
315 +PYTHON_COMPAT=( python{2_7,3_4} )
316
317 -KEYWORDS=""
318 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
319 + systemd user versionator
320
321 -# Fix if needed
322 -SLOT="9.6"
323 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
324
325 -EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
326 +SLOT="$(get_version_component_range 1-2)"
327 +
328 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
329
330 LICENSE="POSTGRESQL GPL-2"
331 DESCRIPTION="PostgreSQL RDBMS"
332 @@ -22,7 +25,7 @@ HOMEPAGE="http://www.postgresql.org/"
333
334 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
335 zh_CN zh_TW"
336 -IUSE="kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python
337 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
338 +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
339
340 for lingua in ${LINGUAS}; do
341 @@ -49,7 +52,10 @@ pam? ( virtual/pam )
342 perl? ( >=dev-lang/perl-5.8 )
343 python? ( ${PYTHON_DEPS} )
344 readline? ( sys-libs/readline:0= )
345 -ssl? ( >=dev-libs/openssl-0.9.6-r1:0= )
346 +ssl? (
347 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
348 + libressl? ( dev-libs/libressl:= )
349 +)
350 tcl? ( >=dev-lang/tcl-8:0= )
351 uuid? ( dev-libs/ossp-uuid )
352 xml? ( dev-libs/libxml2 dev-libs/libxslt )
353 @@ -58,23 +64,11 @@ zlib? ( sys-libs/zlib )
354
355 DEPEND="${CDEPEND}
356 !!<sys-apps/sandbox-2.0
357 ->=dev-lang/perl-5.8
358 -app-text/docbook-dsssl-stylesheets
359 -app-text/docbook-sgml-dtd:4.2
360 -app-text/docbook-xml-dtd:4.2
361 -app-text/docbook-xsl-stylesheets
362 -app-text/openjade
363 -dev-libs/libxml2
364 -dev-libs/libxslt
365 sys-devel/bison
366 sys-devel/flex
367 nls? ( sys-devel/gettext )
368 xml? ( virtual/pkgconfig )
369 "
370 -src_unpack() {
371 - base_src_unpack
372 - git-2_src_unpack
373 -}
374
375 RDEPEND="${CDEPEND}
376 !dev-db/postgresql-docs:${SLOT}
377 @@ -83,17 +77,8 @@ RDEPEND="${CDEPEND}
378 selinux? ( sec-policy/selinux-postgresql )
379 "
380
381 -pkg_pretend() {
382 - ewarn "You are using a live ebuild that uses the current source code as it is"
383 - ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
384 - ewarn "the GNU Makefiles may be altered by upstream without notice and the"
385 - ewarn "documentation for this live version is not readily available"
386 - ewarn "online. Ergo, the ebuild maintainers will not support building a"
387 - ewarn "client-only and/or document-free version."
388 -}
389 -
390 pkg_setup() {
391 - CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
392 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
393
394 enewgroup postgres 70
395 enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
396 @@ -109,6 +94,14 @@ src_prepare() {
397 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
398 -i src/include/pg_config_manual.h || die
399
400 + epatch "${FILESDIR}/pg_ctl-exit-status.patch"
401 +
402 + use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
403 +
404 + # Fix bug 486556 where the server would crash at start up because of
405 + # an infinite loop caused by a self-referencing symlink.
406 + epatch "${FILESDIR}/postgresql-9.1-tz-dir-overflow.patch"
407 +
408 if use pam ; then
409 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
410 -i src/backend/libpq/auth.c || \
411 @@ -141,6 +134,7 @@ src_configure() {
412 $(use_enable !pg_legacytimestamp integer-datetimes) \
413 $(use_enable threads thread-safety) \
414 $(use_with kerberos gssapi) \
415 + $(use_with kerberos krb5) \
416 $(use_with ldap) \
417 $(use_with pam) \
418 $(use_with perl) \
419 @@ -156,14 +150,30 @@ src_configure() {
420 }
421
422 src_compile() {
423 - emake world
424 + emake
425 + emake -C contrib
426 }
427
428 src_install() {
429 - emake DESTDIR="${D}" install-world
430 + emake DESTDIR="${D}" install
431 + emake DESTDIR="${D}" install -C contrib
432
433 dodoc README HISTORY doc/{TODO,bug.template}
434
435 + # man pages are already built, but if we have the target make them,
436 + # they'll be generated from source before being installed so we
437 + # manually install man pages.
438 + # We use ${SLOT} instead of doman for postgresql.eselect
439 + insinto /usr/share/postgresql-${SLOT}/man/
440 + doins -r doc/src/sgml/man{1,3,7}
441 + if ! use server; then
442 + # Remove man pages for non-existent binaries
443 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
444 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
445 + done
446 + fi
447 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
448 +
449 insinto /etc/postgresql-${SLOT}
450 newins src/bin/psql/psqlrc.sample psqlrc
451
452 @@ -173,25 +183,35 @@ src_install() {
453
454 use static-libs || find "${ED}" -name '*.a' -delete
455
456 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
457 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
458 + if use doc ; then
459 + docinto html
460 + dodoc doc/src/sgml/html/*
461
462 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
463 - "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT}
464 + docinto sgml
465 + dodoc doc/src/sgml/*.{sgml,dsl}
466 + fi
467
468 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
469 - "${FILESDIR}/${PN}.service" | \
470 - systemd_newunit - ${PN}-${SLOT}.service
471 + if use server; then
472 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
473 + "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
474
475 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
476 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
477 + "${FILESDIR}/${PN}.init-pre_9.2" | newinitd - ${PN}-${SLOT}
478
479 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
480 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
481 + "${FILESDIR}/${PN}.service" | \
482 + systemd_newunit - ${PN}-${SLOT}.service
483
484 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
485 + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
486
487 - if use prefix ; then
488 - keepdir /run/postgresql
489 - fperms 0775 /run/postgresql
490 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
491 +
492 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
493 +
494 + if use prefix ; then
495 + keepdir /run/postgresql
496 + fperms 0775 /run/postgresql
497 + fi
498 fi
499 }
500
501 @@ -201,27 +221,29 @@ pkg_postinst() {
502 elog "If you need a global psqlrc-file, you can place it in:"
503 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
504
505 - elog
506 - elog "Gentoo specific documentation:"
507 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
508 - elog
509 - elog "Official documentation:"
510 - elog "${EROOT%/}/usr/share/doc/${PF}/html"
511 - elog
512 - elog "The default location of the Unix-domain socket is:"
513 - elog " ${EROOT%/}/run/postgresql/"
514 - elog
515 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
516 - elog "so that it contains your preferred locale, and other options, in:"
517 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
518 - elog
519 - elog "Then, execute the following command to setup the initial database"
520 - elog "environment:"
521 - elog " emerge --config =${CATEGORY}/${PF}"
522 + if use server ; then
523 + elog
524 + elog "Gentoo specific documentation:"
525 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
526 + elog
527 + elog "Official documentation:"
528 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
529 + elog
530 + elog "The default location of the Unix-domain socket is:"
531 + elog " ${EROOT%/}/run/postgresql/"
532 + elog
533 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
534 + elog "so that it contains your preferred locale in:"
535 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
536 + elog
537 + elog "Then, execute the following command to setup the initial database"
538 + elog "environment:"
539 + elog " emerge --config =${CATEGORY}/${PF}"
540 + fi
541 }
542
543 pkg_prerm() {
544 - if [[ -z ${REPLACED_BY_VERSION} ]] ; then
545 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
546 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
547 ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
548
549 @@ -236,6 +258,8 @@ pkg_postrm() {
550 }
551
552 pkg_config() {
553 + use server || die "USE flag 'server' not enabled. Nothing to configure."
554 +
555 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
556 && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
557 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
558 @@ -352,19 +376,3 @@ pkg_config() {
559 einfo "instead of 'pg_ctl'."
560 fi
561 }
562 -
563 -src_test() {
564 - einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
565 -
566 - if [[ ${UID} -ne 0 ]] ; then
567 - emake check
568 -
569 - einfo "If you think other tests besides the regression tests are necessary, please"
570 - einfo "submit a bug including a patch for this ebuild to enable them."
571 - else
572 - [[ ${UID} -eq 0 ]] || \
573 - ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
574 -
575 - ewarn "Skipping."
576 - fi
577 -}
578
579 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.2.13-r1.ebuild
580 similarity index 70%
581 copy from dev-db/postgresql/postgresql-9999.ebuild
582 copy to dev-db/postgresql/postgresql-9.2.13-r1.ebuild
583 index 5272ee4..af0a7f3 100644
584 --- a/dev-db/postgresql/postgresql-9999.ebuild
585 +++ b/dev-db/postgresql/postgresql-9.2.13-r1.ebuild
586 @@ -4,17 +4,16 @@
587
588 EAPI="5"
589
590 -PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
591 +PYTHON_COMPAT=( python{2_7,3_4} )
592
593 -inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \
594 - python-single-r1 systemd user versionator
595 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
596 + systemd user versionator
597
598 -KEYWORDS=""
599 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
600
601 -# Fix if needed
602 -SLOT="9.6"
603 +SLOT="$(get_version_component_range 1-2)"
604
605 -EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
606 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
607
608 LICENSE="POSTGRESQL GPL-2"
609 DESCRIPTION="PostgreSQL RDBMS"
610 @@ -22,7 +21,7 @@ HOMEPAGE="http://www.postgresql.org/"
611
612 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
613 zh_CN zh_TW"
614 -IUSE="kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python
615 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
616 +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
617
618 for lingua in ${LINGUAS}; do
619 @@ -49,7 +48,10 @@ pam? ( virtual/pam )
620 perl? ( >=dev-lang/perl-5.8 )
621 python? ( ${PYTHON_DEPS} )
622 readline? ( sys-libs/readline:0= )
623 -ssl? ( >=dev-libs/openssl-0.9.6-r1:0= )
624 +ssl? (
625 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
626 + libressl? ( dev-libs/libressl:= )
627 +)
628 tcl? ( >=dev-lang/tcl-8:0= )
629 uuid? ( dev-libs/ossp-uuid )
630 xml? ( dev-libs/libxml2 dev-libs/libxslt )
631 @@ -58,23 +60,11 @@ zlib? ( sys-libs/zlib )
632
633 DEPEND="${CDEPEND}
634 !!<sys-apps/sandbox-2.0
635 ->=dev-lang/perl-5.8
636 -app-text/docbook-dsssl-stylesheets
637 -app-text/docbook-sgml-dtd:4.2
638 -app-text/docbook-xml-dtd:4.2
639 -app-text/docbook-xsl-stylesheets
640 -app-text/openjade
641 -dev-libs/libxml2
642 -dev-libs/libxslt
643 sys-devel/bison
644 sys-devel/flex
645 nls? ( sys-devel/gettext )
646 xml? ( virtual/pkgconfig )
647 "
648 -src_unpack() {
649 - base_src_unpack
650 - git-2_src_unpack
651 -}
652
653 RDEPEND="${CDEPEND}
654 !dev-db/postgresql-docs:${SLOT}
655 @@ -83,17 +73,8 @@ RDEPEND="${CDEPEND}
656 selinux? ( sec-policy/selinux-postgresql )
657 "
658
659 -pkg_pretend() {
660 - ewarn "You are using a live ebuild that uses the current source code as it is"
661 - ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
662 - ewarn "the GNU Makefiles may be altered by upstream without notice and the"
663 - ewarn "documentation for this live version is not readily available"
664 - ewarn "online. Ergo, the ebuild maintainers will not support building a"
665 - ewarn "client-only and/or document-free version."
666 -}
667 -
668 pkg_setup() {
669 - CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
670 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
671
672 enewgroup postgres 70
673 enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
674 @@ -109,6 +90,12 @@ src_prepare() {
675 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
676 -i src/include/pg_config_manual.h || die
677
678 + use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
679 +
680 + # Fix bug 486556 where the server would crash at start up because of
681 + # an infinite loop caused by a self-referencing symlink.
682 + epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch"
683 +
684 if use pam ; then
685 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
686 -i src/backend/libpq/auth.c || \
687 @@ -141,6 +128,7 @@ src_configure() {
688 $(use_enable !pg_legacytimestamp integer-datetimes) \
689 $(use_enable threads thread-safety) \
690 $(use_with kerberos gssapi) \
691 + $(use_with kerberos krb5) \
692 $(use_with ldap) \
693 $(use_with pam) \
694 $(use_with perl) \
695 @@ -156,14 +144,30 @@ src_configure() {
696 }
697
698 src_compile() {
699 - emake world
700 + emake
701 + emake -C contrib
702 }
703
704 src_install() {
705 - emake DESTDIR="${D}" install-world
706 + emake DESTDIR="${D}" install
707 + emake DESTDIR="${D}" install -C contrib
708
709 dodoc README HISTORY doc/{TODO,bug.template}
710
711 + # man pages are already built, but if we have the target make them,
712 + # they'll be generated from source before being installed so we
713 + # manually install man pages.
714 + # We use ${SLOT} instead of doman for postgresql.eselect
715 + insinto /usr/share/postgresql-${SLOT}/man/
716 + doins -r doc/src/sgml/man{1,3,7}
717 + if ! use server; then
718 + # Remove man pages for non-existent binaries
719 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
720 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
721 + done
722 + fi
723 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
724 +
725 insinto /etc/postgresql-${SLOT}
726 newins src/bin/psql/psqlrc.sample psqlrc
727
728 @@ -173,25 +177,35 @@ src_install() {
729
730 use static-libs || find "${ED}" -name '*.a' -delete
731
732 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
733 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
734 + if use doc ; then
735 + docinto html
736 + dodoc doc/src/sgml/html/*
737
738 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
739 - "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT}
740 + docinto sgml
741 + dodoc doc/src/sgml/*.{sgml,dsl}
742 + fi
743
744 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
745 - "${FILESDIR}/${PN}.service" | \
746 - systemd_newunit - ${PN}-${SLOT}.service
747 + if use server; then
748 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
749 + "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
750
751 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
752 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
753 + "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT}
754
755 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
756 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
757 + "${FILESDIR}/${PN}.service" | \
758 + systemd_newunit - ${PN}-${SLOT}.service
759
760 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
761 + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
762
763 - if use prefix ; then
764 - keepdir /run/postgresql
765 - fperms 0775 /run/postgresql
766 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
767 +
768 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
769 +
770 + if use prefix ; then
771 + keepdir /run/postgresql
772 + fperms 0775 /run/postgresql
773 + fi
774 fi
775 }
776
777 @@ -201,27 +215,29 @@ pkg_postinst() {
778 elog "If you need a global psqlrc-file, you can place it in:"
779 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
780
781 - elog
782 - elog "Gentoo specific documentation:"
783 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
784 - elog
785 - elog "Official documentation:"
786 - elog "${EROOT%/}/usr/share/doc/${PF}/html"
787 - elog
788 - elog "The default location of the Unix-domain socket is:"
789 - elog " ${EROOT%/}/run/postgresql/"
790 - elog
791 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
792 - elog "so that it contains your preferred locale, and other options, in:"
793 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
794 - elog
795 - elog "Then, execute the following command to setup the initial database"
796 - elog "environment:"
797 - elog " emerge --config =${CATEGORY}/${PF}"
798 + if use server ; then
799 + elog
800 + elog "Gentoo specific documentation:"
801 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
802 + elog
803 + elog "Official documentation:"
804 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
805 + elog
806 + elog "The default location of the Unix-domain socket is:"
807 + elog " ${EROOT%/}/run/postgresql/"
808 + elog
809 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
810 + elog "so that it contains your preferred locale in:"
811 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
812 + elog
813 + elog "Then, execute the following command to setup the initial database"
814 + elog "environment:"
815 + elog " emerge --config =${CATEGORY}/${PF}"
816 + fi
817 }
818
819 pkg_prerm() {
820 - if [[ -z ${REPLACED_BY_VERSION} ]] ; then
821 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
822 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
823 ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
824
825 @@ -236,6 +252,8 @@ pkg_postrm() {
826 }
827
828 pkg_config() {
829 + use server || die "USE flag 'server' not enabled. Nothing to configure."
830 +
831 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
832 && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
833 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
834 @@ -356,15 +374,17 @@ pkg_config() {
835 src_test() {
836 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
837
838 - if [[ ${UID} -ne 0 ]] ; then
839 + if use server && [[ ${UID} -ne 0 ]] ; then
840 emake check
841
842 einfo "If you think other tests besides the regression tests are necessary, please"
843 einfo "submit a bug including a patch for this ebuild to enable them."
844 else
845 + use server || \
846 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
847 [[ ${UID} -eq 0 ]] || \
848 - ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
849 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
850
851 - ewarn "Skipping."
852 + ewarn 'Skipping.'
853 fi
854 }
855
856 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.3.9-r1.ebuild
857 similarity index 70%
858 copy from dev-db/postgresql/postgresql-9999.ebuild
859 copy to dev-db/postgresql/postgresql-9.3.9-r1.ebuild
860 index 5272ee4..cfd6214 100644
861 --- a/dev-db/postgresql/postgresql-9999.ebuild
862 +++ b/dev-db/postgresql/postgresql-9.3.9-r1.ebuild
863 @@ -4,17 +4,16 @@
864
865 EAPI="5"
866
867 -PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
868 +PYTHON_COMPAT=( python{2_7,3_4} )
869
870 -inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \
871 - python-single-r1 systemd user versionator
872 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
873 + systemd user versionator
874
875 -KEYWORDS=""
876 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
877
878 -# Fix if needed
879 -SLOT="9.6"
880 +SLOT="$(get_version_component_range 1-2)"
881
882 -EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
883 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
884
885 LICENSE="POSTGRESQL GPL-2"
886 DESCRIPTION="PostgreSQL RDBMS"
887 @@ -22,7 +21,7 @@ HOMEPAGE="http://www.postgresql.org/"
888
889 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
890 zh_CN zh_TW"
891 -IUSE="kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python
892 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
893 +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
894
895 for lingua in ${LINGUAS}; do
896 @@ -49,7 +48,10 @@ pam? ( virtual/pam )
897 perl? ( >=dev-lang/perl-5.8 )
898 python? ( ${PYTHON_DEPS} )
899 readline? ( sys-libs/readline:0= )
900 -ssl? ( >=dev-libs/openssl-0.9.6-r1:0= )
901 +ssl? (
902 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
903 + libressl? ( dev-libs/libressl:= )
904 +)
905 tcl? ( >=dev-lang/tcl-8:0= )
906 uuid? ( dev-libs/ossp-uuid )
907 xml? ( dev-libs/libxml2 dev-libs/libxslt )
908 @@ -58,23 +60,11 @@ zlib? ( sys-libs/zlib )
909
910 DEPEND="${CDEPEND}
911 !!<sys-apps/sandbox-2.0
912 ->=dev-lang/perl-5.8
913 -app-text/docbook-dsssl-stylesheets
914 -app-text/docbook-sgml-dtd:4.2
915 -app-text/docbook-xml-dtd:4.2
916 -app-text/docbook-xsl-stylesheets
917 -app-text/openjade
918 -dev-libs/libxml2
919 -dev-libs/libxslt
920 sys-devel/bison
921 sys-devel/flex
922 nls? ( sys-devel/gettext )
923 xml? ( virtual/pkgconfig )
924 "
925 -src_unpack() {
926 - base_src_unpack
927 - git-2_src_unpack
928 -}
929
930 RDEPEND="${CDEPEND}
931 !dev-db/postgresql-docs:${SLOT}
932 @@ -83,17 +73,8 @@ RDEPEND="${CDEPEND}
933 selinux? ( sec-policy/selinux-postgresql )
934 "
935
936 -pkg_pretend() {
937 - ewarn "You are using a live ebuild that uses the current source code as it is"
938 - ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
939 - ewarn "the GNU Makefiles may be altered by upstream without notice and the"
940 - ewarn "documentation for this live version is not readily available"
941 - ewarn "online. Ergo, the ebuild maintainers will not support building a"
942 - ewarn "client-only and/or document-free version."
943 -}
944 -
945 pkg_setup() {
946 - CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
947 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
948
949 enewgroup postgres 70
950 enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
951 @@ -109,6 +90,12 @@ src_prepare() {
952 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
953 -i src/include/pg_config_manual.h || die
954
955 + use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
956 +
957 + # Fix bug 486556 where the server would crash at start up because of
958 + # an infinite loop caused by a self-referencing symlink.
959 + epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch"
960 +
961 if use pam ; then
962 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
963 -i src/backend/libpq/auth.c || \
964 @@ -141,6 +128,7 @@ src_configure() {
965 $(use_enable !pg_legacytimestamp integer-datetimes) \
966 $(use_enable threads thread-safety) \
967 $(use_with kerberos gssapi) \
968 + $(use_with kerberos krb5) \
969 $(use_with ldap) \
970 $(use_with pam) \
971 $(use_with perl) \
972 @@ -156,14 +144,30 @@ src_configure() {
973 }
974
975 src_compile() {
976 - emake world
977 + emake
978 + emake -C contrib
979 }
980
981 src_install() {
982 - emake DESTDIR="${D}" install-world
983 + emake DESTDIR="${D}" install
984 + emake DESTDIR="${D}" install -C contrib
985
986 dodoc README HISTORY doc/{TODO,bug.template}
987
988 + # man pages are already built, but if we have the target make them,
989 + # they'll be generated from source before being installed so we
990 + # manually install man pages.
991 + # We use ${SLOT} instead of doman for postgresql.eselect
992 + insinto /usr/share/postgresql-${SLOT}/man/
993 + doins -r doc/src/sgml/man{1,3,7}
994 + if ! use server; then
995 + # Remove man pages for non-existent binaries
996 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
997 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
998 + done
999 + fi
1000 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1001 +
1002 insinto /etc/postgresql-${SLOT}
1003 newins src/bin/psql/psqlrc.sample psqlrc
1004
1005 @@ -173,25 +177,35 @@ src_install() {
1006
1007 use static-libs || find "${ED}" -name '*.a' -delete
1008
1009 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1010 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
1011 + if use doc ; then
1012 + docinto html
1013 + dodoc doc/src/sgml/html/*
1014
1015 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1016 - "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT}
1017 + docinto sgml
1018 + dodoc doc/src/sgml/*.{sgml,dsl}
1019 + fi
1020
1021 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1022 - "${FILESDIR}/${PN}.service" | \
1023 - systemd_newunit - ${PN}-${SLOT}.service
1024 + if use server; then
1025 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1026 + "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
1027
1028 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
1029 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1030 + "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT}
1031
1032 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1033 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1034 + "${FILESDIR}/${PN}.service" | \
1035 + systemd_newunit - ${PN}-${SLOT}.service
1036
1037 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1038 + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
1039
1040 - if use prefix ; then
1041 - keepdir /run/postgresql
1042 - fperms 0775 /run/postgresql
1043 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1044 +
1045 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1046 +
1047 + if use prefix ; then
1048 + keepdir /run/postgresql
1049 + fperms 0775 /run/postgresql
1050 + fi
1051 fi
1052 }
1053
1054 @@ -201,27 +215,29 @@ pkg_postinst() {
1055 elog "If you need a global psqlrc-file, you can place it in:"
1056 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1057
1058 - elog
1059 - elog "Gentoo specific documentation:"
1060 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1061 - elog
1062 - elog "Official documentation:"
1063 - elog "${EROOT%/}/usr/share/doc/${PF}/html"
1064 - elog
1065 - elog "The default location of the Unix-domain socket is:"
1066 - elog " ${EROOT%/}/run/postgresql/"
1067 - elog
1068 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1069 - elog "so that it contains your preferred locale, and other options, in:"
1070 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1071 - elog
1072 - elog "Then, execute the following command to setup the initial database"
1073 - elog "environment:"
1074 - elog " emerge --config =${CATEGORY}/${PF}"
1075 + if use server ; then
1076 + elog
1077 + elog "Gentoo specific documentation:"
1078 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1079 + elog
1080 + elog "Official documentation:"
1081 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
1082 + elog
1083 + elog "The default location of the Unix-domain socket is:"
1084 + elog " ${EROOT%/}/run/postgresql/"
1085 + elog
1086 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1087 + elog "so that it contains your preferred locale in:"
1088 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1089 + elog
1090 + elog "Then, execute the following command to setup the initial database"
1091 + elog "environment:"
1092 + elog " emerge --config =${CATEGORY}/${PF}"
1093 + fi
1094 }
1095
1096 pkg_prerm() {
1097 - if [[ -z ${REPLACED_BY_VERSION} ]] ; then
1098 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1099 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1100 ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
1101
1102 @@ -236,6 +252,8 @@ pkg_postrm() {
1103 }
1104
1105 pkg_config() {
1106 + use server || die "USE flag 'server' not enabled. Nothing to configure."
1107 +
1108 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
1109 && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1110 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1111 @@ -356,15 +374,17 @@ pkg_config() {
1112 src_test() {
1113 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1114
1115 - if [[ ${UID} -ne 0 ]] ; then
1116 + if use server && [[ ${UID} -ne 0 ]] ; then
1117 emake check
1118
1119 einfo "If you think other tests besides the regression tests are necessary, please"
1120 einfo "submit a bug including a patch for this ebuild to enable them."
1121 else
1122 + use server || \
1123 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
1124 [[ ${UID} -eq 0 ]] || \
1125 - ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
1126 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
1127
1128 - ewarn "Skipping."
1129 + ewarn 'Skipping.'
1130 fi
1131 }
1132
1133 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.4.4-r2.ebuild
1134 similarity index 64%
1135 copy from dev-db/postgresql/postgresql-9999.ebuild
1136 copy to dev-db/postgresql/postgresql-9.4.4-r2.ebuild
1137 index 5272ee4..6d720f0 100644
1138 --- a/dev-db/postgresql/postgresql-9999.ebuild
1139 +++ b/dev-db/postgresql/postgresql-9.4.4-r2.ebuild
1140 @@ -4,17 +4,16 @@
1141
1142 EAPI="5"
1143
1144 -PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
1145 +PYTHON_COMPAT=( python{2_7,3_4} )
1146
1147 -inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \
1148 - python-single-r1 systemd user versionator
1149 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
1150 + systemd user versionator
1151
1152 -KEYWORDS=""
1153 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
1154
1155 -# Fix if needed
1156 -SLOT="9.6"
1157 +SLOT="$(get_version_component_range 1-2)"
1158
1159 -EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
1160 +SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
1161
1162 LICENSE="POSTGRESQL GPL-2"
1163 DESCRIPTION="PostgreSQL RDBMS"
1164 @@ -22,7 +21,7 @@ HOMEPAGE="http://www.postgresql.org/"
1165
1166 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
1167 zh_CN zh_TW"
1168 -IUSE="kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python
1169 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
1170 +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
1171
1172 for lingua in ${LINGUAS}; do
1173 @@ -49,32 +48,45 @@ pam? ( virtual/pam )
1174 perl? ( >=dev-lang/perl-5.8 )
1175 python? ( ${PYTHON_DEPS} )
1176 readline? ( sys-libs/readline:0= )
1177 -ssl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1178 +ssl? (
1179 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1180 + libressl? ( dev-libs/libressl:= )
1181 +)
1182 tcl? ( >=dev-lang/tcl-8:0= )
1183 -uuid? ( dev-libs/ossp-uuid )
1184 xml? ( dev-libs/libxml2 dev-libs/libxslt )
1185 zlib? ( sys-libs/zlib )
1186 "
1187
1188 +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
1189 +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
1190 +# the libc includes UUID functions.
1191 +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
1192 +BSD_LIBC=( elibc_{Free,Net,Open}BSD )
1193 +
1194 +nest_usedep() {
1195 + local front back
1196 + while [[ ${#} -gt 1 ]]; do
1197 + front+="${1}? ( "
1198 + back+=" )"
1199 + shift
1200 + done
1201 + echo "${front}${1}${back}"
1202 +}
1203 +
1204 +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
1205 +CDEPEND+="
1206 +uuid? (
1207 + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
1208 + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
1209 +)"
1210 +
1211 DEPEND="${CDEPEND}
1212 !!<sys-apps/sandbox-2.0
1213 ->=dev-lang/perl-5.8
1214 -app-text/docbook-dsssl-stylesheets
1215 -app-text/docbook-sgml-dtd:4.2
1216 -app-text/docbook-xml-dtd:4.2
1217 -app-text/docbook-xsl-stylesheets
1218 -app-text/openjade
1219 -dev-libs/libxml2
1220 -dev-libs/libxslt
1221 sys-devel/bison
1222 sys-devel/flex
1223 nls? ( sys-devel/gettext )
1224 xml? ( virtual/pkgconfig )
1225 "
1226 -src_unpack() {
1227 - base_src_unpack
1228 - git-2_src_unpack
1229 -}
1230
1231 RDEPEND="${CDEPEND}
1232 !dev-db/postgresql-docs:${SLOT}
1233 @@ -83,17 +95,8 @@ RDEPEND="${CDEPEND}
1234 selinux? ( sec-policy/selinux-postgresql )
1235 "
1236
1237 -pkg_pretend() {
1238 - ewarn "You are using a live ebuild that uses the current source code as it is"
1239 - ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
1240 - ewarn "the GNU Makefiles may be altered by upstream without notice and the"
1241 - ewarn "documentation for this live version is not readily available"
1242 - ewarn "online. Ergo, the ebuild maintainers will not support building a"
1243 - ewarn "client-only and/or document-free version."
1244 -}
1245 -
1246 pkg_setup() {
1247 - CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
1248 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
1249
1250 enewgroup postgres 70
1251 enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
1252 @@ -109,6 +112,15 @@ src_prepare() {
1253 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1254 -i src/include/pg_config_manual.h || die
1255
1256 + # Fix bug 555198: Correct typo in assembly code for alpha architecture
1257 + epatch "${FILESDIR}/${PN}-${SLOT}-alpha-fix-read-memory-barrier.patch"
1258 +
1259 + use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
1260 +
1261 + # Fix bug 486556 where the server would crash at start up because of
1262 + # an infinite loop caused by a self-referencing symlink.
1263 + epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch"
1264 +
1265 if use pam ; then
1266 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
1267 -i src/backend/libpq/auth.c || \
1268 @@ -130,6 +142,17 @@ src_configure() {
1269
1270 local PO="${EPREFIX%/}"
1271
1272 + local i uuid_config=""
1273 + if use uuid; then
1274 + for i in ${UTIL_LINUX_LIBC[@]}; do
1275 + use ${i} && uuid_config="--with-uuid=e2fs"
1276 + done
1277 + for i in ${BSD_LIBC[@]}; do
1278 + use ${i} && uuid_config="--with-uuid=bsd"
1279 + done
1280 + [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
1281 + fi
1282 +
1283 econf \
1284 --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
1285 --datadir="${PO}/usr/share/postgresql-${SLOT}" \
1286 @@ -148,7 +171,7 @@ src_configure() {
1287 $(use_with readline) \
1288 $(use_with ssl openssl) \
1289 $(use_with tcl) \
1290 - $(use_with uuid ossp-uuid) \
1291 + ${uuid_config} \
1292 $(use_with xml libxml) \
1293 $(use_with xml libxslt) \
1294 $(use_with zlib) \
1295 @@ -156,14 +179,30 @@ src_configure() {
1296 }
1297
1298 src_compile() {
1299 - emake world
1300 + emake
1301 + emake -C contrib
1302 }
1303
1304 src_install() {
1305 - emake DESTDIR="${D}" install-world
1306 + emake DESTDIR="${D}" install
1307 + emake DESTDIR="${D}" install -C contrib
1308
1309 dodoc README HISTORY doc/{TODO,bug.template}
1310
1311 + # man pages are already built, but if we have the target make them,
1312 + # they'll be generated from source before being installed so we
1313 + # manually install man pages.
1314 + # We use ${SLOT} instead of doman for postgresql.eselect
1315 + insinto /usr/share/postgresql-${SLOT}/man/
1316 + doins -r doc/src/sgml/man{1,3,7}
1317 + if ! use server; then
1318 + # Remove man pages for non-existent binaries
1319 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
1320 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
1321 + done
1322 + fi
1323 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1324 +
1325 insinto /etc/postgresql-${SLOT}
1326 newins src/bin/psql/psqlrc.sample psqlrc
1327
1328 @@ -173,25 +212,35 @@ src_install() {
1329
1330 use static-libs || find "${ED}" -name '*.a' -delete
1331
1332 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1333 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
1334 + if use doc ; then
1335 + docinto html
1336 + dodoc doc/src/sgml/html/*
1337
1338 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1339 - "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT}
1340 + docinto sgml
1341 + dodoc doc/src/sgml/*.{sgml,dsl}
1342 + fi
1343
1344 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1345 - "${FILESDIR}/${PN}.service" | \
1346 - systemd_newunit - ${PN}-${SLOT}.service
1347 + if use server; then
1348 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1349 + "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
1350
1351 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
1352 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1353 + "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT}
1354
1355 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1356 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1357 + "${FILESDIR}/${PN}.service" | \
1358 + systemd_newunit - ${PN}-${SLOT}.service
1359
1360 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1361 + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
1362
1363 - if use prefix ; then
1364 - keepdir /run/postgresql
1365 - fperms 0775 /run/postgresql
1366 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1367 +
1368 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1369 +
1370 + if use prefix ; then
1371 + keepdir /run/postgresql
1372 + fperms 0775 /run/postgresql
1373 + fi
1374 fi
1375 }
1376
1377 @@ -201,27 +250,29 @@ pkg_postinst() {
1378 elog "If you need a global psqlrc-file, you can place it in:"
1379 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1380
1381 - elog
1382 - elog "Gentoo specific documentation:"
1383 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1384 - elog
1385 - elog "Official documentation:"
1386 - elog "${EROOT%/}/usr/share/doc/${PF}/html"
1387 - elog
1388 - elog "The default location of the Unix-domain socket is:"
1389 - elog " ${EROOT%/}/run/postgresql/"
1390 - elog
1391 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1392 - elog "so that it contains your preferred locale, and other options, in:"
1393 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1394 - elog
1395 - elog "Then, execute the following command to setup the initial database"
1396 - elog "environment:"
1397 - elog " emerge --config =${CATEGORY}/${PF}"
1398 + if use server ; then
1399 + elog
1400 + elog "Gentoo specific documentation:"
1401 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1402 + elog
1403 + elog "Official documentation:"
1404 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
1405 + elog
1406 + elog "The default location of the Unix-domain socket is:"
1407 + elog " ${EROOT%/}/run/postgresql/"
1408 + elog
1409 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1410 + elog "so that it contains your preferred locale in:"
1411 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1412 + elog
1413 + elog "Then, execute the following command to setup the initial database"
1414 + elog "environment:"
1415 + elog " emerge --config =${CATEGORY}/${PF}"
1416 + fi
1417 }
1418
1419 pkg_prerm() {
1420 - if [[ -z ${REPLACED_BY_VERSION} ]] ; then
1421 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1422 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1423 ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
1424
1425 @@ -236,6 +287,8 @@ pkg_postrm() {
1426 }
1427
1428 pkg_config() {
1429 + use server || die "USE flag 'server' not enabled. Nothing to configure."
1430 +
1431 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
1432 && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1433 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1434 @@ -356,15 +409,17 @@ pkg_config() {
1435 src_test() {
1436 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1437
1438 - if [[ ${UID} -ne 0 ]] ; then
1439 + if use server && [[ ${UID} -ne 0 ]] ; then
1440 emake check
1441
1442 einfo "If you think other tests besides the regression tests are necessary, please"
1443 einfo "submit a bug including a patch for this ebuild to enable them."
1444 else
1445 + use server || \
1446 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
1447 [[ ${UID} -eq 0 ]] || \
1448 - ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
1449 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
1450
1451 - ewarn "Skipping."
1452 + ewarn 'Skipping.'
1453 fi
1454 }
1455
1456 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.5_alpha1-r1.ebuild
1457 similarity index 64%
1458 copy from dev-db/postgresql/postgresql-9999.ebuild
1459 copy to dev-db/postgresql/postgresql-9.5_alpha1-r1.ebuild
1460 index 5272ee4..50d2cec 100644
1461 --- a/dev-db/postgresql/postgresql-9999.ebuild
1462 +++ b/dev-db/postgresql/postgresql-9.5_alpha1-r1.ebuild
1463 @@ -4,17 +4,22 @@
1464
1465 EAPI="5"
1466
1467 -PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
1468 +PYTHON_COMPAT=( python{2_7,3_4} )
1469
1470 -inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \
1471 - python-single-r1 systemd user versionator
1472 +inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
1473 + systemd user versionator
1474
1475 +# This is a prerelease version, so no keywords please
1476 KEYWORDS=""
1477 +#KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
1478
1479 -# Fix if needed
1480 -SLOT="9.6"
1481 +SLOT="$(get_version_component_range 1-2)"
1482
1483 -EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
1484 +MY_PV=${PV/_/}
1485 +
1486 +S=${WORKDIR}/${PN}-${MY_PV}
1487 +
1488 +SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
1489
1490 LICENSE="POSTGRESQL GPL-2"
1491 DESCRIPTION="PostgreSQL RDBMS"
1492 @@ -22,7 +27,7 @@ HOMEPAGE="http://www.postgresql.org/"
1493
1494 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
1495 zh_CN zh_TW"
1496 -IUSE="kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python
1497 +IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
1498 +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
1499
1500 for lingua in ${LINGUAS}; do
1501 @@ -49,32 +54,45 @@ pam? ( virtual/pam )
1502 perl? ( >=dev-lang/perl-5.8 )
1503 python? ( ${PYTHON_DEPS} )
1504 readline? ( sys-libs/readline:0= )
1505 -ssl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1506 +ssl? (
1507 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1508 + libressl? ( dev-libs/libressl:= )
1509 +)
1510 tcl? ( >=dev-lang/tcl-8:0= )
1511 -uuid? ( dev-libs/ossp-uuid )
1512 xml? ( dev-libs/libxml2 dev-libs/libxslt )
1513 zlib? ( sys-libs/zlib )
1514 "
1515
1516 +# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
1517 +# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
1518 +# the libc includes UUID functions.
1519 +UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
1520 +BSD_LIBC=( elibc_{Free,Net,Open}BSD )
1521 +
1522 +nest_usedep() {
1523 + local front back
1524 + while [[ ${#} -gt 1 ]]; do
1525 + front+="${1}? ( "
1526 + back+=" )"
1527 + shift
1528 + done
1529 + echo "${front}${1}${back}"
1530 +}
1531 +
1532 +IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
1533 +CDEPEND+="
1534 +uuid? (
1535 + ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
1536 + $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
1537 +)"
1538 +
1539 DEPEND="${CDEPEND}
1540 !!<sys-apps/sandbox-2.0
1541 ->=dev-lang/perl-5.8
1542 -app-text/docbook-dsssl-stylesheets
1543 -app-text/docbook-sgml-dtd:4.2
1544 -app-text/docbook-xml-dtd:4.2
1545 -app-text/docbook-xsl-stylesheets
1546 -app-text/openjade
1547 -dev-libs/libxml2
1548 -dev-libs/libxslt
1549 sys-devel/bison
1550 sys-devel/flex
1551 nls? ( sys-devel/gettext )
1552 xml? ( virtual/pkgconfig )
1553 "
1554 -src_unpack() {
1555 - base_src_unpack
1556 - git-2_src_unpack
1557 -}
1558
1559 RDEPEND="${CDEPEND}
1560 !dev-db/postgresql-docs:${SLOT}
1561 @@ -83,17 +101,8 @@ RDEPEND="${CDEPEND}
1562 selinux? ( sec-policy/selinux-postgresql )
1563 "
1564
1565 -pkg_pretend() {
1566 - ewarn "You are using a live ebuild that uses the current source code as it is"
1567 - ewarn "available from PostgreSQL's Git repository at emerge time. Given such,"
1568 - ewarn "the GNU Makefiles may be altered by upstream without notice and the"
1569 - ewarn "documentation for this live version is not readily available"
1570 - ewarn "online. Ergo, the ebuild maintainers will not support building a"
1571 - ewarn "client-only and/or document-free version."
1572 -}
1573 -
1574 pkg_setup() {
1575 - CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
1576 + use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
1577
1578 enewgroup postgres 70
1579 enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
1580 @@ -109,6 +118,12 @@ src_prepare() {
1581 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1582 -i src/include/pg_config_manual.h || die
1583
1584 + use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
1585 +
1586 + # Fix bug 486556 where the server would crash at start up because of
1587 + # an infinite loop caused by a self-referencing symlink.
1588 + epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch"
1589 +
1590 if use pam ; then
1591 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
1592 -i src/backend/libpq/auth.c || \
1593 @@ -130,6 +145,17 @@ src_configure() {
1594
1595 local PO="${EPREFIX%/}"
1596
1597 + local i uuid_config=""
1598 + if use uuid; then
1599 + for i in ${UTIL_LINUX_LIBC[@]}; do
1600 + use ${i} && uuid_config="--with-uuid=e2fs"
1601 + done
1602 + for i in ${BSD_LIBC[@]}; do
1603 + use ${i} && uuid_config="--with-uuid=bsd"
1604 + done
1605 + [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
1606 + fi
1607 +
1608 econf \
1609 --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
1610 --datadir="${PO}/usr/share/postgresql-${SLOT}" \
1611 @@ -148,7 +174,7 @@ src_configure() {
1612 $(use_with readline) \
1613 $(use_with ssl openssl) \
1614 $(use_with tcl) \
1615 - $(use_with uuid ossp-uuid) \
1616 + ${uuid_config} \
1617 $(use_with xml libxml) \
1618 $(use_with xml libxslt) \
1619 $(use_with zlib) \
1620 @@ -156,14 +182,30 @@ src_configure() {
1621 }
1622
1623 src_compile() {
1624 - emake world
1625 + emake
1626 + emake -C contrib
1627 }
1628
1629 src_install() {
1630 - emake DESTDIR="${D}" install-world
1631 + emake DESTDIR="${D}" install
1632 + emake DESTDIR="${D}" install -C contrib
1633
1634 dodoc README HISTORY doc/{TODO,bug.template}
1635
1636 + # man pages are already built, but if we have the target make them,
1637 + # they'll be generated from source before being installed so we
1638 + # manually install man pages.
1639 + # We use ${SLOT} instead of doman for postgresql.eselect
1640 + insinto /usr/share/postgresql-${SLOT}/man/
1641 + doins -r doc/src/sgml/man{1,3,7}
1642 + if ! use server; then
1643 + # Remove man pages for non-existent binaries
1644 + for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
1645 + rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
1646 + done
1647 + fi
1648 + docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1649 +
1650 insinto /etc/postgresql-${SLOT}
1651 newins src/bin/psql/psqlrc.sample psqlrc
1652
1653 @@ -173,25 +215,35 @@ src_install() {
1654
1655 use static-libs || find "${ED}" -name '*.a' -delete
1656
1657 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1658 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
1659 + if use doc ; then
1660 + docinto html
1661 + dodoc doc/src/sgml/html/*
1662
1663 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1664 - "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT}
1665 + docinto sgml
1666 + dodoc doc/src/sgml/*.{sgml,dsl}
1667 + fi
1668
1669 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1670 - "${FILESDIR}/${PN}.service" | \
1671 - systemd_newunit - ${PN}-${SLOT}.service
1672 + if use server; then
1673 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1674 + "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
1675
1676 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
1677 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1678 + "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT}
1679
1680 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1681 + sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1682 + "${FILESDIR}/${PN}.service" | \
1683 + systemd_newunit - ${PN}-${SLOT}.service
1684
1685 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1686 + systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf
1687
1688 - if use prefix ; then
1689 - keepdir /run/postgresql
1690 - fperms 0775 /run/postgresql
1691 + newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1692 +
1693 + use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1694 +
1695 + if use prefix ; then
1696 + keepdir /run/postgresql
1697 + fperms 0775 /run/postgresql
1698 + fi
1699 fi
1700 }
1701
1702 @@ -201,27 +253,29 @@ pkg_postinst() {
1703 elog "If you need a global psqlrc-file, you can place it in:"
1704 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1705
1706 - elog
1707 - elog "Gentoo specific documentation:"
1708 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1709 - elog
1710 - elog "Official documentation:"
1711 - elog "${EROOT%/}/usr/share/doc/${PF}/html"
1712 - elog
1713 - elog "The default location of the Unix-domain socket is:"
1714 - elog " ${EROOT%/}/run/postgresql/"
1715 - elog
1716 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1717 - elog "so that it contains your preferred locale, and other options, in:"
1718 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1719 - elog
1720 - elog "Then, execute the following command to setup the initial database"
1721 - elog "environment:"
1722 - elog " emerge --config =${CATEGORY}/${PF}"
1723 + if use server ; then
1724 + elog
1725 + elog "Gentoo specific documentation:"
1726 + elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1727 + elog
1728 + elog "Official documentation:"
1729 + elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
1730 + elog
1731 + elog "The default location of the Unix-domain socket is:"
1732 + elog " ${EROOT%/}/run/postgresql/"
1733 + elog
1734 + elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1735 + elog "so that it contains your preferred locale in:"
1736 + elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1737 + elog
1738 + elog "Then, execute the following command to setup the initial database"
1739 + elog "environment:"
1740 + elog " emerge --config =${CATEGORY}/${PF}"
1741 + fi
1742 }
1743
1744 pkg_prerm() {
1745 - if [[ -z ${REPLACED_BY_VERSION} ]] ; then
1746 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1747 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1748 ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
1749
1750 @@ -236,6 +290,8 @@ pkg_postrm() {
1751 }
1752
1753 pkg_config() {
1754 + use server || die "USE flag 'server' not enabled. Nothing to configure."
1755 +
1756 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
1757 && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1758 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1759 @@ -356,15 +412,17 @@ pkg_config() {
1760 src_test() {
1761 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1762
1763 - if [[ ${UID} -ne 0 ]] ; then
1764 + if use server && [[ ${UID} -ne 0 ]] ; then
1765 emake check
1766
1767 einfo "If you think other tests besides the regression tests are necessary, please"
1768 einfo "submit a bug including a patch for this ebuild to enable them."
1769 else
1770 + use server || \
1771 + ewarn 'Tests cannot be run without the "server" use flag enabled.'
1772 [[ ${UID} -eq 0 ]] || \
1773 - ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES."
1774 + ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
1775
1776 - ewarn "Skipping."
1777 + ewarn 'Skipping.'
1778 fi
1779 }
1780
1781 diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9999.ebuild
1782 index 5272ee4..6dec347 100644
1783 --- a/dev-db/postgresql/postgresql-9999.ebuild
1784 +++ b/dev-db/postgresql/postgresql-9999.ebuild
1785 @@ -4,7 +4,7 @@
1786
1787 EAPI="5"
1788
1789 -PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
1790 +PYTHON_COMPAT=( python{2_7,3_4} )
1791
1792 inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \
1793 python-single-r1 systemd user versionator
1794 @@ -22,7 +22,7 @@ HOMEPAGE="http://www.postgresql.org/"
1795
1796 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
1797 zh_CN zh_TW"
1798 -IUSE="kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python
1799 +IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
1800 +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
1801
1802 for lingua in ${LINGUAS}; do
1803 @@ -49,7 +49,10 @@ pam? ( virtual/pam )
1804 perl? ( >=dev-lang/perl-5.8 )
1805 python? ( ${PYTHON_DEPS} )
1806 readline? ( sys-libs/readline:0= )
1807 -ssl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1808 +ssl? (
1809 + !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1810 + libressl? ( dev-libs/libressl:= )
1811 +)
1812 tcl? ( >=dev-lang/tcl-8:0= )
1813 uuid? ( dev-libs/ossp-uuid )
1814 xml? ( dev-libs/libxml2 dev-libs/libxslt )