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