Gentoo Archives: gentoo-commits

From: "Aaron Swenson (titanofold)" <titanofold@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-db/postgresql: postgresql-9.2.9-r1.ebuild postgresql-9.0.18-r1.ebuild postgresql-9999.ebuild ChangeLog postgresql-9.4_beta3-r1.ebuild postgresql-9.1.14-r1.ebuild postgresql-9.3.5-r1.ebuild postgresql-9.3.5.ebuild postgresql-9.1.14.ebuild postgresql-9.2.9.ebuild postgresql-9.0.18.ebuild postgresql-9.4_beta2.ebuild postgresql-9.4_beta3.ebuild
Date: Sat, 01 Nov 2014 11:29:10
Message-Id: 20141101112906.43CA09347@oystercatcher.gentoo.org
1 titanofold 14/11/01 11:29:06
2
3 Modified: postgresql-9999.ebuild ChangeLog
4 Added: postgresql-9.2.9-r1.ebuild
5 postgresql-9.0.18-r1.ebuild
6 postgresql-9.4_beta3-r1.ebuild
7 postgresql-9.1.14-r1.ebuild
8 postgresql-9.3.5-r1.ebuild
9 Removed: postgresql-9.3.5.ebuild postgresql-9.1.14.ebuild
10 postgresql-9.2.9.ebuild postgresql-9.0.18.ebuild
11 postgresql-9.4_beta2.ebuild
12 postgresql-9.4_beta3.ebuild
13 Log:
14 Removed source dependency on patch collection now that the majority only
15 require their respective no-server.patch if the server isn't going to be
16 built. Removed ebuilds with conditionals that always evaluate to false in
17 src_test() and pkg_prerm().
18
19 (Portage version: 2.2.8-r2/cvs/Linux x86_64, signed Manifest commit with key D1BBFDA0)
20
21 Revision Changes Path
22 1.2 dev-db/postgresql/postgresql-9999.ebuild
23
24 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild?rev=1.2&view=markup
25 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild?rev=1.2&content-type=text/plain
26 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild?r1=1.1&r2=1.2
27
28 Index: postgresql-9999.ebuild
29 ===================================================================
30 RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild,v
31 retrieving revision 1.1
32 retrieving revision 1.2
33 diff -u -r1.1 -r1.2
34 --- postgresql-9999.ebuild 11 Oct 2014 19:35:08 -0000 1.1
35 +++ postgresql-9999.ebuild 1 Nov 2014 11:29:06 -0000 1.2
36 @@ -1,6 +1,6 @@
37 # Copyright 1999-2014 Gentoo Foundation
38 # Distributed under the terms of the GNU General Public License v2
39 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild,v 1.1 2014/10/11 19:35:08 titanofold Exp $
40 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild,v 1.2 2014/11/01 11:29:06 titanofold Exp $
41
42 EAPI="5"
43
44 @@ -16,8 +16,8 @@
45
46 EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git"
47
48 -SRC_URI="http://dev.gentoo.org/~floppym/dist/postgresql-initscript-2.7.tbz2
49 - http://dev.gentoo.org/~patrick/postgresql-patches-9.5.tbz2"
50 +# Add initscript source
51 +SRC_URI="http://dev.gentoo.org/~floppym/dist/postgresql-initscript-2.7.tbz2"
52
53 LICENSE="POSTGRESQL GPL-2"
54 DESCRIPTION="PostgreSQL RDBMS"
55 @@ -103,7 +103,7 @@
56 -i "${WORKDIR}"/postgresql{.{init,confd,service},-check-db-dir} || \
57 die "SLOT/LIBDIR sed failed"
58
59 - use server || epatch "${WORKDIR}/base.patch"
60 + use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
61
62 if use pam ; then
63 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
64 @@ -237,7 +237,7 @@
65 }
66
67 pkg_prerm() {
68 - if [[ $(use server) && -z ${REPLACED_BY_VERSION} ]] ; then
69 + if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
70 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
71 ewarn "\thttp://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5"
72
73 @@ -401,7 +401,7 @@
74 src_test() {
75 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
76
77 - if [[ $(use server) -eq 0 && ${UID} -ne 0 ]] ; then
78 + if use server && [[ ${UID} -ne 0 ]] ; then
79 emake check
80
81 einfo "If you think other tests besides the regression tests are necessary, please"
82
83
84
85 1.391 dev-db/postgresql/ChangeLog
86
87 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/ChangeLog?rev=1.391&view=markup
88 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/ChangeLog?rev=1.391&content-type=text/plain
89 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/ChangeLog?r1=1.390&r2=1.391
90
91 Index: ChangeLog
92 ===================================================================
93 RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v
94 retrieving revision 1.390
95 retrieving revision 1.391
96 diff -u -r1.390 -r1.391
97 --- ChangeLog 26 Oct 2014 02:22:46 -0000 1.390
98 +++ ChangeLog 1 Nov 2014 11:29:06 -0000 1.391
99 @@ -1,6 +1,28 @@
100 # ChangeLog for dev-db/postgresql
101 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
102 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.390 2014/10/26 02:22:46 patrick Exp $
103 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.391 2014/11/01 11:29:06 titanofold Exp $
104 +
105 +*postgresql-9.4_beta3-r1 (01 Nov 2014)
106 +*postgresql-9.3.5-r1 (01 Nov 2014)
107 +*postgresql-9.2.9-r1 (01 Nov 2014)
108 +*postgresql-9.1.14-r1 (01 Nov 2014)
109 +*postgresql-9.0.18-r1 (01 Nov 2014)
110 +
111 + 01 Nov 2014; Aaron W. Swenson <titanofold@g.o>
112 + -postgresql-9.0.18.ebuild, +postgresql-9.0.18-r1.ebuild,
113 + -postgresql-9.1.14.ebuild, +postgresql-9.1.14-r1.ebuild,
114 + -postgresql-9.2.9.ebuild, +postgresql-9.2.9-r1.ebuild,
115 + -postgresql-9.3.5.ebuild, +postgresql-9.3.5-r1.ebuild,
116 + -postgresql-9.4_beta2.ebuild, -postgresql-9.4_beta3.ebuild,
117 + +postgresql-9.4_beta3-r1.ebuild, postgresql-9999.ebuild,
118 + +files/postgresql-9.0-no-server.patch, +files/postgresql-9.1-no-server.patch,
119 + +files/postgresql-9.2-no-server.patch, +files/postgresql-9.3-no-server.patch,
120 + +files/postgresql-9.4-no-server.patch, +files/postgresql-9.5-no-server.patch,
121 + +files/pg_ctl-exit-status.patch:
122 + Removed source dependency on patch collection now that the majority only
123 + require their respective no-server.patch if the server isn't going to be
124 + built. Removed ebuilds with conditionals that always evaluate to false in
125 + src_test() and pkg_prerm().
126
127 *postgresql-9.4_beta3 (26 Oct 2014)
128
129
130
131
132 1.1 dev-db/postgresql/postgresql-9.2.9-r1.ebuild
133
134 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.2.9-r1.ebuild?rev=1.1&view=markup
135 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.2.9-r1.ebuild?rev=1.1&content-type=text/plain
136
137 Index: postgresql-9.2.9-r1.ebuild
138 ===================================================================
139 # Copyright 1999-2014 Gentoo Foundation
140 # Distributed under the terms of the GNU General Public License v2
141 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9.2.9-r1.ebuild,v 1.1 2014/11/01 11:29:06 titanofold Exp $
142
143 EAPI="5"
144
145 PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
146 WANT_AUTOMAKE="none"
147
148 inherit autotools eutils flag-o-matic multilib pam prefix python-single-r1 systemd user versionator
149
150 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~ppc-macos ~sparc-fbsd ~x86-fbsd ~x86-solaris"
151
152 SLOT="$(get_version_component_range 1-2)"
153
154 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
155
156 # Add initscript source.
157 SRC_URI+=" http://dev.gentoo.org/~floppym/dist/postgresql-initscript-2.7.tbz2"
158
159 LICENSE="POSTGRESQL GPL-2"
160 DESCRIPTION="PostgreSQL RDBMS"
161 HOMEPAGE="http://www.postgresql.org/"
162
163 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
164 IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python +readline selinux server ssl tcl threads uuid xml zlib"
165
166 for lingua in ${LINGUAS}; do
167 IUSE+=" linguas_${lingua}"
168 done
169
170 wanted_languages() {
171 local enable_langs
172
173 for lingua in ${LINGUAS} ; do
174 use linguas_${lingua} && enable_langs+="${lingua} "
175 done
176
177 echo -n ${enable_langs}
178 }
179
180 RDEPEND="
181 >=app-admin/eselect-postgresql-1.2.0
182 sys-apps/less
183 virtual/libintl
184 kerberos? ( virtual/krb5 )
185 ldap? ( net-nds/openldap )
186 pam? ( virtual/pam )
187 perl? ( >=dev-lang/perl-5.8 )
188 python? ( ${PYTHON_DEPS} )
189 readline? ( sys-libs/readline )
190 selinux? ( sec-policy/selinux-postgresql )
191 ssl? ( >=dev-libs/openssl-0.9.6-r1 )
192 tcl? ( >=dev-lang/tcl-8 )
193 uuid? ( dev-libs/ossp-uuid )
194 xml? ( dev-libs/libxml2 dev-libs/libxslt )
195 zlib? ( sys-libs/zlib )
196 "
197
198 DEPEND="${RDEPEND}
199 !!dev-db/postgresql-docs:${SLOT}
200 !!dev-db/postgresql-base:${SLOT}
201 !!dev-db/postgresql-server:${SLOT}
202 !!<sys-apps/sandbox-2.0
203 sys-devel/bison
204 sys-devel/flex
205 nls? ( sys-devel/gettext )
206 xml? ( virtual/pkgconfig )
207 "
208
209 pkg_setup() {
210 enewgroup postgres 70
211 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
212
213 use python && python-single-r1_pkg_setup
214 }
215
216 src_prepare() {
217 # Eliminate autotools version check
218 sed '/m4_PACKAGE_VERSION/,+3d' -i configure.in || die
219
220 # Work around PPC{,64} compilation bug where bool is already defined
221 sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
222
223 # Set proper run directory
224 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
225 -i src/include/pg_config_manual.h || die
226
227 sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
228 -i "${WORKDIR}"/postgresql{.{init,confd,service},-check-db-dir} || \
229 die "SLOT/LIBDIR sed failed"
230
231 use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
232
233 if use pam ; then
234 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
235 -i src/backend/libpq/auth.c || \
236 die 'PGSQL_PAM_SERVICE rename failed.'
237 fi
238
239 eautoconf
240 }
241
242 src_configure() {
243 case ${CHOST} in
244 *-darwin*|*-solaris*)
245 use nls && append-libs intl
246 ;;
247 esac
248
249 export LDFLAGS_SL="${LDFLAGS}"
250 export LDFLAGS_EX="${LDFLAGS}"
251
252 local PO="${EPREFIX%/}"
253
254 econf \
255 --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
256 --datadir="${PO}/usr/share/postgresql-${SLOT}" \
257 --docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \
258 --includedir="${PO}/usr/include/postgresql-${SLOT}" \
259 --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
260 --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
261 --with-system-tzdata="${PO}/usr/share/zoneinfo" \
262 $(use_enable !pg_legacytimestamp integer-datetimes) \
263 $(use_enable threads thread-safety) \
264 $(use_with kerberos gssapi) \
265 $(use_with kerberos krb5) \
266 $(use_with ldap) \
267 $(use_with pam) \
268 $(use_with perl) \
269 $(use_with python) \
270 $(use_with readline) \
271 $(use_with ssl openssl) \
272 $(use_with tcl) \
273 $(use_with uuid ossp-uuid) \
274 $(use_with xml libxml) \
275 $(use_with xml libxslt) \
276 $(use_with zlib) \
277 "$(use_enable nls nls "$(wanted_languages)")"
278 }
279
280 src_compile() {
281 emake
282 emake -C contrib
283 }
284
285 src_install() {
286 emake DESTDIR="${D}" install
287 emake DESTDIR="${D}" install -C contrib
288
289 dodoc README HISTORY doc/{TODO,bug.template}
290
291 # man pages are already built, but if we have the target make them,
292 # they'll be generated from source before being installed so we
293 # manually install man pages.
294 # We use ${SLOT} instead of doman for postgresql.eselect
295 insinto /usr/share/postgresql-${SLOT}/man/
296 doins -r doc/src/sgml/man{1,3,7}
297 if ! use server; then
298 # Remove man pages for non-existent binaries
299 for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
300 rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
301 done
302 fi
303 docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
304
305 insinto /etc/postgresql-${SLOT}
306 newins src/bin/psql/psqlrc.sample psqlrc
307
308 dodir /etc/eselect/postgresql/slots/${SLOT}
309 echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \
310 "${ED}/etc/eselect/postgresql/slots/${SLOT}/base"
311
312 if use doc ; then
313 docinto html
314 dodoc doc/src/sgml/html/*
315
316 docinto sgml
317 dodoc doc/src/sgml/*.{sgml,dsl}
318 fi
319
320 if use server; then
321 newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT}
322 newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT}
323
324 systemd_newunit "${WORKDIR}"/postgresql.service postgresql-${SLOT}.service
325 systemd_newtmpfilesd "${WORKDIR}"/postgresql.tmpfilesd postgresql-${SLOT}.conf
326 newbin "${WORKDIR}"/postgresql-check-db-dir postgresql-${SLOT}-check-db-dir
327
328 use pam && pamd_mimic system-auth postgresql-${SLOT} auth account session
329
330 if use prefix ; then
331 keepdir /run/postgresql
332 fperms 0775 /run/postgresql
333 fi
334 fi
335 }
336
337 pkg_postinst() {
338 postgresql-config update
339
340 elog "If you need a global psqlrc-file, you can place it in:"
341 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
342
343 if use server ; then
344 elog
345 elog "Gentoo specific documentation:"
346 elog "http://www.gentoo.org/doc/en/postgres-howto.xml"
347 elog
348 elog "Official documentation:"
349 elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
350 elog
351 elog "The default location of the Unix-domain socket is:"
352 elog " ${EROOT%/}/run/postgresql/"
353 elog
354 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
355 elog "so that it contains your preferred locale in:"
356 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
357 elog
358 elog "Then, execute the following command to setup the initial database"
359 elog "environment:"
360 elog " emerge --config =${CATEGORY}/${PF}"
361 fi
362 }
363
364 pkg_prerm() {
365 if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
366 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
367 ewarn "\thttp://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5"
368
369 ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
370 sleep 10
371 eend 0
372 fi
373 }
374
375 pkg_postrm() {
376 postgresql-config update
377 }
378
379 pkg_config() {
380 use server || die "USE flag 'server' not enabled. Nothing to configure."
381
382 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
383 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
384 [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
385
386 # environment.bz2 may not contain the same locale as the current system
387 # locale. Unset and source from the current system locale.
388 if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
389 unset LANG
390 unset LC_CTYPE
391 unset LC_NUMERIC
392 unset LC_TIME
393 unset LC_COLLATE
394 unset LC_MONETARY
395 unset LC_MESSAGES
396 unset LC_ALL
397 source "${EROOT%/}/etc/env.d/02locale"
398 [ -n "${LANG}" ] && export LANG
399 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
400 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
401 [ -n "${LC_TIME}" ] && export LC_TIME
402 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
403 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
404 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
405 [ -n "${LC_ALL}" ] && export LC_ALL
406 fi
407
408 einfo "You can modify the paths and options passed to initdb by editing:"
409 einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
410 einfo
411 einfo "Information on options that can be passed to initdb are found at:"
412 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
413 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
414 einfo
415 einfo "PG_INITDB_OPTS is currently set to:"
416 if [[ -z "${PG_INITDB_OPTS}" ]] ; then
417 einfo " (none)"
418 else
419 einfo " ${PG_INITDB_OPTS}"
420 fi
421 einfo
422 einfo "Configuration files will be installed to:"
423 einfo " ${PGDATA}"
424 einfo
425 einfo "The database cluster will be created in:"
426 einfo " ${DATA_DIR}"
427 einfo
428 while [ "$correct" != "true" ] ; do
429 einfo "Are you ready to continue? (y/n)"
430 read answer
431 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
432 correct="true"
433 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
434 die "Aborting initialization."
435 else
436 echo "Answer not recognized"
437 fi
438 done
439
440 if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
441 eerror "The given directory, '${DATA_DIR}', is not empty."
442 eerror "Modify DATA_DIR to point to an empty directory."
443 die "${DATA_DIR} is not empty."
444 fi
445
446 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
447 einfo "Checking system parameters..."
448
449 if ! use kernel_linux ; then
450 einfo "Skipped."
451 einfo " Tests not supported on this OS (yet)"
452 else
453 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
454 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
455
456 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
457 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
458 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
459 local SHMMAX=$(sysctl -n kernel.shmmax)
460
461 local SEMMSL_MIN=17
462 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
463 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
464 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
465
466 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
467 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
468 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
469 eerror "You have now several options:"
470 eerror " - Change the mentioned system parameter"
471 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
472 eerror " value lower than ${PG_MAX_CONNECTIONS}"
473 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
474 eerror "More information can be found here:"
475 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
476 die "System test failed."
477 fi
478 done
479 einfo "Passed."
480 else
481 ewarn "SKIP_SYSTEM_TESTS set, so skipping."
482 fi
483 fi
484
485 einfo "Creating the data directory ..."
486 if [[ ${EUID} == 0 ]] ; then
487 mkdir -p "${DATA_DIR}"
488 chown -Rf postgres:postgres "${DATA_DIR}"
489 chmod 0700 "${DATA_DIR}"
490 fi
491
492 einfo "Initializing the database ..."
493
494 if [[ ${EUID} == 0 ]] ; then
495 su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
496 else
497 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
498 fi
499
500 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
501
502 einfo "The autovacuum function, which was in contrib, has been moved to the main"
503 einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
504 einfo "by default. You can disable it in the cluster's:"
505 einfo " ${PGDATA%/}/postgresql.conf"
506 einfo
507 einfo "The PostgreSQL server, by default, will log events to:"
508 einfo " ${DATA_DIR%/}/postmaster.log"
509 einfo
510 if use prefix ; then
511 einfo "The location of the configuration files have moved to:"
512 einfo " ${PGDATA}"
513 einfo "To start the server:"
514 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
515 einfo "To stop:"
516 einfo " pg_ctl stop -D ${DATA_DIR}"
517 einfo
518 einfo "Or move the configuration files back:"
519 einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
520 else
521 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
522 einfo "instead of 'pg_ctl'."
523 fi
524 }
525
526 src_test() {
527 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
528
529 if use server && [[ ${UID} -ne 0 ]] ; then
530 emake check
531
532 einfo "If you think other tests besides the regression tests are necessary, please"
533 einfo "submit a bug including a patch for this ebuild to enable them."
534 else
535 use server || \
536 ewarn 'Tests cannot be run without the "server" use flag enabled.'
537 [[ ${UID} -eq 0 ]] || \
538 ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
539
540 ewarn 'Skipping.'
541 fi
542 }
543
544
545
546 1.1 dev-db/postgresql/postgresql-9.0.18-r1.ebuild
547
548 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.0.18-r1.ebuild?rev=1.1&view=markup
549 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.0.18-r1.ebuild?rev=1.1&content-type=text/plain
550
551 Index: postgresql-9.0.18-r1.ebuild
552 ===================================================================
553 # Copyright 1999-2014 Gentoo Foundation
554 # Distributed under the terms of the GNU General Public License v2
555 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9.0.18-r1.ebuild,v 1.1 2014/11/01 11:29:06 titanofold Exp $
556
557 EAPI="5"
558
559 # Testing within Portage's environment is broken, and the patch no
560 # longer applies cleanly.
561 RESTRICT="test"
562
563 PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
564 WANT_AUTOMAKE="none"
565
566 inherit autotools eutils flag-o-matic multilib pam prefix python-single-r1 systemd user versionator
567
568 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~ppc-macos ~sparc-fbsd ~x86-fbsd ~x86-solaris"
569
570 SLOT="$(get_version_component_range 1-2)"
571
572 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
573
574 # Add initscript source.
575 SRC_URI+=" http://dev.gentoo.org/~titanofold/postgresql-initscript-pre92-2.6.tbz2"
576
577 LICENSE="POSTGRESQL GPL-2"
578 DESCRIPTION="PostgreSQL RDBMS"
579 HOMEPAGE="http://www.postgresql.org/"
580
581 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
582 IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python +readline selinux server ssl tcl threads uuid xml zlib"
583
584 for lingua in ${LINGUAS}; do
585 IUSE+=" linguas_${lingua}"
586 done
587
588 wanted_languages() {
589 local enable_langs
590
591 for lingua in ${LINGUAS} ; do
592 use linguas_${lingua} && enable_langs+="${lingua} "
593 done
594
595 echo -n ${enable_langs}
596 }
597
598 RDEPEND="
599 >=app-admin/eselect-postgresql-1.2.0
600 sys-apps/less
601 virtual/libintl
602 kerberos? ( virtual/krb5 )
603 ldap? ( net-nds/openldap )
604 pam? ( virtual/pam )
605 perl? ( >=dev-lang/perl-5.8 )
606 python? ( ${PYTHON_DEPS} )
607 readline? ( sys-libs/readline )
608 selinux? ( sec-policy/selinux-postgresql )
609 ssl? ( >=dev-libs/openssl-0.9.6-r1 )
610 tcl? ( >=dev-lang/tcl-8 )
611 uuid? ( dev-libs/ossp-uuid )
612 xml? ( dev-libs/libxml2 dev-libs/libxslt )
613 zlib? ( sys-libs/zlib )
614 "
615
616 DEPEND="${RDEPEND}
617 !!dev-db/postgresql-docs:${SLOT}
618 !!dev-db/postgresql-base:${SLOT}
619 !!dev-db/postgresql-server:${SLOT}
620 !!<sys-apps/sandbox-2.0
621 sys-devel/bison
622 sys-devel/flex
623 nls? ( sys-devel/gettext )
624 xml? ( virtual/pkgconfig )
625 "
626
627 pkg_setup() {
628 enewgroup postgres 70
629 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
630
631 use python && python-single-r1_pkg_setup
632 }
633
634 src_prepare() {
635 # Eliminate autotools version check
636 sed '/m4_PACKAGE_VERSION/,+3d' -i configure.in || die
637
638 # Work around PPC{,64} compilation bug where bool is already defined
639 sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
640
641 # Set proper run directory
642 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
643 -i src/include/pg_config_manual.h || die
644
645 sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
646 -i "${WORKDIR}"/postgresql{.{init,confd,service},-check-db-dir} || \
647 die "SLOT/LIBDIR sed failed"
648
649 epatch "${FILESDIR}/pg_ctl-exit-status.patch"
650
651 use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
652
653 if use pam ; then
654 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
655 -i src/backend/libpq/auth.c || \
656 die 'PGSQL_PAM_SERVICE rename failed.'
657 fi
658
659 eautoconf
660 }
661
662 src_configure() {
663 case ${CHOST} in
664 *-darwin*|*-solaris*)
665 use nls && append-libs intl
666 ;;
667 esac
668
669 export LDFLAGS_SL="${LDFLAGS}"
670 export LDFLAGS_EX="${LDFLAGS}"
671
672 local PO="${EPREFIX%/}"
673
674 econf \
675 --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
676 --datadir="${PO}/usr/share/postgresql-${SLOT}" \
677 --docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \
678 --includedir="${PO}/usr/include/postgresql-${SLOT}" \
679 --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
680 --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
681 --with-system-tzdata="${PO}/usr/share/zoneinfo" \
682 $(use_enable !pg_legacytimestamp integer-datetimes) \
683 $(use_enable threads thread-safety) \
684 $(use_with kerberos gssapi) \
685 $(use_with kerberos krb5) \
686 $(use_with ldap) \
687 $(use_with pam) \
688 $(use_with perl) \
689 $(use_with python) \
690 $(use_with readline) \
691 $(use_with ssl openssl) \
692 $(use_with tcl) \
693 $(use_with uuid ossp-uuid) \
694 $(use_with xml libxml) \
695 $(use_with xml libxslt) \
696 $(use_with zlib) \
697 "$(use_enable nls nls "$(wanted_languages)")"
698 }
699
700 src_compile() {
701 emake
702 emake -C contrib
703 }
704
705 src_install() {
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 dodir /etc/eselect/postgresql/slots/${SLOT}
729 echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \
730 "${ED}/etc/eselect/postgresql/slots/${SLOT}/base"
731
732 if use doc ; then
733 docinto html
734 dodoc doc/src/sgml/html/*
735
736 docinto sgml
737 dodoc doc/src/sgml/*.{sgml,dsl}
738 fi
739
740 if use server; then
741 newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT}
742 newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT}
743
744 systemd_newunit "${WORKDIR}"/postgresql.service postgresql-${SLOT}.service
745 systemd_newtmpfilesd "${WORKDIR}"/postgresql.tmpfilesd postgresql-${SLOT}.conf
746 newbin "${WORKDIR}"/postgresql-check-db-dir postgresql-${SLOT}-check-db-dir
747
748 use pam && pamd_mimic system-auth postgresql-${SLOT} auth account session
749
750 if use prefix ; then
751 keepdir /run/postgresql
752 fperms 0775 /run/postgresql
753 fi
754 fi
755 }
756
757 pkg_postinst() {
758 postgresql-config update
759
760 elog "If you need a global psqlrc-file, you can place it in:"
761 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
762
763 if use server ; then
764 elog
765 elog "Gentoo specific documentation:"
766 elog "http://www.gentoo.org/doc/en/postgres-howto.xml"
767 elog
768 elog "Official documentation:"
769 elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
770 elog
771 elog "The default location of the Unix-domain socket is:"
772 elog " ${EROOT%/}/run/postgresql/"
773 elog
774 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
775 elog "so that it contains your preferred locale in:"
776 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
777 elog
778 elog "Then, execute the following command to setup the initial database"
779 elog "environment:"
780 elog " emerge --config =${CATEGORY}/${PF}"
781 fi
782 }
783
784 pkg_prerm() {
785 if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
786 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
787 ewarn "\thttp://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5"
788
789 ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
790 sleep 10
791 eend 0
792 fi
793 }
794
795 pkg_postrm() {
796 postgresql-config update
797 }
798
799 pkg_config() {
800 use server || die "USE flag 'server' not enabled. Nothing to configure."
801
802 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
803 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
804 [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
805
806 # environment.bz2 may not contain the same locale as the current system
807 # locale. Unset and source from the current system locale.
808 if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
809 unset LANG
810 unset LC_CTYPE
811 unset LC_NUMERIC
812 unset LC_TIME
813 unset LC_COLLATE
814 unset LC_MONETARY
815 unset LC_MESSAGES
816 unset LC_ALL
817 source "${EROOT%/}/etc/env.d/02locale"
818 [ -n "${LANG}" ] && export LANG
819 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
820 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
821 [ -n "${LC_TIME}" ] && export LC_TIME
822 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
823 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
824 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
825 [ -n "${LC_ALL}" ] && export LC_ALL
826 fi
827
828 einfo "You can modify the paths and options passed to initdb by editing:"
829 einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
830 einfo
831 einfo "Information on options that can be passed to initdb are found at:"
832 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
833 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
834 einfo
835 einfo "PG_INITDB_OPTS is currently set to:"
836 if [[ -z "${PG_INITDB_OPTS}" ]] ; then
837 einfo " (none)"
838 else
839 einfo " ${PG_INITDB_OPTS}"
840 fi
841 einfo
842 einfo "Configuration files will be installed to:"
843 einfo " ${PGDATA}"
844 einfo
845 einfo "The database cluster will be created in:"
846 einfo " ${DATA_DIR}"
847 einfo
848 while [ "$correct" != "true" ] ; do
849 einfo "Are you ready to continue? (y/n)"
850 read answer
851 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
852 correct="true"
853 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
854 die "Aborting initialization."
855 else
856 echo "Answer not recognized"
857 fi
858 done
859
860 if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
861 eerror "The given directory, '${DATA_DIR}', is not empty."
862 eerror "Modify DATA_DIR to point to an empty directory."
863 die "${DATA_DIR} is not empty."
864 fi
865
866 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
867 einfo "Checking system parameters..."
868
869 if ! use kernel_linux ; then
870 einfo "Skipped."
871 einfo " Tests not supported on this OS (yet)"
872 else
873 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
874 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
875
876 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
877 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
878 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
879 local SHMMAX=$(sysctl -n kernel.shmmax)
880
881 local SEMMSL_MIN=17
882 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
883 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
884 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
885
886 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
887 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
888 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
889 eerror "You have now several options:"
890 eerror " - Change the mentioned system parameter"
891 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
892 eerror " value lower than ${PG_MAX_CONNECTIONS}"
893 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
894 eerror "More information can be found here:"
895 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
896 die "System test failed."
897 fi
898 done
899 einfo "Passed."
900 else
901 ewarn "SKIP_SYSTEM_TESTS set, so skipping."
902 fi
903 fi
904
905 einfo "Creating the data directory ..."
906 if [[ ${EUID} == 0 ]] ; then
907 mkdir -p "${DATA_DIR}"
908 chown -Rf postgres:postgres "${DATA_DIR}"
909 chmod 0700 "${DATA_DIR}"
910 fi
911
912 einfo "Initializing the database ..."
913
914 if [[ ${EUID} == 0 ]] ; then
915 su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
916 else
917 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
918 fi
919
920 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
921
922 einfo "The autovacuum function, which was in contrib, has been moved to the main"
923 einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
924 einfo "by default. You can disable it in the cluster's:"
925 einfo " ${PGDATA%/}/postgresql.conf"
926 einfo
927 einfo "The PostgreSQL server, by default, will log events to:"
928 einfo " ${DATA_DIR%/}/postmaster.log"
929 einfo
930 if use prefix ; then
931 einfo "The location of the configuration files have moved to:"
932 einfo " ${PGDATA}"
933 einfo "To start the server:"
934 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
935 einfo "To stop:"
936 einfo " pg_ctl stop -D ${DATA_DIR}"
937 einfo
938 einfo "Or move the configuration files back:"
939 einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
940 else
941 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
942 einfo "instead of 'pg_ctl'."
943 fi
944 }
945
946
947
948 1.1 dev-db/postgresql/postgresql-9.4_beta3-r1.ebuild
949
950 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.4_beta3-r1.ebuild?rev=1.1&view=markup
951 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.4_beta3-r1.ebuild?rev=1.1&content-type=text/plain
952
953 Index: postgresql-9.4_beta3-r1.ebuild
954 ===================================================================
955 # Copyright 1999-2014 Gentoo Foundation
956 # Distributed under the terms of the GNU General Public License v2
957 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9.4_beta3-r1.ebuild,v 1.1 2014/11/01 11:29:06 titanofold Exp $
958
959 EAPI="5"
960
961 PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
962 WANT_AUTOMAKE="none"
963
964 inherit autotools eutils flag-o-matic multilib pam prefix python-single-r1 systemd user versionator
965
966 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~ppc-macos ~sparc-fbsd ~x86-fbsd ~x86-solaris"
967
968 MY_PV=${PV/_/}
969 SLOT="$(get_version_component_range 1-2)"
970 S="${WORKDIR}/postgresql-${MY_PV}"
971 SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
972
973 # Add patch and initscript source.
974 SRC_URI+=" http://dev.gentoo.org/~floppym/dist/postgresql-initscript-2.7.tbz2"
975
976 LICENSE="POSTGRESQL GPL-2"
977 DESCRIPTION="PostgreSQL RDBMS"
978 HOMEPAGE="http://www.postgresql.org/"
979
980 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
981 IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python +readline selinux server ssl tcl threads uuid xml zlib"
982
983 for lingua in ${LINGUAS}; do
984 IUSE+=" linguas_${lingua}"
985 done
986
987 wanted_languages() {
988 local enable_langs
989
990 for lingua in ${LINGUAS} ; do
991 use linguas_${lingua} && enable_langs+="${lingua} "
992 done
993
994 echo -n ${enable_langs}
995 }
996
997 RDEPEND="
998 >=app-admin/eselect-postgresql-1.2.0
999 sys-apps/less
1000 virtual/libintl
1001 kerberos? ( virtual/krb5 )
1002 ldap? ( net-nds/openldap )
1003 pam? ( virtual/pam )
1004 perl? ( >=dev-lang/perl-5.8 )
1005 python? ( ${PYTHON_DEPS} )
1006 readline? ( sys-libs/readline )
1007 selinux? ( sec-policy/selinux-postgresql )
1008 ssl? ( >=dev-libs/openssl-0.9.6-r1 )
1009 tcl? ( >=dev-lang/tcl-8 )
1010 uuid? ( dev-libs/ossp-uuid )
1011 xml? ( dev-libs/libxml2 dev-libs/libxslt )
1012 zlib? ( sys-libs/zlib )
1013 "
1014
1015 DEPEND="${RDEPEND}
1016 !!dev-db/postgresql-docs:${SLOT}
1017 !!dev-db/postgresql-base:${SLOT}
1018 !!dev-db/postgresql-server:${SLOT}
1019 !!<sys-apps/sandbox-2.0
1020 sys-devel/bison
1021 sys-devel/flex
1022 nls? ( sys-devel/gettext )
1023 xml? ( virtual/pkgconfig )
1024 "
1025
1026 pkg_setup() {
1027 enewgroup postgres 70
1028 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
1029
1030 use python && python-single-r1_pkg_setup
1031 }
1032
1033 src_prepare() {
1034 # Eliminate autotools version check
1035 sed '/m4_PACKAGE_VERSION/,+3d' -i configure.in || die
1036
1037 # Work around PPC{,64} compilation bug where bool is already defined
1038 sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
1039
1040 # Set proper run directory
1041 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1042 -i src/include/pg_config_manual.h || die
1043
1044 sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1045 -i "${WORKDIR}"/postgresql{.{init,confd,service},-check-db-dir} || \
1046 die "SLOT/LIBDIR sed failed"
1047
1048 use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
1049
1050 if use pam ; then
1051 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
1052 -i src/backend/libpq/auth.c || \
1053 die 'PGSQL_PAM_SERVICE rename failed.'
1054 fi
1055
1056 eautoconf
1057 }
1058
1059 src_configure() {
1060 case ${CHOST} in
1061 *-darwin*|*-solaris*)
1062 use nls && append-libs intl
1063 ;;
1064 esac
1065
1066 export LDFLAGS_SL="${LDFLAGS}"
1067 export LDFLAGS_EX="${LDFLAGS}"
1068
1069 local PO="${EPREFIX%/}"
1070
1071 econf \
1072 --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
1073 --datadir="${PO}/usr/share/postgresql-${SLOT}" \
1074 --docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \
1075 --includedir="${PO}/usr/include/postgresql-${SLOT}" \
1076 --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
1077 --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
1078 --with-system-tzdata="${PO}/usr/share/zoneinfo" \
1079 $(use_enable !pg_legacytimestamp integer-datetimes) \
1080 $(use_enable threads thread-safety) \
1081 $(use_with kerberos gssapi) \
1082 $(use_with ldap) \
1083 $(use_with pam) \
1084 $(use_with perl) \
1085 $(use_with python) \
1086 $(use_with readline) \
1087 $(use_with ssl openssl) \
1088 $(use_with tcl) \
1089 $(use_with uuid ossp-uuid) \
1090 $(use_with xml libxml) \
1091 $(use_with xml libxslt) \
1092 $(use_with zlib) \
1093 "$(use_enable nls nls "$(wanted_languages)")"
1094 }
1095
1096 src_compile() {
1097 emake
1098 emake -C contrib
1099 }
1100
1101 src_install() {
1102 emake DESTDIR="${D}" install
1103 emake DESTDIR="${D}" install -C contrib
1104
1105 dodoc README HISTORY doc/{TODO,bug.template}
1106
1107 # man pages are already built, but if we have the target make them,
1108 # they'll be generated from source before being installed so we
1109 # manually install man pages.
1110 # We use ${SLOT} instead of doman for postgresql.eselect
1111 insinto /usr/share/postgresql-${SLOT}/man/
1112 doins -r doc/src/sgml/man{1,3,7}
1113 if ! use server; then
1114 # Remove man pages for non-existent binaries
1115 for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
1116 rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
1117 done
1118 fi
1119 docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1120
1121 insinto /etc/postgresql-${SLOT}
1122 newins src/bin/psql/psqlrc.sample psqlrc
1123
1124 dodir /etc/eselect/postgresql/slots/${SLOT}
1125 echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \
1126 "${ED}/etc/eselect/postgresql/slots/${SLOT}/base"
1127
1128 if use doc ; then
1129 docinto html
1130 dodoc doc/src/sgml/html/*
1131
1132 docinto sgml
1133 dodoc doc/src/sgml/*.{sgml,dsl}
1134 fi
1135
1136 if use server; then
1137 newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT}
1138 newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT}
1139
1140 systemd_newunit "${WORKDIR}"/postgresql.service postgresql-${SLOT}.service
1141 systemd_newtmpfilesd "${WORKDIR}"/postgresql.tmpfilesd postgresql-${SLOT}.conf
1142 newbin "${WORKDIR}"/postgresql-check-db-dir postgresql-${SLOT}-check-db-dir
1143
1144 use pam && pamd_mimic system-auth postgresql-${SLOT} auth account session
1145
1146 if use prefix ; then
1147 keepdir /run/postgresql
1148 fperms 0775 /run/postgresql
1149 fi
1150 fi
1151 }
1152
1153 pkg_postinst() {
1154 postgresql-config update
1155
1156 elog "If you need a global psqlrc-file, you can place it in:"
1157 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1158
1159 if use server ; then
1160 elog
1161 elog "Gentoo specific documentation:"
1162 elog "http://www.gentoo.org/doc/en/postgres-howto.xml"
1163 elog
1164 elog "Official documentation:"
1165 elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
1166 elog
1167 elog "The default location of the Unix-domain socket is:"
1168 elog " ${EROOT%/}/run/postgresql/"
1169 elog
1170 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1171 elog "so that it contains your preferred locale in:"
1172 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1173 elog
1174 elog "Then, execute the following command to setup the initial database"
1175 elog "environment:"
1176 elog " emerge --config =${CATEGORY}/${PF}"
1177 fi
1178 }
1179
1180 pkg_prerm() {
1181 if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1182 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1183 ewarn "\thttp://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5"
1184
1185 ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
1186 sleep 10
1187 eend 0
1188 fi
1189 }
1190
1191 pkg_postrm() {
1192 postgresql-config update
1193 }
1194
1195 pkg_config() {
1196 use server || die "USE flag 'server' not enabled. Nothing to configure."
1197
1198 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1199 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1200 [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
1201
1202 # environment.bz2 may not contain the same locale as the current system
1203 # locale. Unset and source from the current system locale.
1204 if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
1205 unset LANG
1206 unset LC_CTYPE
1207 unset LC_NUMERIC
1208 unset LC_TIME
1209 unset LC_COLLATE
1210 unset LC_MONETARY
1211 unset LC_MESSAGES
1212 unset LC_ALL
1213 source "${EROOT%/}/etc/env.d/02locale"
1214 [ -n "${LANG}" ] && export LANG
1215 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1216 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1217 [ -n "${LC_TIME}" ] && export LC_TIME
1218 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1219 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1220 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1221 [ -n "${LC_ALL}" ] && export LC_ALL
1222 fi
1223
1224 einfo "You can modify the paths and options passed to initdb by editing:"
1225 einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1226 einfo
1227 einfo "Information on options that can be passed to initdb are found at:"
1228 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1229 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1230 einfo
1231 einfo "PG_INITDB_OPTS is currently set to:"
1232 if [[ -z "${PG_INITDB_OPTS}" ]] ; then
1233 einfo " (none)"
1234 else
1235 einfo " ${PG_INITDB_OPTS}"
1236 fi
1237 einfo
1238 einfo "Configuration files will be installed to:"
1239 einfo " ${PGDATA}"
1240 einfo
1241 einfo "The database cluster will be created in:"
1242 einfo " ${DATA_DIR}"
1243 einfo
1244 while [ "$correct" != "true" ] ; do
1245 einfo "Are you ready to continue? (y/n)"
1246 read answer
1247 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
1248 correct="true"
1249 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
1250 die "Aborting initialization."
1251 else
1252 echo "Answer not recognized"
1253 fi
1254 done
1255
1256 if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
1257 eerror "The given directory, '${DATA_DIR}', is not empty."
1258 eerror "Modify DATA_DIR to point to an empty directory."
1259 die "${DATA_DIR} is not empty."
1260 fi
1261
1262 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
1263 einfo "Checking system parameters..."
1264
1265 if ! use kernel_linux ; then
1266 einfo "Skipped."
1267 einfo " Tests not supported on this OS (yet)"
1268 else
1269 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
1270 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
1271
1272 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
1273 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
1274 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
1275 local SHMMAX=$(sysctl -n kernel.shmmax)
1276
1277 local SEMMSL_MIN=17
1278 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
1279 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
1280 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
1281
1282 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
1283 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
1284 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
1285 eerror "You have now several options:"
1286 eerror " - Change the mentioned system parameter"
1287 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
1288 eerror " value lower than ${PG_MAX_CONNECTIONS}"
1289 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
1290 eerror "More information can be found here:"
1291 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
1292 die "System test failed."
1293 fi
1294 done
1295 einfo "Passed."
1296 else
1297 ewarn "SKIP_SYSTEM_TESTS set, so skipping."
1298 fi
1299 fi
1300
1301 einfo "Creating the data directory ..."
1302 if [[ ${EUID} == 0 ]] ; then
1303 mkdir -p "${DATA_DIR}"
1304 chown -Rf postgres:postgres "${DATA_DIR}"
1305 chmod 0700 "${DATA_DIR}"
1306 fi
1307
1308 einfo "Initializing the database ..."
1309
1310 if [[ ${EUID} == 0 ]] ; then
1311 su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
1312 else
1313 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
1314 fi
1315
1316 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
1317
1318 einfo "The autovacuum function, which was in contrib, has been moved to the main"
1319 einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
1320 einfo "by default. You can disable it in the cluster's:"
1321 einfo " ${PGDATA%/}/postgresql.conf"
1322 einfo
1323 einfo "The PostgreSQL server, by default, will log events to:"
1324 einfo " ${DATA_DIR%/}/postmaster.log"
1325 einfo
1326 if use prefix ; then
1327 einfo "The location of the configuration files have moved to:"
1328 einfo " ${PGDATA}"
1329 einfo "To start the server:"
1330 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
1331 einfo "To stop:"
1332 einfo " pg_ctl stop -D ${DATA_DIR}"
1333 einfo
1334 einfo "Or move the configuration files back:"
1335 einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
1336 else
1337 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1338 einfo "instead of 'pg_ctl'."
1339 fi
1340 }
1341
1342 src_test() {
1343 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1344
1345 if use server && [[ ${UID} -ne 0 ]] ; then
1346 emake check
1347
1348 einfo "If you think other tests besides the regression tests are necessary, please"
1349 einfo "submit a bug including a patch for this ebuild to enable them."
1350 else
1351 use server || \
1352 ewarn 'Tests cannot be run without the "server" use flag enabled.'
1353 [[ ${UID} -eq 0 ]] || \
1354 ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
1355
1356 ewarn 'Skipping.'
1357 fi
1358 }
1359
1360
1361
1362 1.1 dev-db/postgresql/postgresql-9.1.14-r1.ebuild
1363
1364 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.1.14-r1.ebuild?rev=1.1&view=markup
1365 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.1.14-r1.ebuild?rev=1.1&content-type=text/plain
1366
1367 Index: postgresql-9.1.14-r1.ebuild
1368 ===================================================================
1369 # Copyright 1999-2014 Gentoo Foundation
1370 # Distributed under the terms of the GNU General Public License v2
1371 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9.1.14-r1.ebuild,v 1.1 2014/11/01 11:29:06 titanofold Exp $
1372
1373 EAPI="5"
1374
1375 # Testing within Portage's environment is broken, and the patch no
1376 # longer applies cleanly.
1377 RESTRICT="test"
1378
1379 PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
1380 WANT_AUTOMAKE="none"
1381
1382 inherit autotools eutils flag-o-matic multilib pam prefix python-single-r1 systemd user versionator
1383
1384 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~ppc-macos ~sparc-fbsd ~x86-fbsd ~x86-solaris"
1385
1386 SLOT="$(get_version_component_range 1-2)"
1387
1388 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
1389
1390 # Add initscript source.
1391 SRC_URI+=" http://dev.gentoo.org/~titanofold/postgresql-initscript-pre92-2.6.tbz2"
1392
1393 LICENSE="POSTGRESQL GPL-2"
1394 DESCRIPTION="PostgreSQL RDBMS"
1395 HOMEPAGE="http://www.postgresql.org/"
1396
1397 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
1398 IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python +readline selinux server ssl tcl threads uuid xml zlib"
1399
1400 for lingua in ${LINGUAS}; do
1401 IUSE+=" linguas_${lingua}"
1402 done
1403
1404 wanted_languages() {
1405 local enable_langs
1406
1407 for lingua in ${LINGUAS} ; do
1408 use linguas_${lingua} && enable_langs+="${lingua} "
1409 done
1410
1411 echo -n ${enable_langs}
1412 }
1413
1414 RDEPEND="
1415 >=app-admin/eselect-postgresql-1.2.0
1416 sys-apps/less
1417 virtual/libintl
1418 kerberos? ( virtual/krb5 )
1419 ldap? ( net-nds/openldap )
1420 pam? ( virtual/pam )
1421 perl? ( >=dev-lang/perl-5.8 )
1422 python? ( ${PYTHON_DEPS} )
1423 readline? ( sys-libs/readline )
1424 selinux? ( sec-policy/selinux-postgresql )
1425 ssl? ( >=dev-libs/openssl-0.9.6-r1 )
1426 tcl? ( >=dev-lang/tcl-8 )
1427 uuid? ( dev-libs/ossp-uuid )
1428 xml? ( dev-libs/libxml2 dev-libs/libxslt )
1429 zlib? ( sys-libs/zlib )
1430 "
1431
1432 DEPEND="${RDEPEND}
1433 !!dev-db/postgresql-docs:${SLOT}
1434 !!dev-db/postgresql-base:${SLOT}
1435 !!dev-db/postgresql-server:${SLOT}
1436 !!<sys-apps/sandbox-2.0
1437 sys-devel/bison
1438 sys-devel/flex
1439 nls? ( sys-devel/gettext )
1440 xml? ( virtual/pkgconfig )
1441 "
1442
1443 pkg_setup() {
1444 enewgroup postgres 70
1445 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
1446
1447 use python && python-single-r1_pkg_setup
1448 }
1449
1450 src_prepare() {
1451 # Eliminate autotools version check
1452 sed '/m4_PACKAGE_VERSION/,+3d' -i configure.in || die
1453
1454 # Work around PPC{,64} compilation bug where bool is already defined
1455 sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
1456
1457 # Set proper run directory
1458 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1459 -i src/include/pg_config_manual.h || die
1460
1461 sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1462 -i "${WORKDIR}"/postgresql{.{init,confd,service},-check-db-dir} || \
1463 die "SLOT/LIBDIR sed failed"
1464
1465 epatch "${FILESDIR}/pg_ctl-exit-status.patch"
1466
1467 use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
1468
1469 if use pam ; then
1470 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
1471 -i src/backend/libpq/auth.c || \
1472 die 'PGSQL_PAM_SERVICE rename failed.'
1473 fi
1474
1475 eautoconf
1476 }
1477
1478 src_configure() {
1479 case ${CHOST} in
1480 *-darwin*|*-solaris*)
1481 use nls && append-libs intl
1482 ;;
1483 esac
1484
1485 export LDFLAGS_SL="${LDFLAGS}"
1486 export LDFLAGS_EX="${LDFLAGS}"
1487
1488 local PO="${EPREFIX%/}"
1489
1490 econf \
1491 --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
1492 --datadir="${PO}/usr/share/postgresql-${SLOT}" \
1493 --docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \
1494 --includedir="${PO}/usr/include/postgresql-${SLOT}" \
1495 --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
1496 --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
1497 --with-system-tzdata="${PO}/usr/share/zoneinfo" \
1498 $(use_enable !pg_legacytimestamp integer-datetimes) \
1499 $(use_enable threads thread-safety) \
1500 $(use_with kerberos gssapi) \
1501 $(use_with kerberos krb5) \
1502 $(use_with ldap) \
1503 $(use_with pam) \
1504 $(use_with perl) \
1505 $(use_with python) \
1506 $(use_with readline) \
1507 $(use_with ssl openssl) \
1508 $(use_with tcl) \
1509 $(use_with uuid ossp-uuid) \
1510 $(use_with xml libxml) \
1511 $(use_with xml libxslt) \
1512 $(use_with zlib) \
1513 "$(use_enable nls nls "$(wanted_languages)")"
1514 }
1515
1516 src_compile() {
1517 emake
1518 emake -C contrib
1519 }
1520
1521 src_install() {
1522 emake DESTDIR="${D}" install
1523 emake DESTDIR="${D}" install -C contrib
1524
1525 dodoc README HISTORY doc/{TODO,bug.template}
1526
1527 # man pages are already built, but if we have the target make them,
1528 # they'll be generated from source before being installed so we
1529 # manually install man pages.
1530 # We use ${SLOT} instead of doman for postgresql.eselect
1531 insinto /usr/share/postgresql-${SLOT}/man/
1532 doins -r doc/src/sgml/man{1,3,7}
1533 if ! use server; then
1534 # Remove man pages for non-existent binaries
1535 for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
1536 rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
1537 done
1538 fi
1539 docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1540
1541 insinto /etc/postgresql-${SLOT}
1542 newins src/bin/psql/psqlrc.sample psqlrc
1543
1544 dodir /etc/eselect/postgresql/slots/${SLOT}
1545 echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \
1546 "${ED}/etc/eselect/postgresql/slots/${SLOT}/base"
1547
1548 if use doc ; then
1549 docinto html
1550 dodoc doc/src/sgml/html/*
1551
1552 docinto sgml
1553 dodoc doc/src/sgml/*.{sgml,dsl}
1554 fi
1555
1556 if use server; then
1557 newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT}
1558 newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT}
1559
1560 systemd_newunit "${WORKDIR}"/postgresql.service postgresql-${SLOT}.service
1561 systemd_newtmpfilesd "${WORKDIR}"/postgresql.tmpfilesd postgresql-${SLOT}.conf
1562 newbin "${WORKDIR}"/postgresql-check-db-dir postgresql-${SLOT}-check-db-dir
1563
1564 use pam && pamd_mimic system-auth postgresql-${SLOT} auth account session
1565
1566 if use prefix ; then
1567 keepdir /run/postgresql
1568 fperms 0775 /run/postgresql
1569 fi
1570 fi
1571 }
1572
1573 pkg_postinst() {
1574 postgresql-config update
1575
1576 elog "If you need a global psqlrc-file, you can place it in:"
1577 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1578
1579 if use server ; then
1580 elog
1581 elog "Gentoo specific documentation:"
1582 elog "http://www.gentoo.org/doc/en/postgres-howto.xml"
1583 elog
1584 elog "Official documentation:"
1585 elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
1586 elog
1587 elog "The default location of the Unix-domain socket is:"
1588 elog " ${EROOT%/}/run/postgresql/"
1589 elog
1590 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1591 elog "so that it contains your preferred locale in:"
1592 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1593 elog
1594 elog "Then, execute the following command to setup the initial database"
1595 elog "environment:"
1596 elog " emerge --config =${CATEGORY}/${PF}"
1597 fi
1598 }
1599
1600 pkg_prerm() {
1601 if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1602 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1603 ewarn "\thttp://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5"
1604
1605 ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
1606 sleep 10
1607 eend 0
1608 fi
1609 }
1610
1611 pkg_postrm() {
1612 postgresql-config update
1613 }
1614
1615 pkg_config() {
1616 use server || die "USE flag 'server' not enabled. Nothing to configure."
1617
1618 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1619 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1620 [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
1621
1622 # environment.bz2 may not contain the same locale as the current system
1623 # locale. Unset and source from the current system locale.
1624 if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
1625 unset LANG
1626 unset LC_CTYPE
1627 unset LC_NUMERIC
1628 unset LC_TIME
1629 unset LC_COLLATE
1630 unset LC_MONETARY
1631 unset LC_MESSAGES
1632 unset LC_ALL
1633 source "${EROOT%/}/etc/env.d/02locale"
1634 [ -n "${LANG}" ] && export LANG
1635 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1636 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1637 [ -n "${LC_TIME}" ] && export LC_TIME
1638 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1639 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1640 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1641 [ -n "${LC_ALL}" ] && export LC_ALL
1642 fi
1643
1644 einfo "You can modify the paths and options passed to initdb by editing:"
1645 einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1646 einfo
1647 einfo "Information on options that can be passed to initdb are found at:"
1648 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1649 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1650 einfo
1651 einfo "PG_INITDB_OPTS is currently set to:"
1652 if [[ -z "${PG_INITDB_OPTS}" ]] ; then
1653 einfo " (none)"
1654 else
1655 einfo " ${PG_INITDB_OPTS}"
1656 fi
1657 einfo
1658 einfo "Configuration files will be installed to:"
1659 einfo " ${PGDATA}"
1660 einfo
1661 einfo "The database cluster will be created in:"
1662 einfo " ${DATA_DIR}"
1663 einfo
1664 while [ "$correct" != "true" ] ; do
1665 einfo "Are you ready to continue? (y/n)"
1666 read answer
1667 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
1668 correct="true"
1669 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
1670 die "Aborting initialization."
1671 else
1672 echo "Answer not recognized"
1673 fi
1674 done
1675
1676 if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
1677 eerror "The given directory, '${DATA_DIR}', is not empty."
1678 eerror "Modify DATA_DIR to point to an empty directory."
1679 die "${DATA_DIR} is not empty."
1680 fi
1681
1682 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
1683 einfo "Checking system parameters..."
1684
1685 if ! use kernel_linux ; then
1686 einfo "Skipped."
1687 einfo " Tests not supported on this OS (yet)"
1688 else
1689 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
1690 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
1691
1692 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
1693 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
1694 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
1695 local SHMMAX=$(sysctl -n kernel.shmmax)
1696
1697 local SEMMSL_MIN=17
1698 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
1699 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
1700 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
1701
1702 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
1703 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
1704 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
1705 eerror "You have now several options:"
1706 eerror " - Change the mentioned system parameter"
1707 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
1708 eerror " value lower than ${PG_MAX_CONNECTIONS}"
1709 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
1710 eerror "More information can be found here:"
1711 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
1712 die "System test failed."
1713 fi
1714 done
1715 einfo "Passed."
1716 else
1717 ewarn "SKIP_SYSTEM_TESTS set, so skipping."
1718 fi
1719 fi
1720
1721 einfo "Creating the data directory ..."
1722 if [[ ${EUID} == 0 ]] ; then
1723 mkdir -p "${DATA_DIR}"
1724 chown -Rf postgres:postgres "${DATA_DIR}"
1725 chmod 0700 "${DATA_DIR}"
1726 fi
1727
1728 einfo "Initializing the database ..."
1729
1730 if [[ ${EUID} == 0 ]] ; then
1731 su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
1732 else
1733 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
1734 fi
1735
1736 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
1737
1738 einfo "The autovacuum function, which was in contrib, has been moved to the main"
1739 einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
1740 einfo "by default. You can disable it in the cluster's:"
1741 einfo " ${PGDATA%/}/postgresql.conf"
1742 einfo
1743 einfo "The PostgreSQL server, by default, will log events to:"
1744 einfo " ${DATA_DIR%/}/postmaster.log"
1745 einfo
1746 if use prefix ; then
1747 einfo "The location of the configuration files have moved to:"
1748 einfo " ${PGDATA}"
1749 einfo "To start the server:"
1750 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
1751 einfo "To stop:"
1752 einfo " pg_ctl stop -D ${DATA_DIR}"
1753 einfo
1754 einfo "Or move the configuration files back:"
1755 einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
1756 else
1757 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1758 einfo "instead of 'pg_ctl'."
1759 fi
1760 }
1761
1762
1763
1764 1.1 dev-db/postgresql/postgresql-9.3.5-r1.ebuild
1765
1766 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.3.5-r1.ebuild?rev=1.1&view=markup
1767 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.3.5-r1.ebuild?rev=1.1&content-type=text/plain
1768
1769 Index: postgresql-9.3.5-r1.ebuild
1770 ===================================================================
1771 # Copyright 1999-2014 Gentoo Foundation
1772 # Distributed under the terms of the GNU General Public License v2
1773 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9.3.5-r1.ebuild,v 1.1 2014/11/01 11:29:06 titanofold Exp $
1774
1775 EAPI="5"
1776
1777 PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} )
1778 WANT_AUTOMAKE="none"
1779
1780 inherit autotools eutils flag-o-matic multilib pam prefix python-single-r1 systemd user versionator
1781
1782 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~ppc-macos ~sparc-fbsd ~x86-fbsd ~x86-solaris"
1783
1784 SLOT="$(get_version_component_range 1-2)"
1785
1786 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
1787
1788 # Add initscript source.
1789 SRC_URI+=" http://dev.gentoo.org/~floppym/dist/postgresql-initscript-2.7.tbz2"
1790
1791 LICENSE="POSTGRESQL GPL-2"
1792 DESCRIPTION="PostgreSQL RDBMS"
1793 HOMEPAGE="http://www.postgresql.org/"
1794
1795 LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
1796 IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python +readline selinux server ssl tcl threads uuid xml zlib"
1797
1798 for lingua in ${LINGUAS}; do
1799 IUSE+=" linguas_${lingua}"
1800 done
1801
1802 wanted_languages() {
1803 local enable_langs
1804
1805 for lingua in ${LINGUAS} ; do
1806 use linguas_${lingua} && enable_langs+="${lingua} "
1807 done
1808
1809 echo -n ${enable_langs}
1810 }
1811
1812 RDEPEND="
1813 >=app-admin/eselect-postgresql-1.2.0
1814 sys-apps/less
1815 virtual/libintl
1816 kerberos? ( virtual/krb5 )
1817 ldap? ( net-nds/openldap )
1818 pam? ( virtual/pam )
1819 perl? ( >=dev-lang/perl-5.8 )
1820 python? ( ${PYTHON_DEPS} )
1821 readline? ( sys-libs/readline )
1822 selinux? ( sec-policy/selinux-postgresql )
1823 ssl? ( >=dev-libs/openssl-0.9.6-r1 )
1824 tcl? ( >=dev-lang/tcl-8 )
1825 uuid? ( dev-libs/ossp-uuid )
1826 xml? ( dev-libs/libxml2 dev-libs/libxslt )
1827 zlib? ( sys-libs/zlib )
1828 "
1829
1830 DEPEND="${RDEPEND}
1831 !!dev-db/postgresql-docs:${SLOT}
1832 !!dev-db/postgresql-base:${SLOT}
1833 !!dev-db/postgresql-server:${SLOT}
1834 !!<sys-apps/sandbox-2.0
1835 sys-devel/bison
1836 sys-devel/flex
1837 nls? ( sys-devel/gettext )
1838 xml? ( virtual/pkgconfig )
1839 "
1840
1841 pkg_setup() {
1842 enewgroup postgres 70
1843 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
1844
1845 use python && python-single-r1_pkg_setup
1846 }
1847
1848 src_prepare() {
1849 # Eliminate autotools version check
1850 sed '/m4_PACKAGE_VERSION/,+3d' -i configure.in || die
1851
1852 # Work around PPC{,64} compilation bug where bool is already defined
1853 sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
1854
1855 # Set proper run directory
1856 sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1857 -i src/include/pg_config_manual.h || die
1858
1859 sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1860 -i "${WORKDIR}"/postgresql{.{init,confd,service},-check-db-dir} || \
1861 die "SLOT/LIBDIR sed failed"
1862
1863 use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
1864
1865 if use pam ; then
1866 sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
1867 -i src/backend/libpq/auth.c || \
1868 die 'PGSQL_PAM_SERVICE rename failed.'
1869 fi
1870
1871 eautoconf
1872 }
1873
1874 src_configure() {
1875 case ${CHOST} in
1876 *-darwin*|*-solaris*)
1877 use nls && append-libs intl
1878 ;;
1879 esac
1880
1881 export LDFLAGS_SL="${LDFLAGS}"
1882 export LDFLAGS_EX="${LDFLAGS}"
1883
1884 local PO="${EPREFIX%/}"
1885
1886 econf \
1887 --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
1888 --datadir="${PO}/usr/share/postgresql-${SLOT}" \
1889 --docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \
1890 --includedir="${PO}/usr/include/postgresql-${SLOT}" \
1891 --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
1892 --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
1893 --with-system-tzdata="${PO}/usr/share/zoneinfo" \
1894 $(use_enable !pg_legacytimestamp integer-datetimes) \
1895 $(use_enable threads thread-safety) \
1896 $(use_with kerberos gssapi) \
1897 $(use_with kerberos krb5) \
1898 $(use_with ldap) \
1899 $(use_with pam) \
1900 $(use_with perl) \
1901 $(use_with python) \
1902 $(use_with readline) \
1903 $(use_with ssl openssl) \
1904 $(use_with tcl) \
1905 $(use_with uuid ossp-uuid) \
1906 $(use_with xml libxml) \
1907 $(use_with xml libxslt) \
1908 $(use_with zlib) \
1909 "$(use_enable nls nls "$(wanted_languages)")"
1910 }
1911
1912 src_compile() {
1913 emake
1914 emake -C contrib
1915 }
1916
1917 src_install() {
1918 emake DESTDIR="${D}" install
1919 emake DESTDIR="${D}" install -C contrib
1920
1921 dodoc README HISTORY doc/{TODO,bug.template}
1922
1923 # man pages are already built, but if we have the target make them,
1924 # they'll be generated from source before being installed so we
1925 # manually install man pages.
1926 # We use ${SLOT} instead of doman for postgresql.eselect
1927 insinto /usr/share/postgresql-${SLOT}/man/
1928 doins -r doc/src/sgml/man{1,3,7}
1929 if ! use server; then
1930 # Remove man pages for non-existent binaries
1931 for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
1932 rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
1933 done
1934 fi
1935 docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1936
1937 insinto /etc/postgresql-${SLOT}
1938 newins src/bin/psql/psqlrc.sample psqlrc
1939
1940 dodir /etc/eselect/postgresql/slots/${SLOT}
1941 echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \
1942 "${ED}/etc/eselect/postgresql/slots/${SLOT}/base"
1943
1944 if use doc ; then
1945 docinto html
1946 dodoc doc/src/sgml/html/*
1947
1948 docinto sgml
1949 dodoc doc/src/sgml/*.{sgml,dsl}
1950 fi
1951
1952 if use server; then
1953 newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT}
1954 newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT}
1955
1956 systemd_newunit "${WORKDIR}"/postgresql.service postgresql-${SLOT}.service
1957 systemd_newtmpfilesd "${WORKDIR}"/postgresql.tmpfilesd postgresql-${SLOT}.conf
1958 newbin "${WORKDIR}"/postgresql-check-db-dir postgresql-${SLOT}-check-db-dir
1959
1960 use pam && pamd_mimic system-auth postgresql-${SLOT} auth account session
1961
1962 if use prefix ; then
1963 keepdir /run/postgresql
1964 fperms 0775 /run/postgresql
1965 fi
1966 fi
1967 }
1968
1969 pkg_postinst() {
1970 postgresql-config update
1971
1972 elog "If you need a global psqlrc-file, you can place it in:"
1973 elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1974
1975 if use server ; then
1976 elog
1977 elog "Gentoo specific documentation:"
1978 elog "http://www.gentoo.org/doc/en/postgres-howto.xml"
1979 elog
1980 elog "Official documentation:"
1981 elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
1982 elog
1983 elog "The default location of the Unix-domain socket is:"
1984 elog " ${EROOT%/}/run/postgresql/"
1985 elog
1986 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1987 elog "so that it contains your preferred locale in:"
1988 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1989 elog
1990 elog "Then, execute the following command to setup the initial database"
1991 elog "environment:"
1992 elog " emerge --config =${CATEGORY}/${PF}"
1993 fi
1994 }
1995
1996 pkg_prerm() {
1997 if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1998 ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1999 ewarn "\thttp://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5"
2000
2001 ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
2002 sleep 10
2003 eend 0
2004 fi
2005 }
2006
2007 pkg_postrm() {
2008 postgresql-config update
2009 }
2010
2011 pkg_config() {
2012 use server || die "USE flag 'server' not enabled. Nothing to configure."
2013
2014 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2015 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
2016 [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
2017
2018 # environment.bz2 may not contain the same locale as the current system
2019 # locale. Unset and source from the current system locale.
2020 if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
2021 unset LANG
2022 unset LC_CTYPE
2023 unset LC_NUMERIC
2024 unset LC_TIME
2025 unset LC_COLLATE
2026 unset LC_MONETARY
2027 unset LC_MESSAGES
2028 unset LC_ALL
2029 source "${EROOT%/}/etc/env.d/02locale"
2030 [ -n "${LANG}" ] && export LANG
2031 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
2032 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
2033 [ -n "${LC_TIME}" ] && export LC_TIME
2034 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
2035 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
2036 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
2037 [ -n "${LC_ALL}" ] && export LC_ALL
2038 fi
2039
2040 einfo "You can modify the paths and options passed to initdb by editing:"
2041 einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2042 einfo
2043 einfo "Information on options that can be passed to initdb are found at:"
2044 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
2045 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
2046 einfo
2047 einfo "PG_INITDB_OPTS is currently set to:"
2048 if [[ -z "${PG_INITDB_OPTS}" ]] ; then
2049 einfo " (none)"
2050 else
2051 einfo " ${PG_INITDB_OPTS}"
2052 fi
2053 einfo
2054 einfo "Configuration files will be installed to:"
2055 einfo " ${PGDATA}"
2056 einfo
2057 einfo "The database cluster will be created in:"
2058 einfo " ${DATA_DIR}"
2059 einfo
2060 while [ "$correct" != "true" ] ; do
2061 einfo "Are you ready to continue? (y/n)"
2062 read answer
2063 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
2064 correct="true"
2065 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
2066 die "Aborting initialization."
2067 else
2068 echo "Answer not recognized"
2069 fi
2070 done
2071
2072 if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
2073 eerror "The given directory, '${DATA_DIR}', is not empty."
2074 eerror "Modify DATA_DIR to point to an empty directory."
2075 die "${DATA_DIR} is not empty."
2076 fi
2077
2078 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
2079 einfo "Checking system parameters..."
2080
2081 if ! use kernel_linux ; then
2082 einfo "Skipped."
2083 einfo " Tests not supported on this OS (yet)"
2084 else
2085 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
2086 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
2087
2088 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
2089 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
2090 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
2091 local SHMMAX=$(sysctl -n kernel.shmmax)
2092
2093 local SEMMSL_MIN=17
2094 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
2095 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
2096 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
2097
2098 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
2099 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
2100 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
2101 eerror "You have now several options:"
2102 eerror " - Change the mentioned system parameter"
2103 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
2104 eerror " value lower than ${PG_MAX_CONNECTIONS}"
2105 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
2106 eerror "More information can be found here:"
2107 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
2108 die "System test failed."
2109 fi
2110 done
2111 einfo "Passed."
2112 else
2113 ewarn "SKIP_SYSTEM_TESTS set, so skipping."
2114 fi
2115 fi
2116
2117 einfo "Creating the data directory ..."
2118 if [[ ${EUID} == 0 ]] ; then
2119 mkdir -p "${DATA_DIR}"
2120 chown -Rf postgres:postgres "${DATA_DIR}"
2121 chmod 0700 "${DATA_DIR}"
2122 fi
2123
2124 einfo "Initializing the database ..."
2125
2126 if [[ ${EUID} == 0 ]] ; then
2127 su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
2128 else
2129 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
2130 fi
2131
2132 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
2133
2134 einfo "The autovacuum function, which was in contrib, has been moved to the main"
2135 einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
2136 einfo "by default. You can disable it in the cluster's:"
2137 einfo " ${PGDATA%/}/postgresql.conf"
2138 einfo
2139 einfo "The PostgreSQL server, by default, will log events to:"
2140 einfo " ${DATA_DIR%/}/postmaster.log"
2141 einfo
2142 if use prefix ; then
2143 einfo "The location of the configuration files have moved to:"
2144 einfo " ${PGDATA}"
2145 einfo "To start the server:"
2146 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
2147 einfo "To stop:"
2148 einfo " pg_ctl stop -D ${DATA_DIR}"
2149 einfo
2150 einfo "Or move the configuration files back:"
2151 einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
2152 else
2153 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
2154 einfo "instead of 'pg_ctl'."
2155 fi
2156 }
2157
2158 src_test() {
2159 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
2160
2161 if use server && [[ ${UID} -ne 0 ]] ; then
2162 emake check
2163
2164 einfo "If you think other tests besides the regression tests are necessary, please"
2165 einfo "submit a bug including a patch for this ebuild to enable them."
2166 else
2167 use server || \
2168 ewarn 'Tests cannot be run without the "server" use flag enabled.'
2169 [[ ${UID} -eq 0 ]] || \
2170 ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
2171
2172 ewarn 'Skipping.'
2173 fi
2174 }