Gentoo Archives: gentoo-commits

From: "Caleb Tennis (caleb)" <caleb@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-db/postgresql-server: ChangeLog postgresql-server-8.2.10.ebuild postgresql-server-8.3.4.ebuild
Date: Tue, 23 Sep 2008 12:42:15
Message-Id: E1Ki7DY-00074N-7l@stork.gentoo.org
1 caleb 08/09/23 12:42:12
2
3 Modified: ChangeLog
4 Added: postgresql-server-8.2.10.ebuild
5 postgresql-server-8.3.4.ebuild
6 Log:
7 version bump, latest unstable versions
8 (Portage version: 2.2_rc8/cvs/Linux 2.6.21-gentoo-r1 i686)
9
10 Revision Changes Path
11 1.10 dev-db/postgresql-server/ChangeLog
12
13 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.10&view=markup
14 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.10&content-type=text/plain
15 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/ChangeLog?r1=1.9&r2=1.10
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v
20 retrieving revision 1.9
21 retrieving revision 1.10
22 diff -u -r1.9 -r1.10
23 --- ChangeLog 5 Aug 2008 16:48:34 -0000 1.9
24 +++ ChangeLog 23 Sep 2008 12:42:11 -0000 1.10
25 @@ -1,6 +1,13 @@
26 # ChangeLog for dev-db/postgresql-server
27 # Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.9 2008/08/05 16:48:34 ulm Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.10 2008/09/23 12:42:11 caleb Exp $
30 +
31 +*postgresql-server-8.3.4 (23 Sep 2008)
32 +*postgresql-server-8.2.10 (23 Sep 2008)
33 +
34 + 23 Sep 2008; Caleb Tennis <caleb@g.o>
35 + +postgresql-server-8.2.10.ebuild, +postgresql-server-8.3.4.ebuild:
36 + version bump, latest unstable versions
37
38 05 Aug 2008; Ulrich Mueller <ulm@g.o> metadata.xml:
39 Add USE flag description to metadata wrt GLEP 56.
40
41
42
43 1.1 dev-db/postgresql-server/postgresql-server-8.2.10.ebuild
44
45 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.10.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.10.ebuild?rev=1.1&content-type=text/plain
47
48 Index: postgresql-server-8.2.10.ebuild
49 ===================================================================
50 # Copyright 1999-2008 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.10.ebuild,v 1.1 2008/09/23 12:42:11 caleb 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.3.4.ebuild
299
300 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.4.ebuild?rev=1.1&view=markup
301 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.4.ebuild?rev=1.1&content-type=text/plain
302
303 Index: postgresql-server-8.3.4.ebuild
304 ===================================================================
305 # Copyright 1999-2008 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.3.4.ebuild,v 1.1 2008/09/23 12:42:11 caleb 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="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
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 uuid 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 uuid? ( dev-libs/ossp-uuid )
341 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
342 DEPEND="${RDEPEND}
343 sys-devel/flex
344 xml? ( dev-util/pkgconfig )"
345 PDEPEND="doc? ( dev-db/postgresql-docs:${SLOT} )"
346
347 S="${WORKDIR}/postgresql-${PV}"
348
349 pkg_setup() {
350 enewgroup postgres 70
351 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
352 }
353
354 src_unpack() {
355 unpack ${A}
356 cd "${S}"
357
358 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
359 "${FILESDIR}/postgresql-${SLOT}-server.patch"
360
361 if hasq test ${FEATURES}; then
362 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
363 else
364 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
365 fi
366
367 eautoconf
368 }
369
370 src_compile() {
371 # TODO: test if PPC really cannot work with other CFLAGS settings
372 # use ppc && CFLAGS="-pipe -fsigned-char"
373
374 # eval is needed to get along with pg_config quotation of space-rich entities.
375 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
376 --disable-thread-safety \
377 $(use_with perl) \
378 $(use_with python) \
379 $(use_with tcl) \
380 $(use_with xml libxml) \
381 $(use_with xml libxslt) \
382 $(use_with uuid ossp-uuid) \
383 --with-system-tzdata="/usr/share/zoneinfo" \
384 --with-includes="/usr/include/postgresql-${SLOT}/" \
385 "$(built_with_use ~dev-db/postgresql-base-${PV} nls && use_enable nls nls "$(wanted_languages)")" \
386 || die "configure failed"
387
388 for bd in . contrib $(use xml && echo contrib/xml2); do
389 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
390 emake -C $bd -j1 LD="$(tc-getLD) $(get_abi_LDFLAGS)" \
391 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
392 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
393 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
394 done
395 }
396
397 src_install() {
398 if use perl ; then
399 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
400 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
401 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
402 fi
403
404 for bd in . contrib $(use xml && echo contrib/xml2) ; do
405 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
406 emake install -C $bd -j1 DESTDIR="${D}" \
407 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
408 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
409 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
410 done
411
412 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
413 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
414
415 dodoc README HISTORY doc/{README.*,TODO,bug.template}
416
417 dodir /etc/eselect/postgresql/slots/${SLOT}
418 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
419 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
420 postgres_service="postgresql-${SLOT}"
421 __EOF__
422
423 newinitd "${FILESDIR}/postgresql.init-${SLOT}" postgresql-${SLOT} || die "Inserting init.d-file failed"
424 newconfd "${FILESDIR}/postgresql.conf-${SLOT}" postgresql-${SLOT} || die "Inserting conf.d-file failed"
425
426 keepdir /var/run/postgresql
427 fperms 0770 /var/run/postgresql
428 fowners postgres:postgres /var/run/postgresql
429 }
430
431 pkg_postinst() {
432 eselect postgresql update
433 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
434 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
435
436 ewarn "Please note that the standard location of the socket has changed from /tmp"
437 ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
438 ewarn "the socket."
439 ewarn "This can break applications which have the standard location hard-coded."
440 ewarn "If such an application links against the libpq, please re-emerge it,"
441 ewarn "if that doesn't help or the application accesses the socket without using libpq,"
442 ewarn "please file a bug-report."
443 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."
444
445 elog "Execute the following command to setup the initial database environment:"
446 elog
447 elog "emerge --config =${CATEGORY}/${PF}"
448 elog
449 elog "The autovacuum function, which was in contrib, has been moved to the main"
450 elog "PostgreSQL functions starting with 8.1."
451 elog "You can enable it in the clusters postgresql.conf."
452 }
453
454 pkg_postrm() {
455 eselect postgresql update
456 }
457
458 pkg_config() {
459 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
460
461 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
462 einfo "More information can be found here:"
463 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
464 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
465 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
466 einfo
467 einfo "You can change the directory where the database cluster is being created by setting"
468 einfo "the PGDATA variable."
469 einfo
470 einfo "PG_INITDB_OPTS is currently set to:"
471 einfo " \"${PG_INITDB_OPTS}\""
472 einfo "and the database cluster will be created in:"
473 einfo " \"${PGDATA}\""
474 einfo "Are you ready to continue? (Y/n)"
475 read answer
476 [ -z $answer ] && answer=Y
477 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
478
479 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
480 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
481 die "cluster already exists"
482 fi
483
484 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
485 einfo "Checking system parameters..."
486
487 if ! use kernel_linux ; then
488 SKIP_SYSTEM_TESTS=yes
489 einfo " Tests not supported on this OS (yet)"
490 fi
491
492 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
493 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
494
495 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
496 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
497 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
498 local SHMMAX=$(sysctl -n kernel.shmmax)
499
500 local SEMMSL_MIN=17
501 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
502 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
503 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
504
505 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
506 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
507 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
508 eerror "You have now several options:"
509 eerror " - Change the mentioned system parameter"
510 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
511 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
512 eerror "More information can be found here:"
513 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
514 die "system test failed"
515 fi
516 done
517 einfo "Passed."
518 else
519 einfo "Skipped."
520 fi
521
522 einfo "Creating the data directory ..."
523 mkdir -p "${PGDATA}"
524 chown -Rf postgres:postgres "${PGDATA}"
525 chmod 0700 "${PGDATA}"
526
527 einfo "Initializing the database ..."
528
529 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
530
531 einfo
532 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
533 einfo
534
535 if [ "${PGDATA}" != "/var/lib/postgresql/${SLOT}/data" ] ; then
536 ewarn "You didn't install the database cluster in the standard location, please make sure that you set"
537 ewarn "PGDATA=\"${PGDATA}\" in the appropriate conf.d file (probably /etc/conf.d/postgresql-${SLOT})"
538 fi
539 }
540
541 src_test() {
542 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
543 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
544 emake -j1 check \
545 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
546 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
547
548 einfo "Yes, there are other tests which could be run."
549 einfo "... and no, we don't plan to add/support them."
550 einfo "For now, the main regressions tests will suffice."
551 einfo "If you think other tests are necessary, please submit a"
552 einfo "bug including a patch for this ebuild to enable them."
553 }