Gentoo Archives: gentoo-commits

From: "Patrick Lauer (patrick)" <patrick@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-db/postgresql-server: postgresql-server-9.1.1.ebuild postgresql-server-9.0.5.ebuild postgresql-server-8.3.16.ebuild postgresql-server-8.2.22.ebuild ChangeLog postgresql-server-8.4.9.ebuild
Date: Mon, 26 Sep 2011 18:02:29
Message-Id: 20110926180217.950B020036@flycatcher.gentoo.org
1 patrick 11/09/26 18:02:17
2
3 Modified: ChangeLog
4 Added: postgresql-server-9.1.1.ebuild
5 postgresql-server-9.0.5.ebuild
6 postgresql-server-8.3.16.ebuild
7 postgresql-server-8.2.22.ebuild
8 postgresql-server-8.4.9.ebuild
9 Log:
10 Bump for #384539
11
12 (Portage version: 2.2.0_alpha59/cvs/Linux x86_64)
13
14 Revision Changes Path
15 1.142 dev-db/postgresql-server/ChangeLog
16
17 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.142&view=markup
18 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.142&content-type=text/plain
19 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?r1=1.141&r2=1.142
20
21 Index: ChangeLog
22 ===================================================================
23 RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v
24 retrieving revision 1.141
25 retrieving revision 1.142
26 diff -u -r1.141 -r1.142
27 --- ChangeLog 24 Sep 2011 17:14:00 -0000 1.141
28 +++ ChangeLog 26 Sep 2011 18:02:15 -0000 1.142
29 @@ -1,6 +1,18 @@
30 # ChangeLog for dev-db/postgresql-server
31 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
32 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.141 2011/09/24 17:14:00 armin76 Exp $
33 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.142 2011/09/26 18:02:15 patrick Exp $
34 +
35 +*postgresql-server-9.1.1 (26 Sep 2011)
36 +*postgresql-server-9.0.5 (26 Sep 2011)
37 +*postgresql-server-8.4.9 (26 Sep 2011)
38 +*postgresql-server-8.3.16 (26 Sep 2011)
39 +*postgresql-server-8.2.22 (26 Sep 2011)
40 +
41 + 26 Sep 2011; Patrick Lauer <patrick@g.o>
42 + +postgresql-server-8.2.22.ebuild, +postgresql-server-8.3.16.ebuild,
43 + +postgresql-server-8.4.9.ebuild, +postgresql-server-9.0.5.ebuild,
44 + +postgresql-server-9.1.1.ebuild:
45 + Bump for #384539
46
47 24 Sep 2011; Raúl Porcel <armin76@g.o>
48 postgresql-server-8.2.21-r2.ebuild, postgresql-server-8.3.15-r2.ebuild,
49
50
51
52 1.1 dev-db/postgresql-server/postgresql-server-9.1.1.ebuild
53
54 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1.1.ebuild?rev=1.1&view=markup
55 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1.1.ebuild?rev=1.1&content-type=text/plain
56
57 Index: postgresql-server-9.1.1.ebuild
58 ===================================================================
59 # Copyright 1999-2011 Gentoo Foundation
60 # Distributed under the terms of the GNU General Public License v2
61 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1.1.ebuild,v 1.1 2011/09/26 18:02:15 patrick Exp $
62
63 EAPI="3"
64 PYTHON_DEPEND="python? 2"
65
66 WANT_AUTOMAKE="none"
67 inherit autotools eutils flag-o-matic multilib pam prefix python versionator
68
69 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~ppc-macos ~x86-solaris"
70
71 SLOT="$(get_version_component_range 1-2)"
72 S="${WORKDIR}/postgresql-${PV}"
73
74 DESCRIPTION="PostgreSQL server"
75 HOMEPAGE="http://www.postgresql.org/"
76 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2
77 http://dev.gentoo.org/~titanofold/postgresql-patches-${SLOT}.tbz2
78 http://dev.gentoo.org/~titanofold/postgresql-initscript-1.2.tbz2"
79 LICENSE="POSTGRESQL"
80
81 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"
82 IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml"
83
84 for lingua in ${LINGUAS}; do
85 IUSE+=" linguas_${lingua}"
86 done
87
88 wanted_languages() {
89 local enable_langs
90
91 for lingua in ${LINGUAS} ; do
92 use linguas_${lingua} && enable_langs+="${lingua} "
93 done
94
95 echo -n ${enable_langs}
96 }
97
98 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=]
99 perl? ( >=dev-lang/perl-5.8 )
100 selinux? ( sec-policy/selinux-postgresql )
101 tcl? ( >=dev-lang/tcl-8 )
102 uuid? ( dev-libs/ossp-uuid )
103 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
104 DEPEND="${RDEPEND}
105 sys-devel/flex
106 xml? ( dev-util/pkgconfig )"
107 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
108
109 pkg_setup() {
110 enewgroup postgres 70
111 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
112
113 use python && python_set_active_version 2
114 }
115
116 src_prepare() {
117 epatch "${WORKDIR}/autoconf.patch" "${WORKDIR}/bool.patch" \
118 "${WORKDIR}/pg_ctl-exit-status.patch" "${WORKDIR}/server.patch"
119
120 eprefixify src/include/pg_config_manual.h
121
122 if use test ; then
123 epatch "${WORKDIR}/regress.patch"
124 sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c
125 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
126 else
127 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
128 fi
129
130 eautoconf
131
132 # use perl && epatch "${WORKDIR}/perl-ExtUtils-ParseXS.patch"
133 }
134
135 src_configure() {
136 case ${CHOST} in
137 *-darwin*|*-solaris*)
138 use nls && append-libs intl
139 ;;
140 esac
141
142 local PO="${EPREFIX%/}"
143
144 # eval is needed to get along with pg_config quotation of space-rich entities.
145 eval econf "$(${PO}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
146 $(use_with perl) \
147 $(use_with python) \
148 $(use_with tcl) \
149 $(use_with xml libxml) \
150 $(use_with xml libxslt) \
151 $(use_with uuid ossp-uuid) \
152 --with-system-tzdata="${PO}/usr/share/zoneinfo" \
153 --with-includes="${PO}/usr/include/postgresql-${SLOT}/" \
154 --with-libraries="${PO}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
155 "$(use_enable nls nls "$(wanted_languages)")"
156 }
157
158 src_compile() {
159 local bd
160 for bd in . contrib $(use xml && echo contrib/xml2); do
161 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
162 emake -C $bd || die "emake in $bd failed"
163 done
164 }
165
166 src_install() {
167 if use perl ; then
168 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
169 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
170 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
171 fi
172
173 local bd
174 for bd in . contrib $(use xml && echo contrib/xml2) ; do
175 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
176 emake install -C $bd DESTDIR="${D}" || die "emake install in $bd failed"
177 done
178
179 dodoc README HISTORY doc/{TODO,bug.template}
180
181 dodir /etc/eselect/postgresql/slots/${SLOT}
182 echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \
183 "${ED}/etc/eselect/postgresql/slots/${SLOT}/server"
184
185 sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.confd
186 newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} || die "Inserting conf failed"
187 sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.init
188 newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} || die "Inserting conf failed"
189
190 use pam && pamd_mimic system-auth postgresql auth account session
191
192 keepdir /var/run/postgresql
193 fperms 0770 /var/run/postgresql
194 use prefix || fowners postgres:postgres /var/run/postgresql
195 }
196
197 pkg_postinst() {
198 postgresql-config update
199
200 elog "The Unix-domain socket is located in:"
201 elog " ${EROOT%/}/var/run/postgresql/"
202 elog
203 elog "If you have users and/or services that you would like to utilize the socket,"
204 elog "you must add them to the 'postgres' system group:"
205 elog " usermod -a -G postgres <user>"
206 elog
207 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
208 elog "it contains your preferred locale in:"
209 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
210 elog
211 elog "Then, execute the following command to setup the initial database"
212 elog "environment:"
213 elog " emerge --config =${CATEGORY}/${PF}"
214 }
215
216 pkg_postrm() {
217 postgresql-config update
218 }
219
220 pkg_config() {
221 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
222 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
223 [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
224
225 # environment.bz2 may not contain the same locale as the current system
226 # locale. Unset and source from the current system locale.
227 if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
228 unset LANG
229 unset LC_CTYPE
230 unset LC_NUMERIC
231 unset LC_TIME
232 unset LC_COLLATE
233 unset LC_MONETARY
234 unset LC_MESSAGES
235 unset LC_ALL
236 source "${EROOT%/}/etc/env.d/02locale"
237 [ -n "${LANG}" ] && export LANG
238 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
239 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
240 [ -n "${LC_TIME}" ] && export LC_TIME
241 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
242 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
243 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
244 [ -n "${LC_ALL}" ] && export LC_ALL
245 fi
246
247 einfo "You can modify the paths and options passed to initdb by editing:"
248 einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
249 einfo
250 einfo "Information on options that can be passed to initdb are found at:"
251 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
252 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
253 einfo
254 einfo "PG_INITDB_OPTS is currently set to:"
255 if [[ -z "${PG_INITDB_OPTS}" ]] ; then
256 einfo " (none)"
257 else
258 einfo " ${PG_INITDB_OPTS}"
259 fi
260 einfo
261 einfo "Configuration files will be installed to:"
262 einfo " ${PGDATA}"
263 einfo
264 einfo "The database cluster will be created in:"
265 einfo " ${DATA_DIR}"
266 einfo
267 while [ "$correct" != "true" ] ; do
268 einfo "Are you ready to continue? (y/n)"
269 read answer
270 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
271 correct="true"
272 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
273 die "Aborting initialization."
274 else
275 echo "Answer not recognized"
276 fi
277 done
278
279 if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
280 eerror "The given directory, '${DATA_DIR}', is not empty."
281 eerror "Modify DATA_DIR to point to an empty directory."
282 die "${DATA_DIR} is not empty."
283 fi
284
285 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
286 einfo "Checking system parameters..."
287
288 if ! use kernel_linux ; then
289 einfo "Skipped."
290 einfo " Tests not supported on this OS (yet)"
291 else
292 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
293 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
294
295 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
296 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
297 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
298 local SHMMAX=$(sysctl -n kernel.shmmax)
299
300 local SEMMSL_MIN=17
301 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
302 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
303 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
304
305 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
306 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
307 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
308 eerror "You have now several options:"
309 eerror " - Change the mentioned system parameter"
310 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
311 eerror " value lower than ${PG_MAX_CONNECTIONS}"
312 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
313 eerror "More information can be found here:"
314 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
315 die "System test failed."
316 fi
317 done
318 einfo "Passed."
319 else
320 ewarn "SKIP_SYSTEM_TESTS set, so skipping."
321 fi
322 fi
323
324 einfo "Creating the data directory ..."
325 if [[ ${EUID} == 0 ]] ; then
326 mkdir -p "${DATA_DIR}"
327 chown -Rf postgres:postgres "${DATA_DIR}"
328 chmod 0700 "${DATA_DIR}"
329 fi
330
331 einfo "Initializing the database ..."
332
333 if [[ ${EUID} == 0 ]] ; then
334 su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
335 else
336 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
337 fi
338
339 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
340
341 einfo "The autovacuum function, which was in contrib, has been moved to the main"
342 einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
343 einfo "by default. You can disable it in the cluster's:"
344 einfo " ${PGDATA%/}/postgresql.conf"
345 einfo
346 einfo "The PostgreSQL server, by default, will log events to:"
347 einfo " ${DATA_DIR%/}/postmaster.log"
348 einfo
349 if use prefix ; then
350 einfo "The location of the configuration files have moved to:"
351 einfo " ${PGDATA}"
352 einfo "To start the server:"
353 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
354 einfo "To stop:"
355 einfo " pg_ctl stop -D ${DATA_DIR}"
356 einfo
357 einfo "Or move the configuration files back:"
358 einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
359 else
360 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
361 einfo "instead of 'pg_ctl'."
362 fi
363 }
364
365 src_test() {
366 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
367
368 if [ ${UID} -ne 0 ] ; then
369 emake -j1 check || die "Make check failed. See above for details."
370
371 einfo "If you think other tests besides the regression tests are necessary, please"
372 einfo "submit a bug including a patch for this ebuild to enable them."
373 else
374 ewarn "Tests cannot be run as root. Skipping."
375 ewarn "HINT: FEATURES=\"userpriv\""
376 fi
377 }
378
379
380
381 1.1 dev-db/postgresql-server/postgresql-server-9.0.5.ebuild
382
383 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.5.ebuild?rev=1.1&view=markup
384 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.5.ebuild?rev=1.1&content-type=text/plain
385
386 Index: postgresql-server-9.0.5.ebuild
387 ===================================================================
388 # Copyright 1999-2011 Gentoo Foundation
389 # Distributed under the terms of the GNU General Public License v2
390 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.5.ebuild,v 1.1 2011/09/26 18:02:15 patrick Exp $
391
392 EAPI="3"
393 PYTHON_DEPEND="python? 2"
394
395 WANT_AUTOMAKE="none"
396 inherit autotools eutils multilib pam prefix python versionator
397
398 SLOT="$(get_version_component_range 1-2)"
399
400 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~ppc-macos ~x86-solaris"
401
402 DESCRIPTION="PostgreSQL server"
403 HOMEPAGE="http://www.postgresql.org/"
404 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2
405 http://dev.gentoo.org/~titanofold/postgresql-patches-${SLOT}-r2.tbz2
406 http://dev.gentoo.org/~titanofold/postgresql-initscript-1.2.tbz2"
407 LICENSE="POSTGRESQL"
408
409 S="${WORKDIR}/postgresql-${PV}"
410
411 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"
412 IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml"
413
414 for lingua in ${LINGUAS}; do
415 IUSE+=" linguas_${lingua}"
416 done
417
418 wanted_languages() {
419 local enable_langs
420
421 for lingua in ${LINGUAS} ; do
422 use linguas_${lingua} && enable_langs+="${lingua} "
423 done
424
425 echo -n ${enable_langs}
426 }
427
428 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=]
429 perl? ( >=dev-lang/perl-5.8 )
430 selinux? ( sec-policy/selinux-postgresql )
431 tcl? ( >=dev-lang/tcl-8 )
432 uuid? ( dev-libs/ossp-uuid )
433 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
434
435 DEPEND="${RDEPEND}
436 sys-devel/flex
437 xml? ( dev-util/pkgconfig )"
438
439 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
440
441 pkg_setup() {
442 enewgroup postgres 70
443 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
444
445 use python && python_set_active_version 2
446 }
447
448 src_prepare() {
449 epatch "${WORKDIR}/autoconf.patch" "${WORKDIR}/bool.patch" \
450 "${WORKDIR}/pg_ctl-exit-status.patch" "${WORKDIR}/server.patch"
451
452 eprefixify src/include/pg_config_manual.h
453
454 if use test ; then
455 epatch "${WORKDIR}/regress.patch"
456 sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c
457 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \
458 -i src/test/regress/{input,output}/tablespace.source
459 else
460 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
461 fi
462
463 eautoconf
464 }
465
466 src_configure() {
467 # eval is needed to get along with pg_config quotation of space-rich entities.
468 eval econf "$(${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
469 --with-includes="${EPREFIX%/}/usr/include/postgresql-${SLOT}/" \
470 --with-libraries="${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
471 --with-system-tzdata="${EPREFIX%/}/usr/share/zoneinfo" \
472 $(use_with perl) \
473 $(use_with python) \
474 $(use_with tcl) \
475 $(use_with xml libxml) \
476 $(use_with xml libxslt) \
477 $(use_with uuid ossp-uuid) \
478 "$(use_enable nls nls "$(wanted_languages)")"
479 }
480
481 src_compile() {
482 local bd
483 for bd in . contrib $(use xml && echo contrib/xml2); do
484 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
485 emake -C $bd -j1 || die "emake in $bd failed"
486 done
487 }
488
489 src_install() {
490 if use perl ; then
491 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
492 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
493 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
494 fi
495
496 local bd
497 for bd in . contrib $(use xml && echo contrib/xml2) ; do
498 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
499 emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
500 done
501
502 dodir /usr/share/postgresql-${SLOT}/man/man1/
503 cp "${S}"/doc/src/sgml/man1/{initdb,pg_controldata,pg_ctl,pg_resetxlog,post{gres,master}}.1 \
504 "${ED}"/usr/share/postgresql-${SLOT}/man/man1/ || die
505
506 dodoc README HISTORY doc/{README.*,TODO,bug.template}
507
508 dodir /etc/eselect/postgresql/slots/${SLOT}
509 echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \
510 > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server"
511
512 sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}/postgresql.confd"
513 newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} || die "Inserting conf.d file failed"
514 sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}/postgresql.init"
515 newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} || die "Inserting init.d file failed"
516
517 use pam && pamd_mimic system-auth postgresql auth account session
518
519 keepdir /var/run/postgresql
520 fperms 0770 /var/run/postgresql
521 use prefix || fowners postgres:postgres /var/run/postgresql
522 }
523
524 pkg_postinst() {
525 postgresql-config update
526
527 elog "The time stamp format is 64 bit integers now. If you upgrade from older"
528 elog "databases, this may force you to either do a dump and reload or enable"
529 elog "pg_legacytimestamp until you find time to do so. If the database cannot start"
530 elog "please try enabling pg_legacytimestamp and rebuild."
531 elog
532 elog "The Unix-domain socket is located in:"
533 elog " ${EROOT%/}/var/run/postgresql/"
534 elog
535 elog "If you have users and/or services that you would like to utilize the socket,"
536 elog "you must add them to the 'postgres' system group:"
537 elog " usermod -a -G postgres <user>"
538 elog
539 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
540 elog "it contains your preferred locale in:"
541 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
542 elog
543 elog "Then, execute the following command to setup the initial database"
544 elog "environment:"
545 elog " emerge --config =${CATEGORY}/${PF}"
546 }
547
548 pkg_postrm() {
549 postgresql-config update
550 }
551
552 pkg_config() {
553 [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
554 [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
555 [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
556
557 # environment.bz2 may not contain the same locale as the current system
558 # locale. Unset and source from the current system locale.
559 if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then
560 unset LANG
561 unset LC_CTYPE
562 unset LC_NUMERIC
563 unset LC_TIME
564 unset LC_COLLATE
565 unset LC_MONETARY
566 unset LC_MESSAGES
567 unset LC_ALL
568 source "${EROOT%/}/etc/env.d/02locale"
569 [[ -n ${LANG} ]] && export LANG
570 [[ -n ${LC_CTYPE} ]] && export LC_CTYPE
571 [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC
572 [[ -n ${LC_TIME} ]] && export LC_TIME
573 [[ -n ${LC_COLLATE} ]] && export LC_COLLATE
574 [[ -n ${LC_MONETARY} ]] && export LC_MONETARY
575 [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES
576 [[ -n ${LC_ALL} ]] && export LC_ALL
577 fi
578
579 einfo "You can modify the paths and options passed to initdb by editing:"
580 einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
581 einfo
582 einfo "Information on options that can be passed to initdb are found at:"
583 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
584 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
585 einfo
586 einfo "PG_INITDB_OPTS is currently set to:"
587 if [[ -z "${PG_INITDB_OPTS}" ]] ; then
588 einfo " (none)"
589 else
590 einfo " ${PG_INITDB_OPTS}"
591 fi
592 einfo
593 einfo "Configuration files will be installed to:"
594 einfo " ${PGDATA}"
595 einfo
596 einfo "The database cluster will be created in:"
597 einfo " ${DATA_DIR}"
598 einfo
599 while [[ $correct != "true" ]] ; do
600 einfo "Are you ready to continue? (y/n)"
601 read answer
602 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
603 correct="true"
604 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
605 die "Aborting initialization."
606 else
607 echo "Answer not recognized"
608 fi
609 done
610
611 if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then
612 eerror "The given directory, '${DATA_DIR}', is not empty."
613 eerror "Modify DATA_DIR to point to an empty directory."
614 die "${DATA_DIR} is not empty."
615 fi
616
617 [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128
618 einfo "Checking system parameters..."
619
620 if ! use kernel_linux ; then
621 einfo "Skipped."
622 einfo " Tests not supported on this OS (yet)"
623 else
624 if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then
625 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
626
627 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
628 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
629 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
630 local SHMMAX=$(sysctl -n kernel.shmmax)
631
632 local SEMMSL_MIN=17
633 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
634 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
635 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
636
637 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
638 if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then
639 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
640 eerror "You have now several options:"
641 eerror " - Change the mentioned system parameter"
642 eerror " - Lower the number of max connections by setting PG_MAX_CONNECTIONS to a"
643 eerror " value lower than ${PG_MAX_CONNECTIONS}"
644 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
645 eerror "More information can be found here:"
646 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
647 die "System test failed."
648 fi
649 done
650 einfo "Passed."
651 else
652 ewarn "SKIP_SYSTEM_TESTS set, so skipping."
653 fi
654 fi
655
656 if [[ ${EUID} == 0 ]] ; then
657 einfo "Creating the data directory ..."
658 mkdir -p "${DATA_DIR}"
659 chown -Rf postgres:postgres "${DATA_DIR}"
660 chmod 0700 "${DATA_DIR}"
661 fi
662
663 einfo "Initializing the database ..."
664
665 if [[ ${EUID} == 0 ]] ; then
666 su postgres \
667 -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D '${DATA_DIR}' -L '${EROOT%/}/usr/share/postgresql-${SLOT}/' ${PG_INITDB_OPTS}"
668 else
669 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb \
670 -U postgres -D "${DATA_DIR}" \
671 -L "${EROOT%/}/usr/share/postgresql-${SLOT}/" ${PG_INITDB_OPTS}
672 fi
673
674 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
675
676 einfo "The autovacuum function, which was in contrib, has been moved to the main"
677 einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
678 einfo "by default. You can disable it in the cluster's:"
679 einfo " ${PGDATA%/}/postgresql.conf"
680 einfo
681 einfo "The PostgreSQL server, by default, will log events to:"
682 einfo " ${DATA_DIR%/}/postmaster.log"
683 einfo
684 if use prefix ; then
685 einfo "The location of the configuration files have moved to:"
686 einfo " ${PGDATA}"
687 einfo
688 einfo "To start the server:"
689 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
690 einfo
691 einfo "To stop:"
692 einfo " pg_ctl stop -D ${DATA_DIR}"
693 einfo
694 einfo "Or move the configuration files back:"
695 einfo " mv ${PGDATA}*.conf ${DATA_DIR}"
696 else
697 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
698 einfo "instead of 'pg_ctl'."
699 fi
700 }
701
702 src_test() {
703 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
704
705 if [[ ${UID} != 0 ]] ; then
706 emake check || die "Make check failed. See above for details."
707
708 einfo "If you think other tests besides the regression tests are necessary, please"
709 einfo "submit a bug including a patch for this ebuild to enable them."
710 else
711 ewarn "Tests cannot be run as root. Skipping."
712 ewarn "HINT: FEATURES=\"userpriv\""
713 fi
714 }
715
716
717
718 1.1 dev-db/postgresql-server/postgresql-server-8.3.16.ebuild
719
720 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.16.ebuild?rev=1.1&view=markup
721 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.16.ebuild?rev=1.1&content-type=text/plain
722
723 Index: postgresql-server-8.3.16.ebuild
724 ===================================================================
725 # Copyright 1999-2011 Gentoo Foundation
726 # Distributed under the terms of the GNU General Public License v2
727 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.16.ebuild,v 1.1 2011/09/26 18:02:15 patrick Exp $
728
729 EAPI="4"
730
731 WANT_AUTOMAKE="none"
732 inherit autotools eutils multilib pam prefix versionator
733
734 SLOT="$(get_version_component_range 1-2)"
735
736 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
737
738 DESCRIPTION="PostgreSQL server"
739 HOMEPAGE="http://www.postgresql.org/"
740 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2
741 http://dev.gentoo.org/~titanofold/postgresql-patches-${SLOT}-r1.tbz2
742 http://dev.gentoo.org/~titanofold/postgresql-initscript-1.2.tbz2"
743 LICENSE="POSTGRESQL"
744
745 S="${WORKDIR}/postgresql-${PV}"
746
747 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"
748 IUSE="doc kernel_linux nls pam perl python selinux tcl uuid xml"
749
750 for lingua in ${LINGUAS} ; do
751 IUSE+=" linguas_${lingua}"
752 done
753
754 wanted_languages() {
755 local enable_langs
756
757 for lingua in ${LINGUAS} ; do
758 use linguas_${lingua} && enable_langs+="${lingua} "
759 done
760
761 echo -n ${enable_langs}
762 }
763
764 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,nls=]
765 perl? ( >=dev-lang/perl-5.8 )
766 selinux? ( sec-policy/selinux-postgresql )
767 tcl? ( >=dev-lang/tcl-8 )
768 uuid? ( dev-libs/ossp-uuid )
769 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
770
771 DEPEND="${RDEPEND}
772 sys-devel/flex
773 xml? ( dev-util/pkgconfig )"
774
775 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
776
777 pkg_setup() {
778 enewgroup postgres 70
779 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
780 }
781
782 src_prepare() {
783 epatch "${WORKDIR}/autoconf.patch" "${WORKDIR}/bool.patch" \
784 "${WORKDIR}/darwin.patch" "${WORKDIR}/pg_ctl-exit-status.patch" \
785 "${WORKDIR}/server.patch" "${WORKDIR}/SuperH.patch"
786
787 eprefixify src/include/pg_config_manual.h
788
789 if use test ; then
790 epatch "${WORKDIR}/regress.patch"
791 sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c
792 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \
793 -i src/test/regress/{input,output}/tablespace.source
794 else
795 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
796 fi
797
798 eautoconf
799 }
800
801 src_configure() {
802 # eval is needed to get along with pg_config quotation of space-rich entities.
803 eval econf "$(${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
804 --with-includes="${EPREFIX%/}/usr/include/postgresql-${SLOT}/" \
805 --with-system-tzdata="${EPREFIX%/}/usr/share/zoneinfo" \
806 $(use_with perl) \
807 $(use_with python) \
808 $(use_with tcl) \
809 $(use_with xml libxml) \
810 $(use_with xml libxslt) \
811 $(use_with uuid ossp-uuid) \
812 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")"
813 }
814
815 src_compile() {
816 local bd
817 for bd in . contrib $(use xml && echo contrib/xml2); do
818 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
819 emake -C $bd -j1 \
820 PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
821 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
822 NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF}
823 done
824 }
825
826 src_install() {
827 if use perl ; then
828 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
829 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
830 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
831 fi
832
833 local bd
834 for bd in . contrib $(use xml && echo contrib/xml2) ; do
835 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
836 emake install -C $bd -j1 DESTDIR="${D}" \
837 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
838 PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
839 NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF}
840 done
841
842 rm -r "${ED}/usr/share/postgresql-${SLOT}/man/man7/" "${ED}/usr/share/doc/${PF}/html"
843 rm "${ED}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,reindexdb,vacuumdb}.1
844 docompress /usr/share/postgresql-${SLOT}/man/man1
845
846 dodoc README HISTORY doc/{README.*,TODO,bug.template}
847
848 dodir /etc/eselect/postgresql/slots/${SLOT}
849 echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \
850 > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server"
851
852 sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.confd
853 newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT}
854 sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.init
855 newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT}
856
857 use pam && pamd_mimic system-auth postgresql auth account session
858
859 keepdir /var/run/postgresql
860 fperms 0770 /var/run/postgresql
861 use prefix || fowners postgres:postgres /var/run/postgresql
862 }
863
864 pkg_postinst() {
865 postgresql-config update
866
867 elog "The Unix-domain socket is located in:"
868 elog " ${EROOT%/}/var/run/postgresql/"
869 elog
870 elog "If you have users and/or services that you would like to utilize the socket,"
871 elog "you must add them to the 'postgres' system group:"
872 elog " usermod -a -G postgres <user>"
873 elog
874 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
875 elog "it contains your preferred locale in:"
876 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
877 elog
878 elog "Execute the following command to setup the initial database"
879 elog "environment:"
880 elog " emerge --config =${CATEGORY}/${PF}"
881 }
882
883 pkg_postrm() {
884 postgresql-config update
885 }
886
887 pkg_config() {
888 [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
889 [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
890 [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
891
892 # environment.bz2 may not contain the same locale as the current system
893 # locale. Unset and source from the current system locale.
894 if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then
895 unset LANG
896 unset LC_CTYPE
897 unset LC_NUMERIC
898 unset LC_TIME
899 unset LC_COLLATE
900 unset LC_MONETARY
901 unset LC_MESSAGES
902 unset LC_ALL
903 source ${EROOT%/}/etc/env.d/02locale
904 [[ -n ${LANG} ]] && export LANG
905 [[ -n ${LC_CTYPE} ]] && export LC_CTYPE
906 [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC
907 [[ -n ${LC_TIME} ]] && export LC_TIME
908 [[ -n ${LC_COLLATE} ]] && export LC_COLLATE
909 [[ -n ${LC_MONETARY} ]] && export LC_MONETARY
910 [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES
911 [[ -n ${LC_ALL} ]] && export LC_ALL
912 fi
913
914 einfo "You can modify the paths and options passed to initdb by editing:"
915 einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
916 einfo
917 einfo "Information on options that can be passed to initdb are found at:"
918 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
919 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
920 einfo
921 einfo "PG_INITDB_OPTS is currently set to:"
922 if [[ -z ${PG_INITDB_OPTS} ]] ; then
923 einfo " (none)"
924 else
925 einfo " ${PG_INITDB_OPTS}"
926 fi
927 einfo
928 einfo "Configuration files will be installed to:"
929 einfo " ${PGDATA}"
930 einfo
931 einfo "The database cluster will be created in:"
932 einfo " ${DATA_DIR}"
933 einfo
934 while [[ $correct != "true" ]] ; do
935 einfo "Are you ready to continue? (y/n)"
936 read answer
937 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
938 correct="true"
939 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
940 die "Aborting initialization."
941 else
942 echo "Answer not recognized."
943 fi
944 done
945
946 if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then
947 eerror "The given directory, '${DATA_DIR}', is not empty."
948 eerror "Modify DATA_DIR to point to an empty directory."
949 die "${DATA_DIR} is not empty."
950 fi
951
952 [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128
953 einfo "Checking system parameters..."
954
955 if ! use kernel_linux ; then
956 einfo "Skipped."
957 einfo "Tests not supported on this OS (yet)."
958 else
959 if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then
960 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
961
962 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
963 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
964 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
965 local SHMMAX=$(sysctl -n kernel.shmmax)
966
967 local SEMMSL_MIN=17
968 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
969 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
970 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
971
972 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
973 if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then
974 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
975 eerror "You have now several options:"
976 eerror " - Change the mentioned system parameter"
977 eerror " - Lower the number of max connections by setting PG_MAX_CONNECTIONS to a"
978 eerror " value lower than ${PG_MAX_CONNECTIONS}"
979 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
980 eerror "More information can be found here:"
981 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
982 die "System test failed."
983 fi
984 done
985 einfo "Passed."
986 else
987 ewarn "SKIP_SYSTEM_TESTS is set, so skipping."
988 fi
989 fi
990
991 if [[ ${EUID} == 0 ]] ; then
992 einfo "Creating the data directory ..."
993 mkdir -p "${DATA_DIR}"
994 chown -Rf postgres:postgres "${DATA_DIR}"
995 chmod 0700 "${DATA_DIR}"
996 fi
997
998 einfo "Initializing the database ..."
999 if [[ ${EUID} == 0 ]] ; then
1000 su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
1001 else
1002 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
1003 fi
1004 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
1005
1006 einfo "The autovacuum function, which was in contrib, has been moved to the main"
1007 einfo "PostgreSQL functions starting with 8.1. You can enable it in the clusters"
1008 einfo "postgresql.conf."
1009 einfo
1010 if use prefix ; then
1011 einfo "The location of the configuration files have moved to:"
1012 einfo " ${PGDATA}"
1013 einfo
1014 einfo "To start the server:"
1015 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
1016 einfo
1017 einfo "To stop:"
1018 einfo " pg_ctl stop -D ${DATA_DIR}"
1019 einfo
1020 einfo "Or move the configuration files back:"
1021 einfo " mv ${PGDATA}*.conf ${DATA_DIR}"
1022 else
1023 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1024 einfo "instead of 'pg_ctl'."
1025 fi
1026 }
1027
1028 src_test() {
1029 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1030
1031 if [[ ${UID} != 0 ]] ; then
1032 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/:${PATH}" \
1033 emake check \
1034 PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
1035 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT}
1036
1037 einfo "If you think other tests besides the regression tests are necessary, please"
1038 einfo "submit a bug including a patch for this ebuild to enable them."
1039 else
1040 ewarn "Tests cannot be run as root. Skipping."
1041 ewarn "HINT: FEATURES=\"userpriv\""
1042 fi
1043 }
1044
1045
1046
1047 1.1 dev-db/postgresql-server/postgresql-server-8.2.22.ebuild
1048
1049 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.22.ebuild?rev=1.1&view=markup
1050 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.22.ebuild?rev=1.1&content-type=text/plain
1051
1052 Index: postgresql-server-8.2.22.ebuild
1053 ===================================================================
1054 # Copyright 1999-2011 Gentoo Foundation
1055 # Distributed under the terms of the GNU General Public License v2
1056 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.22.ebuild,v 1.1 2011/09/26 18:02:15 patrick Exp $
1057
1058 EAPI="4"
1059
1060 WANT_AUTOMAKE="none"
1061 inherit autotools eutils multilib pam prefix versionator
1062
1063 SLOT="$(get_version_component_range 1-2)"
1064
1065 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~s390 ~sh ~sparc ~x86"
1066
1067 DESCRIPTION="PostgreSQL server"
1068 HOMEPAGE="http://www.postgresql.org/"
1069 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2
1070 http://dev.gentoo.org/~titanofold/postgresql-patches-${SLOT}-r1.tbz2
1071 http://dev.gentoo.org/~titanofold/postgresql-initscript-1.0.1.tbz2"
1072 LICENSE="POSTGRESQL"
1073
1074 S="${WORKDIR}/postgresql-${PV}"
1075
1076 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"
1077 IUSE="doc kernel_linux nls pam perl python selinux tcl xml"
1078
1079 for lingua in ${LINGUAS} ; do
1080 IUSE+=" linguas_${lingua}"
1081 done
1082
1083 wanted_languages() {
1084 local enable_langs
1085
1086 for lingua in ${LINGUAS} ; do
1087 use linguas_${lingua} && enable_langs+="${lingua} "
1088 done
1089
1090 echo -n ${enable_langs}
1091 }
1092
1093 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,nls=]
1094 perl? ( >=dev-lang/perl-5.8 )
1095 selinux? ( sec-policy/selinux-postgresql )
1096 tcl? ( >=dev-lang/tcl-8 )
1097 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
1098
1099 DEPEND="${RDEPEND}
1100 sys-devel/flex
1101 xml? ( dev-util/pkgconfig )"
1102
1103 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
1104
1105 pkg_setup() {
1106 enewgroup postgres 70
1107 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
1108 }
1109
1110 src_prepare() {
1111 epatch "${WORKDIR}/autoconf.patch" "${WORKDIR}/bool.patch" \
1112 "${WORKDIR}/darwin.patch" "${WORKDIR}/pg_ctl-exit-status.patch" \
1113 "${WORKDIR}/server.patch" "${WORKDIR}/SuperH.patch"
1114
1115 eprefixify src/include/pg_config_manual.h
1116
1117 if use test ; then
1118 epatch "${WORKDIR}/regress.patch"
1119 sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress.c
1120 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \
1121 -i src/test/regress/{input,output}/tablespace.source
1122 else
1123 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
1124 fi
1125
1126 eautoconf
1127 }
1128
1129 src_configure() {
1130 # eval is needed to get along with pg_config quotation of space-rich entities.
1131 eval econf "$(${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
1132 --with-includes="${EPREFIX%/}/usr/include/postgresql-${SLOT}/" \
1133 $(use_with perl) \
1134 $(use_with python) \
1135 $(use_with tcl) \
1136 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")"
1137 }
1138
1139 src_compile() {
1140 local bd
1141 for bd in . contrib $(use xml && echo contrib/xml2); do
1142 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1143 emake -C $bd -j1 \
1144 PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
1145 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
1146 NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF}
1147 done
1148 }
1149
1150 src_install() {
1151 if use perl ; then
1152 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
1153 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
1154 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
1155 fi
1156
1157 local bd
1158 for bd in . contrib $(use xml && echo contrib/xml2) ; do
1159 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1160 emake install -C $bd -j1 DESTDIR="${D}" \
1161 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
1162 PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
1163 NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF}
1164 done
1165
1166 rm -r "${ED}/usr/share/postgresql-${SLOT}/man/man7/" "${ED}/usr/share/doc/${PF}/html"
1167 rm "${ED}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,reindexdb,vacuumdb}.1
1168 docompress /usr/share/postgresql-${SLOT}/man/man1
1169
1170 dodoc README HISTORY doc/{README.*,TODO,bug.template}
1171
1172 dodir /etc/eselect/postgresql/slots/${SLOT}
1173 echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \
1174 > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server"
1175
1176 newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT}
1177 newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT}
1178
1179 use pam && pamd_mimic system-auth postgresql auth account session
1180
1181 keepdir /var/run/postgresql
1182 fperms 0770 /var/run/postgresql
1183 use prefix || fowners postgres:postgres /var/run/postgresql
1184 }
1185
1186 pkg_postinst() {
1187 postgresql-config update
1188
1189 elog "The Unix-domain socket is located in:"
1190 elog " ${EROOT%/}/var/run/postgresql/"
1191 elog
1192 elog "If you have users and/or services that you would like to utilize the socket,"
1193 elog "you must add them to the 'postgres' system group:"
1194 elog " usermod -a -G postgres <user>"
1195 elog
1196 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
1197 elog "it contains your preferred locale in:"
1198 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1199 elog
1200 elog "Then, execute the following command to setup the initial database"
1201 elog "environment:"
1202 elog " emerge --config =${CATEGORY}/${PF}"
1203 }
1204
1205 pkg_postrm() {
1206 postgresql-config update
1207 }
1208
1209 pkg_config() {
1210 [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source ${EROOT%/}/etc/conf.d/postgresql-${SLOT}
1211 [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1212 [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
1213
1214 # environment.bz2 may not contain the same locale as the current system
1215 # locale. Unset and source from the current system locale.
1216 if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then
1217 unset LANG
1218 unset LC_CTYPE
1219 unset LC_NUMERIC
1220 unset LC_TIME
1221 unset LC_COLLATE
1222 unset LC_MONETARY
1223 unset LC_MESSAGES
1224 unset LC_ALL
1225 source ${EROOT%/}/etc/env.d/02locale
1226 [[ -n ${LANG} ]] && export LANG
1227 [[ -n ${LC_CTYPE} ]] && export LC_CTYPE
1228 [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC
1229 [[ -n ${LC_TIME} ]] && export LC_TIME
1230 [[ -n ${LC_COLLATE} ]] && export LC_COLLATE
1231 [[ -n ${LC_MONETARY} ]] && export LC_MONETARY
1232 [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES
1233 [[ -n ${LC_ALL} ]] && export LC_ALL
1234 fi
1235
1236 einfo "You can modify the paths and options passed to initdb by editing:"
1237 einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1238 einfo
1239 einfo "Information on options that can be passed to initdb are found at:"
1240 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1241 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1242 einfo
1243 einfo "PG_INITDB_OPTS is currently set to:"
1244 if [[ -z "${PG_INITDB_OPTS}" ]] ; then
1245 einfo " (none)"
1246 else
1247 einfo " ${PG_INITDB_OPTS}"
1248 fi
1249 einfo
1250 einfo "Configuration files will be installed to:"
1251 einfo " ${PGDATA}"
1252 einfo
1253 einfo "The database cluster will be created in:"
1254 einfo " ${DATA_DIR}"
1255 einfo
1256 while [[ $correct != "true" ]] ; do
1257 einfo "Are you ready to continue? (y/n)"
1258 read answer
1259 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
1260 correct="true"
1261 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
1262 die "Aborting initialization."
1263 else
1264 echo "Answer not recognized"
1265 fi
1266 done
1267
1268 if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
1269 eerror "The given directory, '${DATA_DIR}', is not empty."
1270 eerror "Modify DATA_DIR to point to an empty directory."
1271 die "${DATA_DIR} is not empty."
1272 fi
1273
1274 [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128
1275 einfo "Checking system parameters..."
1276
1277 if ! use kernel_linux ; then
1278 einfo "Skipped."
1279 einfo "Tests not supported on this OS (yet)"
1280 else
1281 if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then
1282 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
1283
1284 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
1285 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
1286 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
1287 local SHMMAX=$(sysctl -n kernel.shmmax)
1288
1289 local SEMMSL_MIN=17
1290 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
1291 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
1292 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
1293
1294 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
1295 if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then
1296 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
1297 eerror "You have now several options:"
1298 eerror " - Change the mentioned system parameter"
1299 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
1300 eerror " value lower than ${PG_MAX_CONNECTIONS}"
1301 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
1302 eerror "More information can be found here:"
1303 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
1304 die "System test failed."
1305 fi
1306 done
1307 einfo "Passed."
1308 else
1309 ewarn "SKIP_SYSTEM_TESTS set, so skipping."
1310 fi
1311 fi
1312
1313 if [[ ${EUID} == 0 ]] ; then
1314 einfo "Creating the data directory ..."
1315 mkdir -p "${DATA_DIR}"
1316 chown -Rf postgres:postgres "${DATA_DIR}"
1317 chmod 0700 "${DATA_DIR}"
1318 fi
1319
1320 einfo "Initializing the database ..."
1321 if [[ ${EUID} == 0 ]] ; then
1322 su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
1323 else
1324 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
1325 fi
1326 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
1327
1328 einfo "The autovacuum function, which was in contrib, has been moved to the main"
1329 einfo "PostgreSQL functions starting with 8.1."
1330 einfo "You can enable it in the cluster's:"
1331 einfo " ${PGDATA%/}/postgresql.conf"
1332 einfo
1333 einfo "The PostgreSQL server, by default, will log events to:"
1334 einfo " ${DATA_DIR%/}/postmaster.log"
1335 einfo
1336 if use prefix ; then
1337 einfo "The location of the configuration files have moved to:"
1338 einfo " ${PGDATA}"
1339 einfo
1340 einfo "To start the server:"
1341 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
1342 einfo
1343 einfo "To stop:"
1344 einfo " pg_ctl stop -D ${DATA_DIR}"
1345 einfo
1346 einfo "Or move the configuration files back:"
1347 einfo " mv ${PGDATA}*.conf ${DATA_DIR}"
1348 else
1349 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1350 einfo "instead of 'pg_ctl'."
1351 fi
1352 }
1353
1354 src_test() {
1355 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1356
1357 if [[ ${UID} != 0 ]] ; then
1358 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/:${PATH}" \
1359 emake check \
1360 PGXS=$("${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
1361 NO_PGXS=0 USE_PGXS=1 SLOT="${SLOT}"
1362
1363 einfo "If you think other tests besides the regression tests are necessary, please"
1364 einfo "submit a bug including a patch for this ebuild to enable them."
1365 else
1366 ewarn "Tests cannot be run as root. Skipping."
1367 ewarn "HINT: FEATURES=\"userpriv\""
1368 fi
1369 }
1370
1371
1372
1373 1.1 dev-db/postgresql-server/postgresql-server-8.4.9.ebuild
1374
1375 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.9.ebuild?rev=1.1&view=markup
1376 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.9.ebuild?rev=1.1&content-type=text/plain
1377
1378 Index: postgresql-server-8.4.9.ebuild
1379 ===================================================================
1380 # Copyright 1999-2011 Gentoo Foundation
1381 # Distributed under the terms of the GNU General Public License v2
1382 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.9.ebuild,v 1.1 2011/09/26 18:02:15 patrick Exp $
1383
1384 EAPI="3"
1385 PYTHON_DEPEND="python? 2"
1386
1387 WANT_AUTOMAKE="none"
1388 inherit autotools eutils multilib pam prefix python versionator
1389
1390 SLOT="$(get_version_component_range 1-2)"
1391
1392 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
1393
1394 DESCRIPTION="PostgreSQL server"
1395 HOMEPAGE="http://www.postgresql.org/"
1396 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2
1397 http://dev.gentoo.org/~titanofold/postgresql-patches-${SLOT}-r1.tbz2
1398 http://dev.gentoo.org/~titanofold/postgresql-initscript-1.2.tbz2"
1399 LICENSE="POSTGRESQL"
1400
1401 S="${WORKDIR}/postgresql-${PV}"
1402
1403 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"
1404 IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml"
1405
1406 for lingua in ${LINGUAS} ; do
1407 IUSE+=" linguas_${lingua}"
1408 done
1409
1410 wanted_languages() {
1411 local enable_langs
1412
1413 for lingua in ${LINGUAS} ; do
1414 use linguas_${lingua} && enable_langs+="${lingua} "
1415 done
1416
1417 echo -n ${enable_langs}
1418 }
1419
1420 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=]
1421 perl? ( >=dev-lang/perl-5.8 )
1422 selinux? ( sec-policy/selinux-postgresql )
1423 tcl? ( >=dev-lang/tcl-8 )
1424 uuid? ( dev-libs/ossp-uuid )
1425 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
1426
1427 DEPEND="${RDEPEND}
1428 sys-devel/flex
1429 xml? ( dev-util/pkgconfig )"
1430
1431 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
1432
1433 pkg_setup() {
1434 enewgroup postgres 70
1435 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
1436
1437 use python && python_set_active_version 2
1438 }
1439
1440 src_prepare() {
1441 epatch "${WORKDIR}/autoconf.patch" "${WORKDIR}/bool.patch" \
1442 "${WORKDIR}/darwin.patch" "${WORKDIR}/ldflags.patch" \
1443 "${WORKDIR}/pg_ctl-exit-status.patch" "${WORKDIR}/server.patch" \
1444 "${WORKDIR}/SuperH.patch"
1445
1446 eprefixify src/include/pg_config_manual.h
1447
1448 if use test ; then
1449 epatch "${WORKDIR}/regress.patch"
1450 sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c
1451 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \
1452 -i src/test/regress/{input,output}/tablespace.source
1453 else
1454 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
1455 fi
1456
1457 eautoconf
1458 }
1459
1460 src_configure() {
1461 # eval is needed to get along with pg_config quotation of space-rich entities.
1462 eval econf "$(${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
1463 --with-includes="${EPREFIX%/}/usr/include/postgresql-${SLOT}/" \
1464 --with-libraries="${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
1465 --with-system-tzdata="${EPREFIX%/}/usr/share/zoneinfo" \
1466 $(use_with perl) \
1467 $(use_with python) \
1468 $(use_with tcl) \
1469 $(use_with xml libxml) \
1470 $(use_with xml libxslt) \
1471 $(use_with uuid ossp-uuid) \
1472 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")"
1473 }
1474
1475 src_compile() {
1476 local bd
1477 for bd in . contrib $(use xml && echo contrib/xml2) ; do
1478 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1479 emake -C $bd -j1 || die "emake in $bd failed"
1480 done
1481 }
1482
1483 src_install() {
1484 if use perl ; then
1485 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
1486 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
1487 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
1488 fi
1489
1490 local bd
1491 for bd in . contrib $(use xml && echo contrib/xml2) ; do
1492 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1493 emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
1494 done
1495
1496 rm -r "${ED}/usr/share/postgresql-${SLOT}/man/man7/" "${ED}/usr/share/doc/postgresql-${SLOT}/html"
1497 rm "${ED}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,reindexdb,vacuumdb}.1
1498
1499 dodoc README HISTORY doc/{README.*,TODO,bug.template}
1500
1501 dodir /etc/eselect/postgresql/slots/${SLOT}
1502 echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \
1503 > "${ED}/etc/eselect/postgresql/slots/${SLOT}/server"
1504
1505 sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.confd
1506 newconfd "${WORKDIR}"/postgresql.confd postgresql-${SLOT} || die "Inserting conf.d file failed"
1507 sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.init
1508 newinitd "${WORKDIR}"/postgresql.init postgresql-${SLOT} || die "Inserting init.d file failed"
1509
1510 use pam && pamd_mimic system-auth postgresql auth account session
1511
1512 keepdir /var/run/postgresql
1513 fperms 0770 /var/run/postgresql
1514 use prefix || fowners postgres:postgres /var/run/postgresql
1515 }
1516
1517 pkg_postinst() {
1518 postgresql-config update
1519
1520 elog "The time stamp format is 64 bit integers now. If you upgrade from older"
1521 elog "databases, this may force you to either do a dump and reload of enable"
1522 elog "pg_legacytimestamp until you find time to do so. If the database can't start"
1523 elog "please try enabling pg_legacytimestamp and rebuild."
1524 elog
1525 elog "The Unix-domain socket is located in:"
1526 elog " ${EROOT%/}/var/run/postgresql/"
1527 elog
1528 elog "If you have users and/or services that you would like to utilize the socket,"
1529 elog "you must add them to the 'postgres' system group:"
1530 elog " usermod -a -G postgres <user>"
1531 elog
1532 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
1533 elog "it contains your preferred locale and character encoding in:"
1534 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1535 elog
1536 elog "Then, execute the following command to setup the initial database"
1537 elog "environment:"
1538 elog " emerge --config =${CATEGORY}/${PF}"
1539 }
1540
1541 pkg_postrm() {
1542 postgresql-config update
1543 }
1544
1545 pkg_config() {
1546 [[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1547 [[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1548 [[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
1549
1550 # environment.bz2 may not contain the same locale as the current system
1551 # locale. Unset and source from the current system locale.
1552 if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then
1553 unset LANG
1554 unset LC_CTYPE
1555 unset LC_NUMERIC
1556 unset LC_TIME
1557 unset LC_COLLATE
1558 unset LC_MONETARY
1559 unset LC_MESSAGES
1560 unset LC_ALL
1561 source "${EROOT%/}/etc/env.d/02locale"
1562 [[ -n ${LANG} ]] && export LANG
1563 [[ -n ${LC_CTYPE} ]] && export LC_CTYPE
1564 [[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC
1565 [[ -n ${LC_TIME} ]] && export LC_TIME
1566 [[ -n ${LC_COLLATE} ]] && export LC_COLLATE
1567 [[ -n ${LC_MONETARY} ]] && export LC_MONETARY
1568 [[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES
1569 [[ -n ${LC_ALL} ]] && export LC_ALL
1570 fi
1571
1572 einfo "You can modify the paths and options passed to initdb by editing:"
1573 einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1574 einfo
1575 einfo "Information on options that can be passed to initdb are found at:"
1576 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1577 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1578 einfo
1579 einfo "PG_INITDB_OPTS is currently set to:"
1580 if [[ -z ${PG_INITDB_OPTS} ]] ; then
1581 einfo " (none)"
1582 else
1583 einfo " ${PG_INITDB_OPTS}"
1584 fi
1585 einfo
1586 einfo "Configuration files will be installed to:"
1587 einfo " ${PGDATA}"
1588 einfo
1589 einfo "The database cluster will be created in:"
1590 einfo " ${DATA_DIR}"
1591 einfo
1592 while [[ $correct != "true" ]] ; do
1593 einfo "Are you ready to continue? (y/n)"
1594 read answer
1595 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
1596 correct="true"
1597 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
1598 die "Aborting initialization."
1599 else
1600 echo "Answer not recognized"
1601 fi
1602 done
1603
1604 if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then
1605 eerror "The given directory, '${DATA_DIR}', is not empty."
1606 eerror "Modify DATA_DIR to point to an empty directory."
1607 die "${DATA_DIR} is not empty."
1608 fi
1609
1610 [[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128
1611 einfo "Checking system parameters..."
1612
1613 if ! use kernel_linux ; then
1614 einfo "Skipped."
1615 einfo " Tests not supported on this OS (yet)"
1616 else
1617 if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then
1618 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
1619
1620 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
1621 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
1622 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
1623 local SHMMAX=$(sysctl -n kernel.shmmax)
1624
1625 local SEMMSL_MIN=17
1626 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
1627 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
1628 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
1629
1630 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
1631 if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then
1632 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
1633 eerror "You have now several options:"
1634 eerror " - Change the mentioned system parameter"
1635 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
1636 eerror " value lower than ${PG_MAX_CONNECTIONS}"
1637 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
1638 eerror "More information can be found here:"
1639 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
1640 die "System test failed."
1641 fi
1642 done
1643 einfo "Passed."
1644 else
1645 ewarn "SKIP_SYSTEM_TESTS set, so skipping."
1646 fi
1647 fi
1648
1649 if [[ ${EUID} == 0 ]] ; then
1650 einfo "Creating the data directory ..."
1651 mkdir -p "${DATA_DIR}"
1652 chown -Rf postgres:postgres "${DATA_DIR}"
1653 chmod 0700 "${DATA_DIR}"
1654 fi
1655
1656 einfo "Initializing the database ..."
1657 if [[ ${EUID} == 0 ]] ; then
1658 su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
1659 else
1660 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
1661 fi
1662 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
1663
1664 einfo "The autovacuum function, which was in contrib, has been moved to the main"
1665 einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled by"
1666 einfo "default. You can disable it in the cluster's:"
1667 einfo " ${PGDATA%/}/postgresql.conf"
1668 einfo
1669 einfo "The PostgreSQL server, by default, will log events to:"
1670 einfo " ${DATA_DIR%/}/postmaster.log"
1671 einfo
1672 if use prefix ; then
1673 einfo "The location of the configuration files have moved to:"
1674 einfo " ${PGDATA}"
1675 einfo
1676 einfo "To start the server:"
1677 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
1678 einfo
1679 einfo "To stop:"
1680 einfo " pg_ctl stop -D ${DATA_DIR}"
1681 einfo
1682 einfo "Or move the configuration files back:"
1683 einfo " mv ${PGDATA}*.conf ${DATA_DIR}"
1684 else
1685 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1686 einfo "instead of 'pg_ctl'."
1687 fi
1688 }
1689
1690 src_test() {
1691 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1692
1693 if [[ ${UID} != 0 ]] ; then
1694 emake check || die "Make check failed. See above for details."
1695
1696 einfo "If you think other tests besides the regression tests are necessary, please"
1697 einfo "submit a bug including a patch for this ebuild to enable them."
1698 else
1699 ewarn "Tests cannot be run as root. Skipping."
1700 ewarn "HINT: FEATURES=\"userpriv\""
1701 fi
1702 }