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.1.ebuild ChangeLog postgresql-server-8.3.8.ebuild
Date: Wed, 09 Sep 2009 22:14:24
Message-Id: E1MlVQk-0000xb-AH@stork.gentoo.org
1 patrick 09/09/09 22:14:22
2
3 Modified: ChangeLog
4 Added: postgresql-server-8.4.1.ebuild
5 postgresql-server-8.3.8.ebuild
6 Log:
7 Bump to 8.4.1 and 8.3.8
8 (Portage version: 2.2_rc40/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.19 dev-db/postgresql-server/ChangeLog
12
13 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.19&view=markup
14 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.19&content-type=text/plain
15 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/ChangeLog?r1=1.18&r2=1.19
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v
20 retrieving revision 1.18
21 retrieving revision 1.19
22 diff -u -r1.18 -r1.19
23 --- ChangeLog 9 Sep 2009 21:41:26 -0000 1.18
24 +++ ChangeLog 9 Sep 2009 22:14:22 -0000 1.19
25 @@ -1,6 +1,13 @@
26 # ChangeLog for dev-db/postgresql-server
27 # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.18 2009/09/09 21:41:26 patrick Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.19 2009/09/09 22:14:22 patrick Exp $
30 +
31 +*postgresql-server-8.4.1 (09 Sep 2009)
32 +*postgresql-server-8.3.8 (09 Sep 2009)
33 +
34 + 09 Sep 2009; Patrick Lauer <patrick@g.o>
35 + +postgresql-server-8.3.8.ebuild, +postgresql-server-8.4.1.ebuild:
36 + Bump to 8.4.1 and 8.3.8
37
38 *postgresql-server-8.4.0 (09 Sep 2009)
39
40
41
42
43 1.1 dev-db/postgresql-server/postgresql-server-8.4.1.ebuild
44
45 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.1.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.1.ebuild?rev=1.1&content-type=text/plain
47
48 Index: postgresql-server-8.4.1.ebuild
49 ===================================================================
50 # Copyright 1999-2009 Gentoo Foundation
51 # Distributed under the terms of the GNU General Public License v2
52 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.1.ebuild,v 1.1 2009/09/09 22:14:22 patrick Exp $
53
54 EAPI="1"
55
56 # weird test failures.
57 RESTRICT="test"
58
59 WANT_AUTOCONF="latest"
60 WANT_AUTOMAKE="none"
61 inherit eutils multilib toolchain-funcs versionator autotools
62
63 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
64
65 DESCRIPTION="PostgreSQL server"
66 HOMEPAGE="http://www.postgresql.org/"
67 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
68 LICENSE="POSTGRESQL"
69 SLOT="$(get_version_component_range 1-2)"
70 IUSE_LINGUAS="
71 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
72 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
73 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
74 linguas_tr linguas_zh_CN linguas_zh_TW"
75 IUSE="doc perl python selinux tcl uuid xml nls kernel_linux ${IUSE_LINGUAS}"
76
77 wanted_languages() {
78 for u in ${IUSE_LINGUAS} ; do
79 use $u && echo -n "${u#linguas_} "
80 done
81 }
82
83 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
84 perl? ( >=dev-lang/perl-5.6.1-r2 )
85 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
86 selinux? ( sec-policy/selinux-postgresql )
87 tcl? ( >=dev-lang/tcl-8 )
88 uuid? ( dev-libs/ossp-uuid )
89 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
90 DEPEND="${RDEPEND}
91 sys-devel/flex
92 xml? ( dev-util/pkgconfig )"
93 PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"
94
95 S="${WORKDIR}/postgresql-${PV}"
96
97 pkg_setup() {
98 enewgroup postgres 70
99 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
100 }
101
102 src_unpack() {
103 unpack ${A}
104 cd "${S}"
105
106 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
107 "${FILESDIR}/postgresql-${SLOT}-server.patch"
108
109 if hasq test ${FEATURES}; then
110 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
111 else
112 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
113 fi
114
115 eautoconf
116 }
117
118 src_compile() {
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 --disable-thread-safety \
125 $(use_with perl) \
126 $(use_with python) \
127 $(use_with tcl) \
128 $(use_with xml libxml) \
129 $(use_with xml libxslt) \
130 $(use_with uuid ossp-uuid) \
131 --with-system-tzdata="/usr/share/zoneinfo" \
132 --with-includes="/usr/include/postgresql-${SLOT}/" \
133 "$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
134 || die "configure failed"
135
136 for bd in . contrib $(use xml && echo contrib/xml2); do
137 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
138 emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die "emake in $bd failed"
139 done
140 }
141
142 src_install() {
143 if use perl ; then
144 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
145 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
146 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
147 fi
148
149 for bd in . contrib $(use xml && echo contrib/xml2) ; do
150 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
151 emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
152 done
153
154 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/postgresql-${SLOT}/html"
155 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
156
157 dodoc README HISTORY doc/{README.*,TODO,bug.template}
158
159 dodir /etc/eselect/postgresql/slots/${SLOT}
160 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
161 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
162 postgres_service="postgresql-${SLOT}"
163 __EOF__
164
165 newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
166 newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"
167
168 keepdir /var/run/postgresql
169 fperms 0770 /var/run/postgresql
170 fowners postgres:postgres /var/run/postgresql
171 }
172
173 pkg_postinst() {
174 eselect postgresql update
175 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
176 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
177
178 ewarn "Please note that the standard location of the socket has changed from /tmp"
179 ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
180 ewarn "the socket."
181 ewarn "This can break applications which have the standard location hard-coded."
182 ewarn "If such an application links against the libpq, please re-emerge it,"
183 ewarn "if that doesn't help or the application accesses the socket without using libpq,"
184 ewarn "please file a bug-report."
185 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."
186
187 elog "Execute the following command to setup the initial database environment:"
188 elog
189 elog "emerge --config =${CATEGORY}/${PF}"
190 elog
191 elog "The autovacuum function, which was in contrib, has been moved to the main"
192 elog "PostgreSQL functions starting with 8.1."
193 elog "You can enable it in the clusters postgresql.conf."
194 }
195
196 pkg_postrm() {
197 eselect postgresql update
198 }
199
200 pkg_config() {
201 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
202
203 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
204 einfo "More information can be found here:"
205 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
206 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
207 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
208 einfo
209 einfo "You can change the directory where the database cluster is being created by setting"
210 einfo "the PGDATA variable."
211 einfo
212 einfo "PG_INITDB_OPTS is currently set to:"
213 einfo " \"${PG_INITDB_OPTS}\""
214 einfo "and the database cluster will be created in:"
215 einfo " \"${PGDATA}\""
216 einfo "Are you ready to continue? (Y/n)"
217 read answer
218 [ -z $answer ] && answer=Y
219 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
220
221 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
222 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
223 die "cluster already exists"
224 fi
225
226 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
227 einfo "Checking system parameters..."
228
229 if ! use kernel_linux ; then
230 SKIP_SYSTEM_TESTS=yes
231 einfo " Tests not supported on this OS (yet)"
232 fi
233
234 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
235 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
236
237 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
238 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
239 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
240 local SHMMAX=$(sysctl -n kernel.shmmax)
241
242 local SEMMSL_MIN=17
243 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
244 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
245 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
246
247 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
248 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
249 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
250 eerror "You have now several options:"
251 eerror " - Change the mentioned system parameter"
252 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
253 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
254 eerror "More information can be found here:"
255 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
256 die "system test failed"
257 fi
258 done
259 einfo "Passed."
260 else
261 einfo "Skipped."
262 fi
263
264 einfo "Creating the data directory ..."
265 mkdir -p "${PGDATA}"
266 chown -Rf postgres:postgres "${PGDATA}"
267 chmod 0700 "${PGDATA}"
268
269 einfo "Initializing the database ..."
270
271 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
272
273 einfo
274 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
275 einfo
276
277 if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
278 ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
279 ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
280 fi
281 }
282
283 src_test() {
284 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
285 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
286 emake -j1 check || die "Make check failed. See above for details."
287
288 einfo "Yes, there are other tests which could be run."
289 einfo "... and no, we don't plan to add/support them."
290 einfo "For now, the main regressions tests will suffice."
291 einfo "If you think other tests are necessary, please submit a"
292 einfo "bug including a patch for this ebuild to enable them."
293 }
294
295
296
297 1.1 dev-db/postgresql-server/postgresql-server-8.3.8.ebuild
298
299 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.8.ebuild?rev=1.1&view=markup
300 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.8.ebuild?rev=1.1&content-type=text/plain
301
302 Index: postgresql-server-8.3.8.ebuild
303 ===================================================================
304 # Copyright 1999-2009 Gentoo Foundation
305 # Distributed under the terms of the GNU General Public License v2
306 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.8.ebuild,v 1.1 2009/09/09 22:14:22 patrick Exp $
307
308 EAPI="1"
309
310 WANT_AUTOCONF="latest"
311 WANT_AUTOMAKE="none"
312 inherit eutils multilib toolchain-funcs versionator autotools
313
314 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
315
316 DESCRIPTION="PostgreSQL server"
317 HOMEPAGE="http://www.postgresql.org/"
318 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
319 LICENSE="POSTGRESQL"
320 SLOT="$(get_version_component_range 1-2)"
321 IUSE_LINGUAS="
322 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
323 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
324 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
325 linguas_tr linguas_zh_CN linguas_zh_TW"
326 IUSE="doc perl python selinux tcl uuid xml nls kernel_linux ${IUSE_LINGUAS}"
327
328 wanted_languages() {
329 for u in ${IUSE_LINGUAS} ; do
330 use $u && echo -n "${u#linguas_} "
331 done
332 }
333
334 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
335 perl? ( >=dev-lang/perl-5.6.1-r2 )
336 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
337 selinux? ( sec-policy/selinux-postgresql )
338 tcl? ( >=dev-lang/tcl-8 )
339 uuid? ( dev-libs/ossp-uuid )
340 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
341 DEPEND="${RDEPEND}
342 sys-devel/flex
343 xml? ( dev-util/pkgconfig )"
344 PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"
345
346 S="${WORKDIR}/postgresql-${PV}"
347
348 pkg_setup() {
349 enewgroup postgres 70
350 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
351 }
352
353 src_unpack() {
354 unpack ${A}
355 cd "${S}"
356
357 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
358 "${FILESDIR}/postgresql-${SLOT}-server.patch"
359
360 if hasq test ${FEATURES}; then
361 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
362 else
363 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
364 fi
365
366 eautoconf
367 }
368
369 src_compile() {
370 # TODO: test if PPC really cannot work with other CFLAGS settings
371 # use ppc && CFLAGS="-pipe -fsigned-char"
372
373 # eval is needed to get along with pg_config quotation of space-rich entities.
374 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
375 --disable-thread-safety \
376 $(use_with perl) \
377 $(use_with python) \
378 $(use_with tcl) \
379 $(use_with xml libxml) \
380 $(use_with xml libxslt) \
381 $(use_with uuid ossp-uuid) \
382 --with-system-tzdata="/usr/share/zoneinfo" \
383 --with-includes="/usr/include/postgresql-${SLOT}/" \
384 "$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
385 || die "configure failed"
386
387 for bd in . contrib $(use xml && echo contrib/xml2); do
388 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
389 emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
390 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
391 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
392 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
393 done
394 }
395
396 src_install() {
397 if use perl ; then
398 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
399 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
400 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
401 fi
402
403 for bd in . contrib $(use xml && echo contrib/xml2) ; do
404 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
405 emake install -C $bd -j1 DESTDIR="${D}" \
406 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
407 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
408 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
409 done
410
411 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
412 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
413
414 dodoc README HISTORY doc/{README.*,TODO,bug.template}
415
416 dodir /etc/eselect/postgresql/slots/${SLOT}
417 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
418 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
419 postgres_service="postgresql-${SLOT}"
420 __EOF__
421
422 newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
423 newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"
424
425 keepdir /var/run/postgresql
426 fperms 0770 /var/run/postgresql
427 fowners postgres:postgres /var/run/postgresql
428 }
429
430 pkg_postinst() {
431 eselect postgresql update
432 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
433 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
434
435 ewarn "Please note that the standard location of the socket has changed from /tmp"
436 ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
437 ewarn "the socket."
438 ewarn "This can break applications which have the standard location hard-coded."
439 ewarn "If such an application links against the libpq, please re-emerge it,"
440 ewarn "if that doesn't help or the application accesses the socket without using libpq,"
441 ewarn "please file a bug-report."
442 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."
443
444 elog "Execute the following command to setup the initial database environment:"
445 elog
446 elog "emerge --config =${CATEGORY}/${PF}"
447 elog
448 elog "The autovacuum function, which was in contrib, has been moved to the main"
449 elog "PostgreSQL functions starting with 8.1."
450 elog "You can enable it in the clusters postgresql.conf."
451 }
452
453 pkg_postrm() {
454 eselect postgresql update
455 }
456
457 pkg_config() {
458 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
459
460 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
461 einfo "More information can be found here:"
462 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
463 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
464 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
465 einfo
466 einfo "You can change the directory where the database cluster is being created by setting"
467 einfo "the PGDATA variable."
468 einfo
469 einfo "PG_INITDB_OPTS is currently set to:"
470 einfo " \"${PG_INITDB_OPTS}\""
471 einfo "and the database cluster will be created in:"
472 einfo " \"${PGDATA}\""
473 einfo "Are you ready to continue? (Y/n)"
474 read answer
475 [ -z $answer ] && answer=Y
476 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
477
478 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
479 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
480 die "cluster already exists"
481 fi
482
483 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
484 einfo "Checking system parameters..."
485
486 if ! use kernel_linux ; then
487 SKIP_SYSTEM_TESTS=yes
488 einfo " Tests not supported on this OS (yet)"
489 fi
490
491 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
492 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
493
494 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
495 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
496 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
497 local SHMMAX=$(sysctl -n kernel.shmmax)
498
499 local SEMMSL_MIN=17
500 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
501 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
502 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
503
504 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
505 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
506 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
507 eerror "You have now several options:"
508 eerror " - Change the mentioned system parameter"
509 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
510 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
511 eerror "More information can be found here:"
512 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
513 die "system test failed"
514 fi
515 done
516 einfo "Passed."
517 else
518 einfo "Skipped."
519 fi
520
521 einfo "Creating the data directory ..."
522 mkdir -p "${PGDATA}"
523 chown -Rf postgres:postgres "${PGDATA}"
524 chmod 0700 "${PGDATA}"
525
526 einfo "Initializing the database ..."
527
528 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
529
530 einfo
531 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
532 einfo
533
534 if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
535 ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
536 ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
537 fi
538 }
539
540 src_test() {
541 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
542 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
543 emake -j1 check \
544 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
545 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
546
547 einfo "Yes, there are other tests which could be run."
548 einfo "... and no, we don't plan to add/support them."
549 einfo "For now, the main regressions tests will suffice."
550 einfo "If you think other tests are necessary, please submit a"
551 einfo "bug including a patch for this ebuild to enable them."
552 }