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