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: Fri, 18 Dec 2015 15:25:09
Message-Id: 1450452128.bd2a107cf3fe9c6e3a1dba32dee86304f606a82e.titanofold@gentoo
1 commit: bd2a107cf3fe9c6e3a1dba32dee86304f606a82e
2 Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 18 15:22:08 2015 +0000
4 Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 18 15:22:08 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd2a107c
7
8 Remove Outdated
9
10 Package-Manager: portage-2.2.20.1
11
12 dev-db/postgresql/Manifest | 2 -
13 dev-db/postgresql/postgresql-9.5_beta1-r1.ebuild | 426 ----------------------
14 dev-db/postgresql/postgresql-9.5_beta2-r1.ebuild | 431 -----------------------
15 dev-db/postgresql/postgresql-9.5_beta2.ebuild | 426 ----------------------
16 4 files changed, 1285 deletions(-)
17
18 diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest
19 index 32e4f83..a03c3b7 100644
20 --- a/dev-db/postgresql/Manifest
21 +++ b/dev-db/postgresql/Manifest
22 @@ -3,6 +3,4 @@ DIST postgresql-9.1.19.tar.bz2 15843978 SHA256 cbd5057451147dd63a1e764176a4e17a7
23 DIST postgresql-9.2.14.tar.bz2 16451398 SHA256 54c20b3f320a48c38487f2711e98b2fa3f9ce4305905a294ad0449e8b4fb292e SHA512 268015d9e397ee62eebbbc9abf1ee25d0d4aa6bf5943b404009b3aab31f485b8523353c679beed34cc00304b9d4c7aca9de0ba841d9841dbf885d05d1a5692a1 WHIRLPOOL 4f6d5d6989a67d14082ddb215411b55d0dc0be29772e6a593b4df133489ff4a7e6c265d0830adba64d4c6be47e17a949cbc21d6570dceb9362399649af2be88e
24 DIST postgresql-9.3.10.tar.bz2 16995860 SHA256 e5444f0f76aff98a251400b7c28bc361d65e3d72d8d6cb9bb5d8361a69541531 SHA512 6b048fd1d0b38f72bab6ea70e40f10e7b805b94fc4c6fd865e0ec5e86da3c54043f20059dbf716d29eb4ca787dc50da561b1c7b48ab9f3096ebc651300855672 WHIRLPOOL b8ea15a04d18535662832d444b556aedffaa8c954b52dcd42d548f53f93b8a9dbfbe9298f63c26d44c8b757e8c10d76711c303cd83c84d9c86bf23c2837e74ce
25 DIST postgresql-9.4.5.tar.bz2 17660960 SHA256 b87c50c66b6ea42a9712b5f6284794fabad0616e6ae420cf0f10523be6d94a39 SHA512 01ad4b5a097efa70f74a9e96b764c32953a9df57d6bf81b893a1e552475f6aba0381580dcd1f27b2c443ce89fecc429eeeb0219af60a0b2f84798f76eb1757f5 WHIRLPOOL 8ea0e9a40cefa53568071f2137bac996898f9bd486cfb5cfcf8bb49590816833f37878f10caabffb9d3127e047f00c916b8830594a485ebe16fb9fe6fc834c95
26 -DIST postgresql-9.5beta1.tar.bz2 18291273 SHA256 b53199e2667982de2039ad7e30467f67c5d7af678e69d6211de8ba1cac75c9f0 SHA512 e8881939bdba346f3770102324d7b011c16e4529603280459e17587e06d933c9f3505b40c5cc82ed3f0410ffd88b5e2f18b2a3272aa4680c3798cf7a0fcc0374 WHIRLPOOL 0cf2c3fd40b2a8d482da5a1597abbc20d239f577c6472a03f8d9795a3e8ef142dfaad7a1eeebf2b2544e34712c243bbd9de63fb4045c4ce15dbde8ec74acb707
27 -DIST postgresql-9.5beta2.tar.bz2 18292888 SHA256 031051cd50ebc4ab07da4e6587c59af6712b21979c486b1af0c31e97e1d9e703 SHA512 a084e9106537896ea2bbba68d046fac542525c583af498481945f208d331f3357463e23a08aee5fd8cbcb4af3922b3bf363c3d76baa7e383cc9f1fae41842636 WHIRLPOOL 74c57debaa3f1166c28a889eb7c46200436cb69cf9de45a0b8af443972c57c1b66af90177985da91b00c5955e887252234e04b8666998074abd925984bf7007c
28 DIST postgresql-9.5rc1.tar.bz2 18323591 SHA256 497c44b95accec23e38f7ee93fd42488bddfbdab4858ad94de18348b0913add3 SHA512 3c94fdeef3bd3fd2527c8935bdd797ad3fd698fea1c87e685fee1ceee38350c1bccfb7cf120bb07c498f0a62c4f234a2ef2765b03f35fc9dbba0e82177890101 WHIRLPOOL b59d8d9a72b1059dca25be72d44349a16932bf37d33817a6a1fca81552ccb0b0c50b1046f58b0047ff9144e37b54f3b9053e881ff00646387521f916db4aab17
29
30 diff --git a/dev-db/postgresql/postgresql-9.5_beta1-r1.ebuild b/dev-db/postgresql/postgresql-9.5_beta1-r1.ebuild
31 deleted file mode 100644
32 index cc14882..0000000
33 --- a/dev-db/postgresql/postgresql-9.5_beta1-r1.ebuild
34 +++ /dev/null
35 @@ -1,426 +0,0 @@
36 -# Copyright 1999-2015 Gentoo Foundation
37 -# Distributed under the terms of the GNU General Public License v2
38 -# $Id$
39 -
40 -EAPI="5"
41 -
42 -PYTHON_COMPAT=( python{2_7,3_4} )
43 -
44 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
45 - systemd user versionator
46 -
47 -# This is a prerelease version, so no keywords please
48 -KEYWORDS=""
49 -#KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
50 -
51 -SLOT="$(get_version_component_range 1-2)"
52 -
53 -MY_PV=${PV/_/}
54 -
55 -S=${WORKDIR}/${PN}-${MY_PV}
56 -
57 -SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
58 -
59 -LICENSE="POSTGRESQL GPL-2"
60 -DESCRIPTION="PostgreSQL RDBMS"
61 -HOMEPAGE="http://www.postgresql.org/"
62 -
63 -LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
64 - zh_CN zh_TW"
65 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
66 - +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
67 -
68 -for lingua in ${LINGUAS}; do
69 - IUSE+=" linguas_${lingua}"
70 -done
71 -
72 -wanted_languages() {
73 - local enable_langs
74 -
75 - for lingua in ${LINGUAS} ; do
76 - use linguas_${lingua} && enable_langs+="${lingua} "
77 - done
78 -
79 - echo -n ${enable_langs}
80 -}
81 -
82 -CDEPEND="
83 ->=app-eselect/eselect-postgresql-1.2.0
84 -sys-apps/less
85 -virtual/libintl
86 -kerberos? ( virtual/krb5 )
87 -ldap? ( net-nds/openldap )
88 -pam? ( virtual/pam )
89 -perl? ( >=dev-lang/perl-5.8 )
90 -python? ( ${PYTHON_DEPS} )
91 -readline? ( sys-libs/readline:0= )
92 -ssl? (
93 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
94 - libressl? ( dev-libs/libressl:= )
95 -)
96 -tcl? ( >=dev-lang/tcl-8:0= )
97 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
98 -zlib? ( sys-libs/zlib )
99 -"
100 -
101 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
102 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
103 -# the libc includes UUID functions.
104 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
105 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
106 -
107 -nest_usedep() {
108 - local front back
109 - while [[ ${#} -gt 1 ]]; do
110 - front+="${1}? ( "
111 - back+=" )"
112 - shift
113 - done
114 - echo "${front}${1}${back}"
115 -}
116 -
117 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
118 -CDEPEND+="
119 -uuid? (
120 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
121 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
122 -)"
123 -
124 -DEPEND="${CDEPEND}
125 -!!<sys-apps/sandbox-2.0
126 -sys-devel/bison
127 -sys-devel/flex
128 -nls? ( sys-devel/gettext )
129 -xml? ( virtual/pkgconfig )
130 -"
131 -
132 -RDEPEND="${CDEPEND}
133 -!dev-db/postgresql-docs:${SLOT}
134 -!dev-db/postgresql-base:${SLOT}
135 -!dev-db/postgresql-server:${SLOT}
136 -selinux? ( sec-policy/selinux-postgresql )
137 -"
138 -
139 -pkg_setup() {
140 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
141 -
142 - enewgroup postgres 70
143 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
144 -
145 - use python && python-single-r1_pkg_setup
146 -}
147 -
148 -src_prepare() {
149 - # Work around PPC{,64} compilation bug where bool is already defined
150 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
151 -
152 - # Set proper run directory
153 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
154 - -i src/include/pg_config_manual.h || die
155 -
156 - use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
157 -
158 - # Fix bug 486556 where the server would crash at start up because of
159 - # an infinite loop caused by a self-referencing symlink.
160 - epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch"
161 -
162 - if use pam ; then
163 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
164 - -i src/backend/libpq/auth.c || \
165 - die 'PGSQL_PAM_SERVICE rename failed.'
166 - fi
167 -
168 - epatch_user
169 -}
170 -
171 -src_configure() {
172 - case ${CHOST} in
173 - *-darwin*|*-solaris*)
174 - use nls && append-libs intl
175 - ;;
176 - esac
177 -
178 - export LDFLAGS_SL="${LDFLAGS}"
179 - export LDFLAGS_EX="${LDFLAGS}"
180 -
181 - local PO="${EPREFIX%/}"
182 -
183 - local i uuid_config=""
184 - if use uuid; then
185 - for i in ${UTIL_LINUX_LIBC[@]}; do
186 - use ${i} && uuid_config="--with-uuid=e2fs"
187 - done
188 - for i in ${BSD_LIBC[@]}; do
189 - use ${i} && uuid_config="--with-uuid=bsd"
190 - done
191 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
192 - fi
193 -
194 - econf \
195 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
196 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
197 - --docdir="${PO}/usr/share/doc/${PF}" \
198 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
199 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
200 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
201 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
202 - $(use_enable !pg_legacytimestamp integer-datetimes) \
203 - $(use_enable threads thread-safety) \
204 - $(use_with kerberos gssapi) \
205 - $(use_with ldap) \
206 - $(use_with pam) \
207 - $(use_with perl) \
208 - $(use_with python) \
209 - $(use_with readline) \
210 - $(use_with ssl openssl) \
211 - $(use_with tcl) \
212 - ${uuid_config} \
213 - $(use_with xml libxml) \
214 - $(use_with xml libxslt) \
215 - $(use_with zlib) \
216 - "$(use_enable nls nls "$(wanted_languages)")"
217 -}
218 -
219 -src_compile() {
220 - emake
221 - emake -C contrib
222 -}
223 -
224 -src_install() {
225 - emake DESTDIR="${D}" install
226 - emake DESTDIR="${D}" install -C contrib
227 -
228 - dodoc README HISTORY doc/{TODO,bug.template}
229 -
230 - # man pages are already built, but if we have the target make them,
231 - # they'll be generated from source before being installed so we
232 - # manually install man pages.
233 - # We use ${SLOT} instead of doman for postgresql.eselect
234 - insinto /usr/share/postgresql-${SLOT}/man/
235 - doins -r doc/src/sgml/man{1,3,7}
236 - if ! use server; then
237 - # Remove man pages for non-existent binaries
238 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
239 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
240 - done
241 - fi
242 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
243 -
244 - insinto /etc/postgresql-${SLOT}
245 - newins src/bin/psql/psqlrc.sample psqlrc
246 -
247 - dodir /etc/eselect/postgresql/slots/${SLOT}
248 - echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \
249 - "${ED}/etc/eselect/postgresql/slots/${SLOT}/base"
250 -
251 - use static-libs || find "${ED}" -name '*.a' -delete
252 -
253 - if use doc ; then
254 - docinto html
255 - dodoc doc/src/sgml/html/*
256 -
257 - docinto sgml
258 - dodoc doc/src/sgml/*.{sgml,dsl}
259 - fi
260 -
261 - if use server; then
262 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
263 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
264 -
265 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
266 - "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT}
267 -
268 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
269 - "${FILESDIR}/${PN}.service" | \
270 - systemd_newunit - ${PN}-${SLOT}.service
271 -
272 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
273 -
274 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
275 -
276 - if use prefix ; then
277 - keepdir /run/postgresql
278 - fperms 0775 /run/postgresql
279 - fi
280 - fi
281 -}
282 -
283 -pkg_postinst() {
284 - postgresql-config update
285 -
286 - elog "If you need a global psqlrc-file, you can place it in:"
287 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
288 -
289 - if use server ; then
290 - elog
291 - elog "Gentoo specific documentation:"
292 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
293 - elog
294 - elog "Official documentation:"
295 - elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
296 - elog
297 - elog "The default location of the Unix-domain socket is:"
298 - elog " ${EROOT%/}/run/postgresql/"
299 - elog
300 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
301 - elog "so that it contains your preferred locale in:"
302 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
303 - elog
304 - elog "Then, execute the following command to setup the initial database"
305 - elog "environment:"
306 - elog " emerge --config =${CATEGORY}/${PF}"
307 - fi
308 -}
309 -
310 -pkg_prerm() {
311 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
312 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
313 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
314 -
315 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
316 - sleep 10
317 - eend 0
318 - fi
319 -}
320 -
321 -pkg_postrm() {
322 - postgresql-config update
323 -}
324 -
325 -pkg_config() {
326 - use server || die "USE flag 'server' not enabled. Nothing to configure."
327 -
328 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
329 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
330 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
331 - [[ -z "${DATA_DIR}" ]] \
332 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
333 -
334 - # environment.bz2 may not contain the same locale as the current system
335 - # locale. Unset and source from the current system locale.
336 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
337 - unset LANG
338 - unset LC_CTYPE
339 - unset LC_NUMERIC
340 - unset LC_TIME
341 - unset LC_COLLATE
342 - unset LC_MONETARY
343 - unset LC_MESSAGES
344 - unset LC_ALL
345 - source "${EROOT%/}/etc/env.d/02locale"
346 - [ -n "${LANG}" ] && export LANG
347 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
348 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
349 - [ -n "${LC_TIME}" ] && export LC_TIME
350 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
351 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
352 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
353 - [ -n "${LC_ALL}" ] && export LC_ALL
354 - fi
355 -
356 - einfo "You can modify the paths and options passed to initdb by editing:"
357 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
358 - einfo
359 - einfo "Information on options that can be passed to initdb are found at:"
360 - einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
361 - einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
362 - einfo
363 - einfo "PG_INITDB_OPTS is currently set to:"
364 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
365 - einfo " (none)"
366 - else
367 - einfo " ${PG_INITDB_OPTS}"
368 - fi
369 - einfo
370 - einfo "Configuration files will be installed to:"
371 - einfo " ${PGDATA}"
372 - einfo
373 - einfo "The database cluster will be created in:"
374 - einfo " ${DATA_DIR}"
375 - einfo
376 - while [ "$correct" != "true" ] ; do
377 - einfo "Are you ready to continue? (y/n)"
378 - read answer
379 - if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
380 - correct="true"
381 - elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
382 - die "Aborting initialization."
383 - else
384 - echo "Answer not recognized"
385 - fi
386 - done
387 -
388 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
389 - eerror "The given directory, '${DATA_DIR}', is not empty."
390 - eerror "Modify DATA_DIR to point to an empty directory."
391 - die "${DATA_DIR} is not empty."
392 - fi
393 -
394 - einfo "Creating the data directory ..."
395 - if [[ ${EUID} == 0 ]] ; then
396 - mkdir -p "${DATA_DIR}"
397 - chown -Rf postgres:postgres "${DATA_DIR}"
398 - chmod 0700 "${DATA_DIR}"
399 - fi
400 -
401 - einfo "Initializing the database ..."
402 -
403 - if [[ ${EUID} == 0 ]] ; then
404 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
405 - else
406 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
407 - fi
408 -
409 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
410 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
411 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
412 - fi
413 -
414 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
415 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
416 - # On the off-chance that you might need to work with UTF-8 encoded
417 - # characters in PL/Perl
418 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
419 - EOF
420 -
421 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
422 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
423 - einfo "by default. You can disable it in the cluster's:"
424 - einfo " ${PGDATA%/}/postgresql.conf"
425 - einfo
426 - einfo "The PostgreSQL server, by default, will log events to:"
427 - einfo " ${DATA_DIR%/}/postmaster.log"
428 - einfo
429 - if use prefix ; then
430 - einfo "The location of the configuration files have moved to:"
431 - einfo " ${PGDATA}"
432 - einfo "To start the server:"
433 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
434 - einfo "To stop:"
435 - einfo " pg_ctl stop -D ${DATA_DIR}"
436 - einfo
437 - einfo "Or move the configuration files back:"
438 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
439 - else
440 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
441 - einfo "instead of 'pg_ctl'."
442 - fi
443 -}
444 -
445 -src_test() {
446 - einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
447 -
448 - if use server && [[ ${UID} -ne 0 ]] ; then
449 - emake check
450 -
451 - einfo "If you think other tests besides the regression tests are necessary, please"
452 - einfo "submit a bug including a patch for this ebuild to enable them."
453 - else
454 - use server || \
455 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
456 - [[ ${UID} -eq 0 ]] || \
457 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
458 -
459 - ewarn 'Skipping.'
460 - fi
461 -}
462
463 diff --git a/dev-db/postgresql/postgresql-9.5_beta2-r1.ebuild b/dev-db/postgresql/postgresql-9.5_beta2-r1.ebuild
464 deleted file mode 100644
465 index 181c72e..0000000
466 --- a/dev-db/postgresql/postgresql-9.5_beta2-r1.ebuild
467 +++ /dev/null
468 @@ -1,431 +0,0 @@
469 -# Copyright 1999-2015 Gentoo Foundation
470 -# Distributed under the terms of the GNU General Public License v2
471 -# $Id$
472 -
473 -EAPI="5"
474 -
475 -PYTHON_COMPAT=( python{2_7,3_4} )
476 -
477 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
478 - systemd user versionator
479 -
480 -# This is a prerelease version, so no keywords please
481 -KEYWORDS=""
482 -#KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
483 -
484 -SLOT="$(get_version_component_range 1-2)"
485 -
486 -MY_PV=${PV/_/}
487 -
488 -S=${WORKDIR}/${PN}-${MY_PV}
489 -
490 -SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
491 -
492 -LICENSE="POSTGRESQL GPL-2"
493 -DESCRIPTION="PostgreSQL RDBMS"
494 -HOMEPAGE="http://www.postgresql.org/"
495 -
496 -LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
497 - zh_CN zh_TW"
498 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
499 - +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
500 -
501 -for lingua in ${LINGUAS}; do
502 - IUSE+=" linguas_${lingua}"
503 -done
504 -
505 -wanted_languages() {
506 - local enable_langs
507 -
508 - for lingua in ${LINGUAS} ; do
509 - use linguas_${lingua} && enable_langs+="${lingua} "
510 - done
511 -
512 - echo -n ${enable_langs}
513 -}
514 -
515 -CDEPEND="
516 ->=app-eselect/eselect-postgresql-1.2.0
517 -sys-apps/less
518 -virtual/libintl
519 -kerberos? ( virtual/krb5 )
520 -ldap? ( net-nds/openldap )
521 -pam? ( virtual/pam )
522 -perl? ( >=dev-lang/perl-5.8 )
523 -python? ( ${PYTHON_DEPS} )
524 -readline? ( sys-libs/readline:0= )
525 -ssl? (
526 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
527 - libressl? ( dev-libs/libressl:= )
528 -)
529 -tcl? ( >=dev-lang/tcl-8:0= )
530 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
531 -zlib? ( sys-libs/zlib )
532 -"
533 -
534 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
535 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
536 -# the libc includes UUID functions.
537 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
538 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
539 -
540 -nest_usedep() {
541 - local front back
542 - while [[ ${#} -gt 1 ]]; do
543 - front+="${1}? ( "
544 - back+=" )"
545 - shift
546 - done
547 - echo "${front}${1}${back}"
548 -}
549 -
550 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
551 -CDEPEND+="
552 -uuid? (
553 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
554 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
555 -)"
556 -
557 -DEPEND="${CDEPEND}
558 -!!<sys-apps/sandbox-2.0
559 -sys-devel/bison
560 -sys-devel/flex
561 -nls? ( sys-devel/gettext )
562 -xml? ( virtual/pkgconfig )
563 -"
564 -
565 -RDEPEND="${CDEPEND}
566 -!dev-db/postgresql-docs:${SLOT}
567 -!dev-db/postgresql-base:${SLOT}
568 -!dev-db/postgresql-server:${SLOT}
569 -selinux? ( sec-policy/selinux-postgresql )
570 -"
571 -
572 -pkg_setup() {
573 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
574 -
575 - enewgroup postgres 70
576 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
577 -
578 - use python && python-single-r1_pkg_setup
579 -}
580 -
581 -src_prepare() {
582 - # Work around PPC{,64} compilation bug where bool is already defined
583 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
584 -
585 - # Set proper run directory
586 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
587 - -i src/include/pg_config_manual.h || die
588 -
589 - # Rely on $PATH being in the proper order so that the correct
590 - # install program is used for modules utilizing PGXS in both
591 - # hardened and non-hardened environments. (Bug #528786)
592 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
593 -
594 - use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
595 -
596 - # Fix bug 486556 where the server would crash at start up because of
597 - # an infinite loop caused by a self-referencing symlink.
598 - epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch"
599 -
600 - if use pam ; then
601 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
602 - -i src/backend/libpq/auth.c || \
603 - die 'PGSQL_PAM_SERVICE rename failed.'
604 - fi
605 -
606 - epatch_user
607 -}
608 -
609 -src_configure() {
610 - case ${CHOST} in
611 - *-darwin*|*-solaris*)
612 - use nls && append-libs intl
613 - ;;
614 - esac
615 -
616 - export LDFLAGS_SL="${LDFLAGS}"
617 - export LDFLAGS_EX="${LDFLAGS}"
618 -
619 - local PO="${EPREFIX%/}"
620 -
621 - local i uuid_config=""
622 - if use uuid; then
623 - for i in ${UTIL_LINUX_LIBC[@]}; do
624 - use ${i} && uuid_config="--with-uuid=e2fs"
625 - done
626 - for i in ${BSD_LIBC[@]}; do
627 - use ${i} && uuid_config="--with-uuid=bsd"
628 - done
629 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
630 - fi
631 -
632 - econf \
633 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
634 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
635 - --docdir="${PO}/usr/share/doc/${PF}" \
636 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
637 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
638 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
639 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
640 - $(use_enable !pg_legacytimestamp integer-datetimes) \
641 - $(use_enable threads thread-safety) \
642 - $(use_with kerberos gssapi) \
643 - $(use_with ldap) \
644 - $(use_with pam) \
645 - $(use_with perl) \
646 - $(use_with python) \
647 - $(use_with readline) \
648 - $(use_with ssl openssl) \
649 - $(use_with tcl) \
650 - ${uuid_config} \
651 - $(use_with xml libxml) \
652 - $(use_with xml libxslt) \
653 - $(use_with zlib) \
654 - "$(use_enable nls nls "$(wanted_languages)")"
655 -}
656 -
657 -src_compile() {
658 - emake
659 - emake -C contrib
660 -}
661 -
662 -src_install() {
663 - emake DESTDIR="${D}" install
664 - emake DESTDIR="${D}" install -C contrib
665 -
666 - dodoc README HISTORY doc/{TODO,bug.template}
667 -
668 - # man pages are already built, but if we have the target make them,
669 - # they'll be generated from source before being installed so we
670 - # manually install man pages.
671 - # We use ${SLOT} instead of doman for postgresql.eselect
672 - insinto /usr/share/postgresql-${SLOT}/man/
673 - doins -r doc/src/sgml/man{1,3,7}
674 - if ! use server; then
675 - # Remove man pages for non-existent binaries
676 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
677 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
678 - done
679 - fi
680 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
681 -
682 - insinto /etc/postgresql-${SLOT}
683 - newins src/bin/psql/psqlrc.sample psqlrc
684 -
685 - dodir /etc/eselect/postgresql/slots/${SLOT}
686 - echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \
687 - "${ED}/etc/eselect/postgresql/slots/${SLOT}/base"
688 -
689 - use static-libs || find "${ED}" -name '*.a' -delete
690 -
691 - if use doc ; then
692 - docinto html
693 - dodoc doc/src/sgml/html/*
694 -
695 - docinto sgml
696 - dodoc doc/src/sgml/*.{sgml,dsl}
697 - fi
698 -
699 - if use server; then
700 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
701 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
702 -
703 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
704 - "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT}
705 -
706 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
707 - "${FILESDIR}/${PN}.service" | \
708 - systemd_newunit - ${PN}-${SLOT}.service
709 -
710 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
711 -
712 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
713 -
714 - if use prefix ; then
715 - keepdir /run/postgresql
716 - fperms 0775 /run/postgresql
717 - fi
718 - fi
719 -}
720 -
721 -pkg_postinst() {
722 - postgresql-config update
723 -
724 - elog "If you need a global psqlrc-file, you can place it in:"
725 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
726 -
727 - if use server ; then
728 - elog
729 - elog "Gentoo specific documentation:"
730 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
731 - elog
732 - elog "Official documentation:"
733 - elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
734 - elog
735 - elog "The default location of the Unix-domain socket is:"
736 - elog " ${EROOT%/}/run/postgresql/"
737 - elog
738 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
739 - elog "so that it contains your preferred locale in:"
740 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
741 - elog
742 - elog "Then, execute the following command to setup the initial database"
743 - elog "environment:"
744 - elog " emerge --config =${CATEGORY}/${PF}"
745 - fi
746 -}
747 -
748 -pkg_prerm() {
749 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
750 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
751 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
752 -
753 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
754 - sleep 10
755 - eend 0
756 - fi
757 -}
758 -
759 -pkg_postrm() {
760 - postgresql-config update
761 -}
762 -
763 -pkg_config() {
764 - use server || die "USE flag 'server' not enabled. Nothing to configure."
765 -
766 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
767 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
768 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
769 - [[ -z "${DATA_DIR}" ]] \
770 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
771 -
772 - # environment.bz2 may not contain the same locale as the current system
773 - # locale. Unset and source from the current system locale.
774 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
775 - unset LANG
776 - unset LC_CTYPE
777 - unset LC_NUMERIC
778 - unset LC_TIME
779 - unset LC_COLLATE
780 - unset LC_MONETARY
781 - unset LC_MESSAGES
782 - unset LC_ALL
783 - source "${EROOT%/}/etc/env.d/02locale"
784 - [ -n "${LANG}" ] && export LANG
785 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
786 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
787 - [ -n "${LC_TIME}" ] && export LC_TIME
788 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
789 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
790 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
791 - [ -n "${LC_ALL}" ] && export LC_ALL
792 - fi
793 -
794 - einfo "You can modify the paths and options passed to initdb by editing:"
795 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
796 - einfo
797 - einfo "Information on options that can be passed to initdb are found at:"
798 - einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
799 - einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
800 - einfo
801 - einfo "PG_INITDB_OPTS is currently set to:"
802 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
803 - einfo " (none)"
804 - else
805 - einfo " ${PG_INITDB_OPTS}"
806 - fi
807 - einfo
808 - einfo "Configuration files will be installed to:"
809 - einfo " ${PGDATA}"
810 - einfo
811 - einfo "The database cluster will be created in:"
812 - einfo " ${DATA_DIR}"
813 - einfo
814 - while [ "$correct" != "true" ] ; do
815 - einfo "Are you ready to continue? (y/n)"
816 - read answer
817 - if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
818 - correct="true"
819 - elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
820 - die "Aborting initialization."
821 - else
822 - echo "Answer not recognized"
823 - fi
824 - done
825 -
826 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
827 - eerror "The given directory, '${DATA_DIR}', is not empty."
828 - eerror "Modify DATA_DIR to point to an empty directory."
829 - die "${DATA_DIR} is not empty."
830 - fi
831 -
832 - einfo "Creating the data directory ..."
833 - if [[ ${EUID} == 0 ]] ; then
834 - mkdir -p "${DATA_DIR}"
835 - chown -Rf postgres:postgres "${DATA_DIR}"
836 - chmod 0700 "${DATA_DIR}"
837 - fi
838 -
839 - einfo "Initializing the database ..."
840 -
841 - if [[ ${EUID} == 0 ]] ; then
842 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
843 - else
844 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
845 - fi
846 -
847 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
848 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
849 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
850 - fi
851 -
852 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
853 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
854 - # On the off-chance that you might need to work with UTF-8 encoded
855 - # characters in PL/Perl
856 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
857 - EOF
858 -
859 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
860 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
861 - einfo "by default. You can disable it in the cluster's:"
862 - einfo " ${PGDATA%/}/postgresql.conf"
863 - einfo
864 - einfo "The PostgreSQL server, by default, will log events to:"
865 - einfo " ${DATA_DIR%/}/postmaster.log"
866 - einfo
867 - if use prefix ; then
868 - einfo "The location of the configuration files have moved to:"
869 - einfo " ${PGDATA}"
870 - einfo "To start the server:"
871 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
872 - einfo "To stop:"
873 - einfo " pg_ctl stop -D ${DATA_DIR}"
874 - einfo
875 - einfo "Or move the configuration files back:"
876 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
877 - else
878 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
879 - einfo "instead of 'pg_ctl'."
880 - fi
881 -}
882 -
883 -src_test() {
884 - einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
885 -
886 - if use server && [[ ${UID} -ne 0 ]] ; then
887 - emake check
888 -
889 - einfo "If you think other tests besides the regression tests are necessary, please"
890 - einfo "submit a bug including a patch for this ebuild to enable them."
891 - else
892 - use server || \
893 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
894 - [[ ${UID} -eq 0 ]] || \
895 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
896 -
897 - ewarn 'Skipping.'
898 - fi
899 -}
900
901 diff --git a/dev-db/postgresql/postgresql-9.5_beta2.ebuild b/dev-db/postgresql/postgresql-9.5_beta2.ebuild
902 deleted file mode 100644
903 index cc14882..0000000
904 --- a/dev-db/postgresql/postgresql-9.5_beta2.ebuild
905 +++ /dev/null
906 @@ -1,426 +0,0 @@
907 -# Copyright 1999-2015 Gentoo Foundation
908 -# Distributed under the terms of the GNU General Public License v2
909 -# $Id$
910 -
911 -EAPI="5"
912 -
913 -PYTHON_COMPAT=( python{2_7,3_4} )
914 -
915 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
916 - systemd user versionator
917 -
918 -# This is a prerelease version, so no keywords please
919 -KEYWORDS=""
920 -#KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
921 -
922 -SLOT="$(get_version_component_range 1-2)"
923 -
924 -MY_PV=${PV/_/}
925 -
926 -S=${WORKDIR}/${PN}-${MY_PV}
927 -
928 -SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
929 -
930 -LICENSE="POSTGRESQL GPL-2"
931 -DESCRIPTION="PostgreSQL RDBMS"
932 -HOMEPAGE="http://www.postgresql.org/"
933 -
934 -LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr
935 - zh_CN zh_TW"
936 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
937 - +readline selinux +server ssl static-libs tcl threads uuid xml zlib"
938 -
939 -for lingua in ${LINGUAS}; do
940 - IUSE+=" linguas_${lingua}"
941 -done
942 -
943 -wanted_languages() {
944 - local enable_langs
945 -
946 - for lingua in ${LINGUAS} ; do
947 - use linguas_${lingua} && enable_langs+="${lingua} "
948 - done
949 -
950 - echo -n ${enable_langs}
951 -}
952 -
953 -CDEPEND="
954 ->=app-eselect/eselect-postgresql-1.2.0
955 -sys-apps/less
956 -virtual/libintl
957 -kerberos? ( virtual/krb5 )
958 -ldap? ( net-nds/openldap )
959 -pam? ( virtual/pam )
960 -perl? ( >=dev-lang/perl-5.8 )
961 -python? ( ${PYTHON_DEPS} )
962 -readline? ( sys-libs/readline:0= )
963 -ssl? (
964 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
965 - libressl? ( dev-libs/libressl:= )
966 -)
967 -tcl? ( >=dev-lang/tcl-8:0= )
968 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
969 -zlib? ( sys-libs/zlib )
970 -"
971 -
972 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
973 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
974 -# the libc includes UUID functions.
975 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
976 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
977 -
978 -nest_usedep() {
979 - local front back
980 - while [[ ${#} -gt 1 ]]; do
981 - front+="${1}? ( "
982 - back+=" )"
983 - shift
984 - done
985 - echo "${front}${1}${back}"
986 -}
987 -
988 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
989 -CDEPEND+="
990 -uuid? (
991 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
992 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
993 -)"
994 -
995 -DEPEND="${CDEPEND}
996 -!!<sys-apps/sandbox-2.0
997 -sys-devel/bison
998 -sys-devel/flex
999 -nls? ( sys-devel/gettext )
1000 -xml? ( virtual/pkgconfig )
1001 -"
1002 -
1003 -RDEPEND="${CDEPEND}
1004 -!dev-db/postgresql-docs:${SLOT}
1005 -!dev-db/postgresql-base:${SLOT}
1006 -!dev-db/postgresql-server:${SLOT}
1007 -selinux? ( sec-policy/selinux-postgresql )
1008 -"
1009 -
1010 -pkg_setup() {
1011 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
1012 -
1013 - enewgroup postgres 70
1014 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
1015 -
1016 - use python && python-single-r1_pkg_setup
1017 -}
1018 -
1019 -src_prepare() {
1020 - # Work around PPC{,64} compilation bug where bool is already defined
1021 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
1022 -
1023 - # Set proper run directory
1024 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1025 - -i src/include/pg_config_manual.h || die
1026 -
1027 - use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
1028 -
1029 - # Fix bug 486556 where the server would crash at start up because of
1030 - # an infinite loop caused by a self-referencing symlink.
1031 - epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch"
1032 -
1033 - if use pam ; then
1034 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
1035 - -i src/backend/libpq/auth.c || \
1036 - die 'PGSQL_PAM_SERVICE rename failed.'
1037 - fi
1038 -
1039 - epatch_user
1040 -}
1041 -
1042 -src_configure() {
1043 - case ${CHOST} in
1044 - *-darwin*|*-solaris*)
1045 - use nls && append-libs intl
1046 - ;;
1047 - esac
1048 -
1049 - export LDFLAGS_SL="${LDFLAGS}"
1050 - export LDFLAGS_EX="${LDFLAGS}"
1051 -
1052 - local PO="${EPREFIX%/}"
1053 -
1054 - local i uuid_config=""
1055 - if use uuid; then
1056 - for i in ${UTIL_LINUX_LIBC[@]}; do
1057 - use ${i} && uuid_config="--with-uuid=e2fs"
1058 - done
1059 - for i in ${BSD_LIBC[@]}; do
1060 - use ${i} && uuid_config="--with-uuid=bsd"
1061 - done
1062 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
1063 - fi
1064 -
1065 - econf \
1066 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
1067 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
1068 - --docdir="${PO}/usr/share/doc/${PF}" \
1069 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
1070 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
1071 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
1072 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
1073 - $(use_enable !pg_legacytimestamp integer-datetimes) \
1074 - $(use_enable threads thread-safety) \
1075 - $(use_with kerberos gssapi) \
1076 - $(use_with ldap) \
1077 - $(use_with pam) \
1078 - $(use_with perl) \
1079 - $(use_with python) \
1080 - $(use_with readline) \
1081 - $(use_with ssl openssl) \
1082 - $(use_with tcl) \
1083 - ${uuid_config} \
1084 - $(use_with xml libxml) \
1085 - $(use_with xml libxslt) \
1086 - $(use_with zlib) \
1087 - "$(use_enable nls nls "$(wanted_languages)")"
1088 -}
1089 -
1090 -src_compile() {
1091 - emake
1092 - emake -C contrib
1093 -}
1094 -
1095 -src_install() {
1096 - emake DESTDIR="${D}" install
1097 - emake DESTDIR="${D}" install -C contrib
1098 -
1099 - dodoc README HISTORY doc/{TODO,bug.template}
1100 -
1101 - # man pages are already built, but if we have the target make them,
1102 - # they'll be generated from source before being installed so we
1103 - # manually install man pages.
1104 - # We use ${SLOT} instead of doman for postgresql.eselect
1105 - insinto /usr/share/postgresql-${SLOT}/man/
1106 - doins -r doc/src/sgml/man{1,3,7}
1107 - if ! use server; then
1108 - # Remove man pages for non-existent binaries
1109 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
1110 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
1111 - done
1112 - fi
1113 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1114 -
1115 - insinto /etc/postgresql-${SLOT}
1116 - newins src/bin/psql/psqlrc.sample psqlrc
1117 -
1118 - dodir /etc/eselect/postgresql/slots/${SLOT}
1119 - echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \
1120 - "${ED}/etc/eselect/postgresql/slots/${SLOT}/base"
1121 -
1122 - use static-libs || find "${ED}" -name '*.a' -delete
1123 -
1124 - if use doc ; then
1125 - docinto html
1126 - dodoc doc/src/sgml/html/*
1127 -
1128 - docinto sgml
1129 - dodoc doc/src/sgml/*.{sgml,dsl}
1130 - fi
1131 -
1132 - if use server; then
1133 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1134 - "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT}
1135 -
1136 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1137 - "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT}
1138 -
1139 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1140 - "${FILESDIR}/${PN}.service" | \
1141 - systemd_newunit - ${PN}-${SLOT}.service
1142 -
1143 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1144 -
1145 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1146 -
1147 - if use prefix ; then
1148 - keepdir /run/postgresql
1149 - fperms 0775 /run/postgresql
1150 - fi
1151 - fi
1152 -}
1153 -
1154 -pkg_postinst() {
1155 - postgresql-config update
1156 -
1157 - elog "If you need a global psqlrc-file, you can place it in:"
1158 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1159 -
1160 - if use server ; then
1161 - elog
1162 - elog "Gentoo specific documentation:"
1163 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1164 - elog
1165 - elog "Official documentation:"
1166 - elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
1167 - elog
1168 - elog "The default location of the Unix-domain socket is:"
1169 - elog " ${EROOT%/}/run/postgresql/"
1170 - elog
1171 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1172 - elog "so that it contains your preferred locale in:"
1173 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1174 - elog
1175 - elog "Then, execute the following command to setup the initial database"
1176 - elog "environment:"
1177 - elog " emerge --config =${CATEGORY}/${PF}"
1178 - fi
1179 -}
1180 -
1181 -pkg_prerm() {
1182 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1183 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1184 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
1185 -
1186 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
1187 - sleep 10
1188 - eend 0
1189 - fi
1190 -}
1191 -
1192 -pkg_postrm() {
1193 - postgresql-config update
1194 -}
1195 -
1196 -pkg_config() {
1197 - use server || die "USE flag 'server' not enabled. Nothing to configure."
1198 -
1199 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
1200 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1201 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1202 - [[ -z "${DATA_DIR}" ]] \
1203 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
1204 -
1205 - # environment.bz2 may not contain the same locale as the current system
1206 - # locale. Unset and source from the current system locale.
1207 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
1208 - unset LANG
1209 - unset LC_CTYPE
1210 - unset LC_NUMERIC
1211 - unset LC_TIME
1212 - unset LC_COLLATE
1213 - unset LC_MONETARY
1214 - unset LC_MESSAGES
1215 - unset LC_ALL
1216 - source "${EROOT%/}/etc/env.d/02locale"
1217 - [ -n "${LANG}" ] && export LANG
1218 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1219 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1220 - [ -n "${LC_TIME}" ] && export LC_TIME
1221 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1222 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1223 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1224 - [ -n "${LC_ALL}" ] && export LC_ALL
1225 - fi
1226 -
1227 - einfo "You can modify the paths and options passed to initdb by editing:"
1228 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1229 - einfo
1230 - einfo "Information on options that can be passed to initdb are found at:"
1231 - einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1232 - einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1233 - einfo
1234 - einfo "PG_INITDB_OPTS is currently set to:"
1235 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
1236 - einfo " (none)"
1237 - else
1238 - einfo " ${PG_INITDB_OPTS}"
1239 - fi
1240 - einfo
1241 - einfo "Configuration files will be installed to:"
1242 - einfo " ${PGDATA}"
1243 - einfo
1244 - einfo "The database cluster will be created in:"
1245 - einfo " ${DATA_DIR}"
1246 - einfo
1247 - while [ "$correct" != "true" ] ; do
1248 - einfo "Are you ready to continue? (y/n)"
1249 - read answer
1250 - if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
1251 - correct="true"
1252 - elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
1253 - die "Aborting initialization."
1254 - else
1255 - echo "Answer not recognized"
1256 - fi
1257 - done
1258 -
1259 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
1260 - eerror "The given directory, '${DATA_DIR}', is not empty."
1261 - eerror "Modify DATA_DIR to point to an empty directory."
1262 - die "${DATA_DIR} is not empty."
1263 - fi
1264 -
1265 - einfo "Creating the data directory ..."
1266 - if [[ ${EUID} == 0 ]] ; then
1267 - mkdir -p "${DATA_DIR}"
1268 - chown -Rf postgres:postgres "${DATA_DIR}"
1269 - chmod 0700 "${DATA_DIR}"
1270 - fi
1271 -
1272 - einfo "Initializing the database ..."
1273 -
1274 - if [[ ${EUID} == 0 ]] ; then
1275 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
1276 - else
1277 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
1278 - fi
1279 -
1280 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
1281 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
1282 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
1283 - fi
1284 -
1285 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
1286 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
1287 - # On the off-chance that you might need to work with UTF-8 encoded
1288 - # characters in PL/Perl
1289 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
1290 - EOF
1291 -
1292 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
1293 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
1294 - einfo "by default. You can disable it in the cluster's:"
1295 - einfo " ${PGDATA%/}/postgresql.conf"
1296 - einfo
1297 - einfo "The PostgreSQL server, by default, will log events to:"
1298 - einfo " ${DATA_DIR%/}/postmaster.log"
1299 - einfo
1300 - if use prefix ; then
1301 - einfo "The location of the configuration files have moved to:"
1302 - einfo " ${PGDATA}"
1303 - einfo "To start the server:"
1304 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
1305 - einfo "To stop:"
1306 - einfo " pg_ctl stop -D ${DATA_DIR}"
1307 - einfo
1308 - einfo "Or move the configuration files back:"
1309 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
1310 - else
1311 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1312 - einfo "instead of 'pg_ctl'."
1313 - fi
1314 -}
1315 -
1316 -src_test() {
1317 - einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1318 -
1319 - if use server && [[ ${UID} -ne 0 ]] ; then
1320 - emake check
1321 -
1322 - einfo "If you think other tests besides the regression tests are necessary, please"
1323 - einfo "submit a bug including a patch for this ebuild to enable them."
1324 - else
1325 - use server || \
1326 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
1327 - [[ ${UID} -eq 0 ]] || \
1328 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
1329 -
1330 - ewarn 'Skipping.'
1331 - fi
1332 -}