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