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