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: ChangeLog postgresql-server-8.3.14.ebuild postgresql-server-8.4.7.ebuild postgresql-server-8.2.20.ebuild postgresql-server-9.0.3.ebuild
Date: Mon, 31 Jan 2011 17:44:59
Message-Id: 20110131174448.CDE5A20054@flycatcher.gentoo.org
1 patrick 11/01/31 17:44:48
2
3 Modified: ChangeLog
4 Added: postgresql-server-8.3.14.ebuild
5 postgresql-server-8.4.7.ebuild
6 postgresql-server-8.2.20.ebuild
7 postgresql-server-9.0.3.ebuild
8 Log:
9 Bump
10
11 (Portage version: 2.2.0_alpha19/cvs/Linux x86_64)
12
13 Revision Changes Path
14 1.99 dev-db/postgresql-server/ChangeLog
15
16 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.99&view=markup
17 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.99&content-type=text/plain
18 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?r1=1.98&r2=1.99
19
20 Index: ChangeLog
21 ===================================================================
22 RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v
23 retrieving revision 1.98
24 retrieving revision 1.99
25 diff -u -r1.98 -r1.99
26 --- ChangeLog 31 Jan 2011 16:41:47 -0000 1.98
27 +++ ChangeLog 31 Jan 2011 17:44:48 -0000 1.99
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.98 2011/01/31 16:41:47 patrick Exp $
32 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.99 2011/01/31 17:44:48 patrick Exp $
33 +
34 +*postgresql-server-9.0.3 (31 Jan 2011)
35 +*postgresql-server-8.4.7 (31 Jan 2011)
36 +*postgresql-server-8.3.14 (31 Jan 2011)
37 +*postgresql-server-8.2.20 (31 Jan 2011)
38 +
39 + 31 Jan 2011; Patrick Lauer <patrick@g.o>
40 + +postgresql-server-8.2.20.ebuild, +postgresql-server-8.3.14.ebuild,
41 + +postgresql-server-8.4.7.ebuild, +postgresql-server-9.0.3.ebuild:
42 + Bump
43
44 31 Jan 2011; Patrick Lauer <patrick@g.o>
45 -postgresql-server-8.1.21-r1.ebuild, -postgresql-server-8.2.17-r1.ebuild,
46
47
48
49 1.1 dev-db/postgresql-server/postgresql-server-8.3.14.ebuild
50
51 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.14.ebuild?rev=1.1&view=markup
52 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.14.ebuild?rev=1.1&content-type=text/plain
53
54 Index: postgresql-server-8.3.14.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.14.ebuild,v 1.1 2011/01/31 17:44:48 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.4.7.ebuild
334
335 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.7.ebuild?rev=1.1&view=markup
336 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.7.ebuild?rev=1.1&content-type=text/plain
337
338 Index: postgresql-server-8.4.7.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.4.7.ebuild,v 1.1 2011/01/31 17:44:48 patrick Exp $
343
344 EAPI="2"
345 PYTHON_DEPEND="python? 2"
346
347 # weird test failures.
348 RESTRICT="test"
349
350 WANT_AUTOMAKE="none"
351 inherit autotools eutils multilib python versionator
352
353 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd"
354
355 DESCRIPTION="PostgreSQL server"
356 HOMEPAGE="http://www.postgresql.org/"
357 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
358 LICENSE="POSTGRESQL"
359 SLOT="$(get_version_component_range 1-2)"
360 IUSE_LINGUAS="
361 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
362 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
363 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
364 linguas_tr linguas_zh_CN linguas_zh_TW"
365 IUSE="pg_legacytimestamp doc perl python selinux tcl uuid xml nls kernel_linux ${IUSE_LINGUAS}"
366
367 wanted_languages() {
368 for u in ${IUSE_LINGUAS} ; do
369 use $u && echo -n "${u#linguas_} "
370 done
371 }
372
373 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pg_legacytimestamp=,nls=]
374 perl? ( >=dev-lang/perl-5.6.1-r2 )
375 python? ( dev-python/egenix-mx-base )
376 selinux? ( sec-policy/selinux-postgresql )
377 tcl? ( >=dev-lang/tcl-8 )
378 uuid? ( dev-libs/ossp-uuid )
379 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
380 DEPEND="${RDEPEND}
381 sys-devel/flex
382 xml? ( dev-util/pkgconfig )"
383 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
384
385 S="${WORKDIR}/postgresql-${PV}"
386
387 pkg_setup() {
388 enewgroup postgres 70
389 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
390
391 if use python; then
392 python_set_active_version 2
393 fi
394 }
395
396 src_prepare() {
397 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
398 "${FILESDIR}/postgresql-${SLOT}-server.patch"
399
400 if use test; then
401 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
402 else
403 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
404 fi
405
406 eautoconf
407 }
408
409 src_configure() {
410 # TODO: test if PPC really cannot work with other CFLAGS settings
411 # use ppc && CFLAGS="-pipe -fsigned-char"
412
413 # eval is needed to get along with pg_config quotation of space-rich entities.
414 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
415 $(use_with perl) \
416 $(use_with python) \
417 $(use_with tcl) \
418 $(use_with xml libxml) \
419 $(use_with xml libxslt) \
420 $(use_with uuid ossp-uuid) \
421 --with-system-tzdata="/usr/share/zoneinfo" \
422 --with-includes="/usr/include/postgresql-${SLOT}/" \
423 --with-libraries="/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
424 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")"
425 }
426
427 src_compile() {
428 local bd
429 for bd in . contrib $(use xml && echo contrib/xml2); do
430 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
431 emake -C $bd -j1 || die "emake in $bd failed"
432 done
433 }
434
435 src_install() {
436 if use perl ; then
437 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
438 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
439 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
440 fi
441
442 for bd in . contrib $(use xml && echo contrib/xml2) ; do
443 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
444 emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
445 done
446
447 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/postgresql-${SLOT}/html"
448 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
449
450 dodoc README HISTORY doc/{README.*,TODO,bug.template}
451
452 dodir /etc/eselect/postgresql/slots/${SLOT}
453 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
454 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
455 postgres_service="postgresql-${SLOT}"
456 __EOF__
457
458 newinitd "${FILESDIR}/postgresql.init-${SLOT}-r1" postgresql-${SLOT} || die "Inserting init.d-file failed"
459 newconfd "${FILESDIR}/postgresql.conf-${SLOT}-r1" postgresql-${SLOT} || die "Inserting conf.d-file failed"
460
461 keepdir /var/run/postgresql
462 fperms 0770 /var/run/postgresql
463 fowners postgres:postgres /var/run/postgresql
464 }
465
466 pkg_postinst() {
467 eselect postgresql update
468 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
469 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
470
471 ewarn "Please note that the standard location of the socket has changed from /tmp to"
472 ewarn "/var/run/postgresql and you have to be in the 'postgres' group to access the"
473 ewarn "socket. This can break applications which have the standard location"
474 ewarn "hard-coded. If such an application links against the libpq, please reemerge"
475 ewarn "it. If that doesn't help or the application accesses the socket without using"
476 ewarn "libpq, please file a bug-report."
477 ewarn
478 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the"
479 ewarn "original location."
480 ewarn
481
482 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
483 elog "contains your preferred locale and character encoding in:"
484 elog
485 elog " /etc/conf.d/postgresql-${SLOT}"
486 elog
487 elog "Then, execute the following command to setup the initial database environment:"
488 elog
489 elog " emerge --config =${CATEGORY}/${PF}"
490 elog
491 elog "The autovacuum function, which was in contrib, has been moved to the main"
492 elog "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled by"
493 elog "default. You can disable it in the cluster's postgresql.conf."
494 elog
495 elog "The timestamp format is 64 bit integers now. If you upgrade from older"
496 elog "databases, this may force you to either do a dump and reload or enable"
497 elog "pg_legacytimestamp until you find time to do so. If the database can't start"
498 elog "please try enabling pg_legacytimestamp and rebuild."
499 }
500
501 pkg_postrm() {
502 eselect postgresql update
503 }
504
505 pkg_config() {
506 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
507 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
508
509 # environment.bz2 may not contain the same locale as the current system
510 # locale. Unset and source from the current system locale.
511 if [ -f /etc/env.d/02locale ]; then
512 unset LANG
513 unset LC_CTYPE
514 unset LC_NUMERIC
515 unset LC_TIME
516 unset LC_COLLATE
517 unset LC_MONETARY
518 unset LC_MESSAGES
519 unset LC_ALL
520 source /etc/env.d/02locale
521 [ -n "${LANG}" ] && export LANG
522 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
523 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
524 [ -n "${LC_TIME}" ] && export LC_TIME
525 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
526 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
527 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
528 [ -n "${LC_ALL}" ] && export LC_ALL
529 fi
530
531 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
532 einfo "More information can be found here:"
533 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
534 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
535 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
536 einfo
537 einfo "You can change the directory where the database cluster is being created by setting"
538 einfo "the PGDATA variable."
539 einfo
540 einfo "PG_INITDB_OPTS is currently set to:"
541 einfo " \"${PG_INITDB_OPTS}\""
542 einfo "and the database cluster will be created in:"
543 einfo " \"${PGDATA}\""
544 einfo "Are you ready to continue? (Y/n)"
545 read answer
546 [ -z $answer ] && answer=Y
547 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
548
549 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
550 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
551 die "cluster already exists"
552 fi
553
554 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
555 einfo "Checking system parameters..."
556
557 if ! use kernel_linux ; then
558 SKIP_SYSTEM_TESTS=yes
559 einfo " Tests not supported on this OS (yet)"
560 fi
561
562 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
563 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
564
565 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
566 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
567 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
568 local SHMMAX=$(sysctl -n kernel.shmmax)
569
570 local SEMMSL_MIN=17
571 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
572 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
573 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
574
575 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
576 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
577 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
578 eerror "You have now several options:"
579 eerror " - Change the mentioned system parameter"
580 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
581 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
582 eerror "More information can be found here:"
583 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
584 die "System test failed."
585 fi
586 done
587 einfo "Passed."
588 else
589 einfo "Skipped."
590 fi
591
592 einfo "Creating the data directory ..."
593 mkdir -p "${PGDATA}"
594 chown -Rf postgres:postgres "${PGDATA}"
595 chmod 0700 "${PGDATA}"
596
597 einfo "Initializing the database ..."
598
599 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
600
601 einfo
602 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
603 einfo "instead of 'pg_ctl'."
604 einfo
605 }
606
607 src_test() {
608 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
609 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
610 emake -j1 check || die "Make check failed. See above for details."
611
612 einfo "Yes, there are other tests which could be run."
613 einfo "... and no, we don't plan to add/support them."
614 einfo "For now, the main regressions tests will suffice. If you think other tests are"
615 einfo "necessary, please submit a bug including a patch for this ebuild to enable them."
616 }
617
618
619
620 1.1 dev-db/postgresql-server/postgresql-server-8.2.20.ebuild
621
622 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.20.ebuild?rev=1.1&view=markup
623 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.20.ebuild?rev=1.1&content-type=text/plain
624
625 Index: postgresql-server-8.2.20.ebuild
626 ===================================================================
627 # Copyright 1999-2011 Gentoo Foundation
628 # Distributed under the terms of the GNU General Public License v2
629 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.20.ebuild,v 1.1 2011/01/31 17:44:48 patrick Exp $
630
631 EAPI="2"
632
633 WANT_AUTOMAKE="none"
634 inherit eutils multilib versionator autotools
635
636 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~s390 ~sh ~sparc ~x86"
637
638 DESCRIPTION="PostgreSQL server"
639 HOMEPAGE="http://www.postgresql.org/"
640 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
641 LICENSE="POSTGRESQL"
642 SLOT="$(get_version_component_range 1-2)"
643 IUSE_LINGUAS="
644 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
645 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
646 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
647 linguas_tr linguas_zh_CN linguas_zh_TW"
648 IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"
649
650 wanted_languages() {
651 for u in ${IUSE_LINGUAS} ; do
652 use $u && echo -n "${u#linguas_} "
653 done
654 }
655
656 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
657 perl? ( >=dev-lang/perl-5.6.1-r2 )
658 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
659 selinux? ( sec-policy/selinux-postgresql )
660 tcl? ( >=dev-lang/tcl-8 )
661 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
662 DEPEND="${RDEPEND}
663 sys-devel/flex
664 xml? ( dev-util/pkgconfig )"
665 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
666
667 S="${WORKDIR}/postgresql-${PV}"
668
669 pkg_setup() {
670 enewgroup postgres 70
671 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
672 }
673
674 src_prepare() {
675
676 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
677 "${FILESDIR}/postgresql-${SLOT}-server.patch"
678
679 if use test; then
680 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
681 else
682 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
683 fi
684
685 eautoconf
686 }
687
688 src_configure() {
689 # TODO: test if PPC really cannot work with other CFLAGS settings
690 # use ppc && CFLAGS="-pipe -fsigned-char"
691
692 # eval is needed to get along with pg_config quotation of space-rich entities.
693 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
694 --disable-thread-safety \
695 $(use_with perl) \
696 $(use_with python) \
697 $(use_with tcl) \
698 --with-includes="/usr/include/postgresql-${SLOT}/" \
699 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")" \
700 || die "configure failed"
701 }
702 src_compile() {
703 for bd in . contrib $(use xml && echo contrib/xml2); do
704 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
705 emake -C $bd -j1 \
706 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
707 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
708 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
709 done
710 }
711
712 src_install() {
713 if use perl ; then
714 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
715 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
716 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
717 fi
718
719 for bd in . contrib $(use xml && echo contrib/xml2) ; do
720 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
721 emake install -C $bd -j1 DESTDIR="${D}" \
722 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
723 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
724 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
725 done
726
727 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
728 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
729
730 dodoc README HISTORY doc/{README.*,TODO,bug.template}
731
732 dodir /etc/eselect/postgresql/slots/${SLOT}
733 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
734 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
735 postgres_service="postgresql-${SLOT}"
736 __EOF__
737
738 newinitd "${FILESDIR}/postgresql.init-${SLOT}-r1" postgresql-${SLOT} || die "Inserting init.d-file failed"
739 newconfd "${FILESDIR}/postgresql.conf-${SLOT}-r1" postgresql-${SLOT} || die "Inserting conf.d-file failed"
740
741 # Workaround for paludis
742 [ -f "${ROOT}/var/run/postgresql/.keep" ] || 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"
753 ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
754 ewarn "the socket."
755 ewarn "This can break applications which have the standard location hard-coded."
756 ewarn "If such an application links against the libpq, please re-emerge it,"
757 ewarn "if that doesn't help or the application accesses the socket without using libpq,"
758 ewarn "please file a bug-report."
759 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."
760
761 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
762 elog "contains your preferred locale in:"
763 elog
764 elog " /etc/conf.d/postgresql-${SLOT}"
765 elog
766 elog "Then, execute the following command to setup the initial database environment:"
767 elog
768 elog " emerge --config =${CATEGORY}/${PF}"
769 elog
770 elog "The autovacuum function, which was in contrib, has been moved to the main"
771 elog "PostgreSQL functions starting with 8.1."
772 elog "You can enable it in the clusters postgresql.conf."
773 }
774
775 pkg_postrm() {
776 eselect postgresql update
777 }
778
779 pkg_config() {
780 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
781 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
782
783 # environment.bz2 may not contain the same locale as the current system
784 # locale. Unset and source from the current system locale.
785 if [ -f /etc/env.d/02locale ]; then
786 unset LANG
787 unset LC_CTYPE
788 unset LC_NUMERIC
789 unset LC_TIME
790 unset LC_COLLATE
791 unset LC_MONETARY
792 unset LC_MESSAGES
793 unset LC_ALL
794 source /etc/env.d/02locale
795 [ -n "${LANG}" ] && export LANG
796 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
797 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
798 [ -n "${LC_TIME}" ] && export LC_TIME
799 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
800 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
801 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
802 [ -n "${LC_ALL}" ] && export LC_ALL
803 fi
804
805 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
806 einfo "More information can be found here:"
807 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
808 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
809 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS"
810 einfo "variable."
811 einfo
812 einfo "You can change the directory where the database cluster is being created by"
813 einfo "setting the PGDATA variable."
814 einfo
815 einfo "PG_INITDB_OPTS is currently set to:"
816 einfo " \"${PG_INITDB_OPTS}\""
817 einfo "and the database cluster will be created in:"
818 einfo " \"${PGDATA}\""
819 einfo "Are you ready to continue? (Y/n)"
820 read answer
821 [ -z $answer ] && answer=Y
822 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
823
824 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
825 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
826 die "cluster already exists"
827 fi
828
829 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
830 einfo "Checking system parameters..."
831
832 if ! use kernel_linux ; then
833 SKIP_SYSTEM_TESTS=yes
834 einfo " Tests not supported on this OS (yet)"
835 fi
836
837 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
838 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
839
840 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
841 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
842 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
843 local SHMMAX=$(sysctl -n kernel.shmmax)
844
845 local SEMMSL_MIN=17
846 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
847 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
848 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
849
850 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
851 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
852 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
853 eerror "You have now several options:"
854 eerror " - Change the mentioned system parameter"
855 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
856 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
857 eerror "More information can be found here:"
858 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
859 die "System test failed."
860 fi
861 done
862 einfo "Passed."
863 else
864 einfo "Skipped."
865 fi
866
867 einfo "Creating the data directory ..."
868 mkdir -p "${PGDATA}"
869 chown -Rf postgres:postgres "${PGDATA}"
870 chmod 0700 "${PGDATA}"
871
872 einfo "Initializing the database ..."
873
874 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
875
876 einfo
877 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
878 einfo "instead of 'pg_ctl'."
879 einfo
880 }
881
882 src_test() {
883 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
884 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
885 emake -j1 check \
886 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
887 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
888
889 einfo "Yes, there are other tests which could be run."
890 einfo "... and no, we don't plan to add/support them."
891 einfo "For now, the main regressions tests will suffice. If you think other tests are"
892 einfo "necessary, please submit a bug including a patch for this ebuild to enable them."
893 }
894
895
896
897 1.1 dev-db/postgresql-server/postgresql-server-9.0.3.ebuild
898
899 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.3.ebuild?rev=1.1&view=markup
900 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.3.ebuild?rev=1.1&content-type=text/plain
901
902 Index: postgresql-server-9.0.3.ebuild
903 ===================================================================
904 # Copyright 1999-2011 Gentoo Foundation
905 # Distributed under the terms of the GNU General Public License v2
906 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.3.ebuild,v 1.1 2011/01/31 17:44:48 patrick Exp $
907
908 EAPI="2"
909 PYTHON_DEPEND="python? 2"
910
911 # weird test failures.
912 RESTRICT="test"
913
914 WANT_AUTOMAKE="none"
915 inherit autotools eutils multilib python versionator
916
917 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
918
919 DESCRIPTION="PostgreSQL server"
920 HOMEPAGE="http://www.postgresql.org/"
921
922 MY_PV=${PV/_/}
923 SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
924 S=${WORKDIR}/postgresql-${MY_PV}
925
926 LICENSE="POSTGRESQL"
927 SLOT="$(get_version_component_range 1-2)"
928 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"
929 IUSE="doc kernel_linux nls perl pg_legacytimestamp python selinux tcl uuid xml"
930
931 for lingua in ${LINGUAS}; do
932 IUSE+=" linguas_${lingua}"
933 done
934
935 wanted_languages() {
936 local enable_langs
937
938 for lingua in ${LINGUAS} ; do
939 use linguas_${lingua} && enable_langs+="${lingua} "
940 done
941
942 echo -n ${enable_langs}
943 }
944
945 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pg_legacytimestamp=,nls=]
946 perl? ( >=dev-lang/perl-5.6.1-r2 )
947 python? ( dev-python/egenix-mx-base )
948 selinux? ( sec-policy/selinux-postgresql )
949 tcl? ( >=dev-lang/tcl-8 )
950 uuid? ( dev-libs/ossp-uuid )
951 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
952 DEPEND="${RDEPEND}
953 sys-devel/flex
954 xml? ( dev-util/pkgconfig )"
955 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
956
957 pkg_setup() {
958 enewgroup postgres 70
959 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
960
961 if use python; then
962 python_set_active_version 2
963 fi
964 }
965
966 src_prepare() {
967 epatch "${FILESDIR}/postgresql-${SLOT}-common.3.patch" \
968 "${FILESDIR}/postgresql-${SLOT}-server.3.patch"
969
970 if use test; then
971 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
972 else
973 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
974 fi
975
976 eautoconf
977 }
978
979 src_configure() {
980 # eval is needed to get along with pg_config quotation of space-rich entities.
981 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
982 --disable-thread-safety \
983 $(use_with perl) \
984 $(use_with python) \
985 $(use_with tcl) \
986 $(use_with xml libxml) \
987 $(use_with xml libxslt) \
988 $(use_with uuid ossp-uuid) \
989 --with-system-tzdata="/usr/share/zoneinfo" \
990 --with-includes="/usr/include/postgresql-${SLOT}/" \
991 --with-libraries="/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
992 "$(use_enable nls nls "$(wanted_languages)")"
993 }
994
995 src_compile() {
996 local bd
997 for bd in . contrib $(use xml && echo contrib/xml2); do
998 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
999 emake -C $bd -j1 || die "emake in $bd failed"
1000 done
1001 }
1002
1003 src_install() {
1004 if use perl ; then
1005 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
1006 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
1007 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
1008 fi
1009
1010 for bd in . contrib $(use xml && echo contrib/xml2) ; do
1011 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1012 emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
1013 done
1014
1015 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/postgresql-${SLOT}/html"
1016 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
1017
1018 dodoc README HISTORY doc/{README.*,TODO,bug.template}
1019
1020 dodir /etc/eselect/postgresql/slots/${SLOT}
1021 cat > "${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
1022 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
1023 postgres_service="postgresql-${SLOT}"
1024 __EOF__
1025
1026 newinitd "${FILESDIR}/postgresql.init-${SLOT}-r1" postgresql-${SLOT} || die "Inserting init.d-file failed"
1027 newconfd "${FILESDIR}/postgresql.conf-${SLOT}-r1" postgresql-${SLOT} || die "Inserting conf.d-file failed"
1028
1029 keepdir /var/run/postgresql
1030 fperms 0770 /var/run/postgresql
1031 fowners postgres:postgres /var/run/postgresql
1032 }
1033
1034 pkg_postinst() {
1035 eselect postgresql update
1036 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
1037 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
1038
1039 ewarn "Please note that the standard location of the socket has changed from /tmp to"
1040 ewarn "/var/run/postgresql and you have to be in the 'postgres' group to access the"
1041 ewarn "socket. This can break applications which have the standard location"
1042 ewarn "hard-coded. If such an application links against the libpq, please reemerge"
1043 ewarn "it. If that doesn't help or the application accesses the socket without using"
1044 ewarn "libpq, please file a bug-report."
1045 ewarn
1046 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the"
1047 ewarn "original location."
1048 ewarn
1049
1050 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
1051 elog "contains your preferred locale and character encoding in:"
1052 elog
1053 elog " /etc/conf.d/postgresql-${SLOT}"
1054 elog
1055 elog "Then, execute the following command to setup the initial database environment:"
1056 elog
1057 elog " emerge --config =${CATEGORY}/${PF}"
1058 elog
1059 elog "The autovacuum function, which was in contrib, has been moved to the main"
1060 elog "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled by"
1061 elog "default. You can disable it in the cluster's postgresql.conf."
1062 elog
1063 elog "The timestamp format is 64 bit integers now. If you upgrade from older"
1064 elog "databases, this may force you to either do a dump and reload or enable"
1065 elog "pg_legacytimestamp until you find time to do so. If the database can't start"
1066 elog "please try enabling pg_legacytimestamp and rebuild."
1067 }
1068
1069 pkg_postrm() {
1070 eselect postgresql update
1071 }
1072
1073 pkg_config() {
1074 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
1075 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
1076
1077 # environment.bz2 may not contain the same locale as the current system
1078 # locale. Unset and source from the current system locale.
1079 if [ -f /etc/env.d/02locale ]; then
1080 unset LANG
1081 unset LC_CTYPE
1082 unset LC_NUMERIC
1083 unset LC_TIME
1084 unset LC_COLLATE
1085 unset LC_MONETARY
1086 unset LC_MESSAGES
1087 unset LC_ALL
1088 source /etc/env.d/02locale
1089 [ -n "${LANG}" ] && export LANG
1090 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1091 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1092 [ -n "${LC_TIME}" ] && export LC_TIME
1093 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1094 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1095 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1096 [ -n "${LC_ALL}" ] && export LC_ALL
1097 fi
1098
1099 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
1100 einfo "More information can be found here:"
1101 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1102 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1103 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS"
1104 einfo "variable."
1105 einfo
1106 einfo "You can change the directory where the database cluster is being created by"
1107 einfo "setting 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 }