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