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.11-r1.ebuild postgresql-server-8.2.17-r1.ebuild postgresql-server-8.4.4-r1.ebuild ChangeLog postgresql-server-7.4.29-r1.ebuild postgresql-server-8.1.21-r1.ebuild postgresql-server-9.0_beta1-r1.ebuild postgresql-server-8.0.25-r1.ebuild
Date: Fri, 04 Jun 2010 14:19:01
Message-Id: 20100604141853.5DB7C2C3ED@corvid.gentoo.org
1 patrick 10/06/04 14:18:53
2
3 Modified: ChangeLog
4 Added: postgresql-server-8.3.11-r1.ebuild
5 postgresql-server-8.2.17-r1.ebuild
6 postgresql-server-8.4.4-r1.ebuild
7 postgresql-server-7.4.29-r1.ebuild
8 postgresql-server-8.1.21-r1.ebuild
9 postgresql-server-9.0_beta1-r1.ebuild
10 postgresql-server-8.0.25-r1.ebuild
11 Log:
12 Bugfixes, thanks to Aaron Swenson for collecting and testing. Fixes #312939, #311047, #189854, #237315, #274568, #284094, #255004, #310045, #310619
13 (Portage version: 2.2_rc67/cvs/Linux x86_64)
14
15 Revision Changes Path
16 1.62 dev-db/postgresql-server/ChangeLog
17
18 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.62&view=markup
19 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.62&content-type=text/plain
20 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?r1=1.61&r2=1.62
21
22 Index: ChangeLog
23 ===================================================================
24 RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v
25 retrieving revision 1.61
26 retrieving revision 1.62
27 diff -u -r1.61 -r1.62
28 --- ChangeLog 17 May 2010 13:21:32 -0000 1.61
29 +++ ChangeLog 4 Jun 2010 14:18:53 -0000 1.62
30 @@ -1,6 +1,30 @@
31 # ChangeLog for dev-db/postgresql-server
32 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
33 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.61 2010/05/17 13:21:32 patrick Exp $
34 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.62 2010/06/04 14:18:53 patrick Exp $
35 +
36 +*postgresql-server-9.0_beta1-r1 (04 Jun 2010)
37 +*postgresql-server-8.4.4-r1 (04 Jun 2010)
38 +*postgresql-server-8.3.11-r1 (04 Jun 2010)
39 +*postgresql-server-8.2.17-r1 (04 Jun 2010)
40 +*postgresql-server-8.1.21-r1 (04 Jun 2010)
41 +*postgresql-server-8.0.25-r1 (04 Jun 2010)
42 +*postgresql-server-7.4.29-r1 (04 Jun 2010)
43 +
44 + 04 Jun 2010; Patrick Lauer <patrick@g.o>
45 + +files/postgresql.conf-7.4-r1, +files/postgresql.init-7.4-r1,
46 + +postgresql-server-7.4.29-r1.ebuild, +files/postgresql.conf-8.0-r1,
47 + +files/postgresql.init-8.0-r1, +postgresql-server-8.0.25-r1.ebuild,
48 + +files/postgresql.conf-8.1-r1, +files/postgresql.init-8.1-r1,
49 + +postgresql-server-8.1.21-r1.ebuild, +files/postgresql.conf-8.2-r1,
50 + +files/postgresql.init-8.2-r1, +postgresql-server-8.2.17-r1.ebuild,
51 + +files/postgresql.conf-8.3-r1, +files/postgresql.init-8.3-r1,
52 + +postgresql-server-8.3.11-r1.ebuild, +files/postgresql.conf-8.4-r1,
53 + +files/postgresql.init-8.4-r1, +postgresql-server-8.4.4-r1.ebuild,
54 + +postgresql-server-9.0_beta1-r1.ebuild, +files/postgresql.conf-9.0-r1,
55 + +files/postgresql.init-9.0-r1:
56 + Bugfixes, thanks to Aaron Swenson for collecting and testing. Fixes
57 + #312939, #311047, #189854, #237315, #274568, #284094, #255004, #310045,
58 + #310619
59
60 *postgresql-server-8.4.4 (17 May 2010)
61 *postgresql-server-8.3.11 (17 May 2010)
62
63
64
65 1.1 dev-db/postgresql-server/postgresql-server-8.3.11-r1.ebuild
66
67 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.11-r1.ebuild?rev=1.1&view=markup
68 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.11-r1.ebuild?rev=1.1&content-type=text/plain
69
70 Index: postgresql-server-8.3.11-r1.ebuild
71 ===================================================================
72 # Copyright 1999-2010 Gentoo Foundation
73 # Distributed under the terms of the GNU General Public License v2
74 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.11-r1.ebuild,v 1.1 2010/06/04 14:18:53 patrick Exp $
75
76 EAPI="2"
77
78 WANT_AUTOMAKE="none"
79 inherit eutils multilib versionator autotools
80
81 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
82
83 DESCRIPTION="PostgreSQL server"
84 HOMEPAGE="http://www.postgresql.org/"
85 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
86 LICENSE="POSTGRESQL"
87 SLOT="$(get_version_component_range 1-2)"
88 IUSE_LINGUAS="
89 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
90 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
91 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
92 linguas_tr linguas_zh_CN linguas_zh_TW"
93 IUSE="doc perl python selinux tcl uuid xml nls kernel_linux ${IUSE_LINGUAS}"
94
95 wanted_languages() {
96 for u in ${IUSE_LINGUAS} ; do
97 use $u && echo -n "${u#linguas_} "
98 done
99 }
100
101 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
102 perl? ( >=dev-lang/perl-5.6.1-r2 )
103 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
104 selinux? ( sec-policy/selinux-postgresql )
105 tcl? ( >=dev-lang/tcl-8 )
106 uuid? ( dev-libs/ossp-uuid )
107 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
108 DEPEND="${RDEPEND}
109 sys-devel/flex
110 xml? ( dev-util/pkgconfig )"
111 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
112
113 S="${WORKDIR}/postgresql-${PV}"
114
115 pkg_setup() {
116 enewgroup postgres 70
117 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
118 }
119
120 src_prepare() {
121
122 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
123 "${FILESDIR}/postgresql-${SLOT}-server.patch"
124
125 if use test; then
126 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
127 else
128 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
129 fi
130
131 eautoconf
132 }
133
134 src_configure() {
135 # TODO: test if PPC really cannot work with other CFLAGS settings
136 # use ppc && CFLAGS="-pipe -fsigned-char"
137
138 # eval is needed to get along with pg_config quotation of space-rich entities.
139 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
140 --disable-thread-safety \
141 $(use_with perl) \
142 $(use_with python) \
143 $(use_with tcl) \
144 $(use_with xml libxml) \
145 $(use_with xml libxslt) \
146 $(use_with uuid ossp-uuid) \
147 --with-system-tzdata="/usr/share/zoneinfo" \
148 --with-includes="/usr/include/postgresql-${SLOT}/" \
149 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")" \
150 || die "configure failed"
151 }
152
153 src_compile() {
154 for bd in . contrib $(use xml && echo contrib/xml2); do
155 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
156 emake -C $bd -j1 \
157 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
158 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
159 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
160 done
161 }
162
163 src_install() {
164 if use perl ; then
165 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
166 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
167 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
168 fi
169
170 for bd in . contrib $(use xml && echo contrib/xml2) ; do
171 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
172 emake install -C $bd -j1 DESTDIR="${D}" \
173 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
174 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
175 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
176 done
177
178 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
179 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
180
181 dodoc README HISTORY doc/{README.*,TODO,bug.template}
182
183 dodir /etc/eselect/postgresql/slots/${SLOT}
184 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
185 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
186 postgres_service="postgresql-${SLOT}"
187 __EOF__
188
189 newinitd "${FILESDIR}/postgresql.init-${SLOT}-r1" postgresql-${SLOT} || die "Inserting init.d-file failed"
190 newconfd "${FILESDIR}/postgresql.conf-${SLOT}-r1" postgresql-${SLOT} || die "Inserting conf.d-file failed"
191
192 keepdir /var/run/postgresql
193 fperms 0770 /var/run/postgresql
194 fowners postgres:postgres /var/run/postgresql
195 }
196
197 pkg_postinst() {
198 eselect postgresql update
199 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
200 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
201
202 ewarn "Please note that the standard location of the socket has changed from /tmp to"
203 ewarn "/var/run/postgresql and you have to be in the 'postgres' group to access the"
204 ewarn "socket. This can break applications which have the standard location"
205 ewarn "hard-coded. If such an application links against the libpq, please re-emerge"
206 ewarn "it. If that doesn't help or the application accesses the socket without using"
207 ewarn "libpq, please file a bug-report."
208 ewarn
209 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the"
210 ewarn "original location."
211 ewarn
212
213 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
214 elog "contains your preferred locale in:"
215 elog
216 elog " /etc/conf.d/postgresql-${SLOT}"
217 elog
218 elog "Execute the following command to setup the initial database environment:"
219 elog
220 elog " emerge --config =${CATEGORY}/${PF}"
221 elog
222 elog "The autovacuum function, which was in contrib, has been moved to the main"
223 elog "PostgreSQL functions starting with 8.1. You can enable it in the clusters"
224 elog "postgresql.conf."
225 }
226
227 pkg_postrm() {
228 eselect postgresql update
229 }
230
231 pkg_config() {
232 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
233 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
234
235 # environment.bz2 may not contain the same locale as the current system
236 # locale. Unset and source from the current system locale.
237 if [ -f /etc/env.d/02locale ]; then
238 unset LANG
239 unset LC_CTYPE
240 unset LC_NUMERIC
241 unset LC_TIME
242 unset LC_COLLATE
243 unset LC_MONETARY
244 unset LC_MESSAGES
245 unset LC_ALL
246 source /etc/env.d/02locale
247 [ -n "${LANG}" ] && export LANG
248 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
249 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
250 [ -n "${LC_TIME}" ] && export LC_TIME
251 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
252 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
253 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
254 [ -n "${LC_ALL}" ] && export LC_ALL
255 fi
256
257 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
258 einfo "More information can be found here:"
259 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
260 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
261 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS"
262 einfo "variable."
263 einfo
264 einfo "You can change the directory where the database cluster is being created by"
265 einfo "setting the PGDATA variable."
266 einfo
267 einfo "PG_INITDB_OPTS is currently set to:"
268 einfo " \"${PG_INITDB_OPTS}\""
269 einfo "and the database cluster will be created in:"
270 einfo " \"${PGDATA}\""
271 einfo "Are you ready to continue? (Y/n)"
272 read answer
273 [ -z $answer ] && answer=Y
274 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
275
276 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
277 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
278 die "cluster already exists"
279 fi
280
281 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
282 einfo "Checking system parameters..."
283
284 if ! use kernel_linux ; then
285 SKIP_SYSTEM_TESTS=yes
286 einfo " Tests not supported on this OS (yet)"
287 fi
288
289 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
290 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
291
292 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
293 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
294 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
295 local SHMMAX=$(sysctl -n kernel.shmmax)
296
297 local SEMMSL_MIN=17
298 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
299 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
300 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
301
302 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
303 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
304 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
305 eerror "You have now several options:"
306 eerror " - Change the mentioned system parameter"
307 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
308 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
309 eerror "More information can be found here:"
310 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
311 die "System test failed."
312 fi
313 done
314 einfo "Passed."
315 else
316 einfo "Skipped."
317 fi
318
319 einfo "Creating the data directory ..."
320 mkdir -p "${PGDATA}"
321 chown -Rf postgres:postgres "${PGDATA}"
322 chmod 0700 "${PGDATA}"
323
324 einfo "Initializing the database ..."
325
326 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
327
328 einfo
329 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
330 einfo "instead of 'pg_ctl'."
331 einfo
332 }
333
334 src_test() {
335 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
336 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
337 emake -j1 check \
338 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
339 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
340
341 einfo "Yes, there are other tests which could be run."
342 einfo "... and no, we don't plan to add/support them."
343 einfo "For now, the main regressions tests will suffice. If you think other tests are"
344 einfo "necessary, please submit a bug including a patch for this ebuild to enable them."
345 }
346
347
348
349 1.1 dev-db/postgresql-server/postgresql-server-8.2.17-r1.ebuild
350
351 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.17-r1.ebuild?rev=1.1&view=markup
352 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.17-r1.ebuild?rev=1.1&content-type=text/plain
353
354 Index: postgresql-server-8.2.17-r1.ebuild
355 ===================================================================
356 # Copyright 1999-2010 Gentoo Foundation
357 # Distributed under the terms of the GNU General Public License v2
358 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.2.17-r1.ebuild,v 1.1 2010/06/04 14:18:53 patrick Exp $
359
360 EAPI="2"
361
362 WANT_AUTOMAKE="none"
363 inherit eutils multilib versionator autotools
364
365 KEYWORDS="~amd64 ~hppa ~ppc ~x86"
366
367 DESCRIPTION="PostgreSQL server"
368 HOMEPAGE="http://www.postgresql.org/"
369 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
370 LICENSE="POSTGRESQL"
371 SLOT="$(get_version_component_range 1-2)"
372 IUSE_LINGUAS="
373 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
374 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
375 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
376 linguas_tr linguas_zh_CN linguas_zh_TW"
377 IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"
378
379 wanted_languages() {
380 for u in ${IUSE_LINGUAS} ; do
381 use $u && echo -n "${u#linguas_} "
382 done
383 }
384
385 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
386 perl? ( >=dev-lang/perl-5.6.1-r2 )
387 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
388 selinux? ( sec-policy/selinux-postgresql )
389 tcl? ( >=dev-lang/tcl-8 )
390 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
391 DEPEND="${RDEPEND}
392 sys-devel/flex
393 xml? ( dev-util/pkgconfig )"
394 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
395
396 S="${WORKDIR}/postgresql-${PV}"
397
398 pkg_setup() {
399 enewgroup postgres 70
400 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
401 }
402
403 src_prepare() {
404
405 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
406 "${FILESDIR}/postgresql-${SLOT}-server.patch"
407
408 if use test; then
409 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
410 else
411 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
412 fi
413
414 eautoconf
415 }
416
417 src_configure() {
418 # TODO: test if PPC really cannot work with other CFLAGS settings
419 # use ppc && CFLAGS="-pipe -fsigned-char"
420
421 # eval is needed to get along with pg_config quotation of space-rich entities.
422 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
423 --disable-thread-safety \
424 $(use_with perl) \
425 $(use_with python) \
426 $(use_with tcl) \
427 --with-includes="/usr/include/postgresql-${SLOT}/" \
428 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")" \
429 || die "configure failed"
430 }
431 src_compile() {
432 for bd in . contrib $(use xml && echo contrib/xml2); do
433 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
434 emake -C $bd -j1 \
435 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
436 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
437 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
438 done
439 }
440
441 src_install() {
442 if use perl ; then
443 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
444 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
445 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
446 fi
447
448 for bd in . contrib $(use xml && echo contrib/xml2) ; do
449 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
450 emake install -C $bd -j1 DESTDIR="${D}" \
451 PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \
452 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
453 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
454 done
455
456 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
457 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
458
459 dodoc README HISTORY doc/{README.*,TODO,bug.template}
460
461 dodir /etc/eselect/postgresql/slots/${SLOT}
462 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
463 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
464 postgres_service="postgresql-${SLOT}"
465 __EOF__
466
467 newinitd "${FILESDIR}/postgresql.init-${SLOT}-r1" postgresql-${SLOT} || die "Inserting init.d-file failed"
468 newconfd "${FILESDIR}/postgresql.conf-${SLOT}-r1" postgresql-${SLOT} || die "Inserting conf.d-file failed"
469
470 # Workaround for paludis
471 [ -f "${ROOT}/var/run/postgresql/.keep" ] || keepdir /var/run/postgresql
472 fperms 0770 /var/run/postgresql
473 fowners postgres:postgres /var/run/postgresql
474 }
475
476 pkg_postinst() {
477 eselect postgresql update
478 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
479 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
480
481 ewarn "Please note that the standard location of the socket has changed from /tmp"
482 ewarn "to /var/run/postgresql and you have to be in the 'postgres' group to access"
483 ewarn "the socket."
484 ewarn "This can break applications which have the standard location hard-coded."
485 ewarn "If such an application links against the libpq, please re-emerge it,"
486 ewarn "if that doesn't help or the application accesses the socket without using libpq,"
487 ewarn "please file a bug-report."
488 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."
489
490 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
491 elog "contains your preferred locale in:"
492 elog
493 elog " /etc/conf.d/postgresql-${SLOT}"
494 elog
495 elog "Then, execute the following command to setup the initial database environment:"
496 elog
497 elog " emerge --config =${CATEGORY}/${PF}"
498 elog
499 elog "The autovacuum function, which was in contrib, has been moved to the main"
500 elog "PostgreSQL functions starting with 8.1."
501 elog "You can enable it in the clusters postgresql.conf."
502 }
503
504 pkg_postrm() {
505 eselect postgresql update
506 }
507
508 pkg_config() {
509 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
510 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
511
512 # environment.bz2 may not contain the same locale as the current system
513 # locale. Unset and source from the current system locale.
514 if [ -f /etc/env.d/02locale ]; then
515 unset LANG
516 unset LC_CTYPE
517 unset LC_NUMERIC
518 unset LC_TIME
519 unset LC_COLLATE
520 unset LC_MONETARY
521 unset LC_MESSAGES
522 unset LC_ALL
523 source /etc/env.d/02locale
524 [ -n "${LANG}" ] && export LANG
525 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
526 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
527 [ -n "${LC_TIME}" ] && export LC_TIME
528 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
529 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
530 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
531 [ -n "${LC_ALL}" ] && export LC_ALL
532 fi
533
534 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
535 einfo "More information can be found here:"
536 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
537 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
538 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS"
539 einfo "variable."
540 einfo
541 einfo "You can change the directory where the database cluster is being created by"
542 einfo "setting the PGDATA variable."
543 einfo
544 einfo "PG_INITDB_OPTS is currently set to:"
545 einfo " \"${PG_INITDB_OPTS}\""
546 einfo "and the database cluster will be created in:"
547 einfo " \"${PGDATA}\""
548 einfo "Are you ready to continue? (Y/n)"
549 read answer
550 [ -z $answer ] && answer=Y
551 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
552
553 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
554 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
555 die "cluster already exists"
556 fi
557
558 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
559 einfo "Checking system parameters..."
560
561 if ! use kernel_linux ; then
562 SKIP_SYSTEM_TESTS=yes
563 einfo " Tests not supported on this OS (yet)"
564 fi
565
566 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
567 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
568
569 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
570 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
571 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
572 local SHMMAX=$(sysctl -n kernel.shmmax)
573
574 local SEMMSL_MIN=17
575 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
576 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
577 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
578
579 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
580 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
581 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
582 eerror "You have now several options:"
583 eerror " - Change the mentioned system parameter"
584 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
585 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
586 eerror "More information can be found here:"
587 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
588 die "System test failed."
589 fi
590 done
591 einfo "Passed."
592 else
593 einfo "Skipped."
594 fi
595
596 einfo "Creating the data directory ..."
597 mkdir -p "${PGDATA}"
598 chown -Rf postgres:postgres "${PGDATA}"
599 chmod 0700 "${PGDATA}"
600
601 einfo "Initializing the database ..."
602
603 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
604
605 einfo
606 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
607 einfo "instead of 'pg_ctl'."
608 einfo
609 }
610
611 src_test() {
612 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
613 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
614 emake -j1 check \
615 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
616 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
617
618 einfo "Yes, there are other tests which could be run."
619 einfo "... and no, we don't plan to add/support them."
620 einfo "For now, the main regressions tests will suffice. If you think other tests are"
621 einfo "necessary, please submit a bug including a patch for this ebuild to enable them."
622 }
623
624
625
626 1.1 dev-db/postgresql-server/postgresql-server-8.4.4-r1.ebuild
627
628 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.4-r1.ebuild?rev=1.1&view=markup
629 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.4-r1.ebuild?rev=1.1&content-type=text/plain
630
631 Index: postgresql-server-8.4.4-r1.ebuild
632 ===================================================================
633 # Copyright 1999-2010 Gentoo Foundation
634 # Distributed under the terms of the GNU General Public License v2
635 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.4-r1.ebuild,v 1.1 2010/06/04 14:18:53 patrick Exp $
636
637 EAPI="2"
638 PYTHON_DEPEND="python? 2"
639
640 # weird test failures.
641 RESTRICT="test"
642
643 WANT_AUTOMAKE="none"
644 inherit autotools eutils multilib python versionator
645
646 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
647
648 DESCRIPTION="PostgreSQL server"
649 HOMEPAGE="http://www.postgresql.org/"
650 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
651 LICENSE="POSTGRESQL"
652 SLOT="$(get_version_component_range 1-2)"
653 IUSE_LINGUAS="
654 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
655 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
656 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
657 linguas_tr linguas_zh_CN linguas_zh_TW"
658 IUSE="pg_legacytimestamp doc perl python selinux tcl uuid xml nls kernel_linux ${IUSE_LINGUAS}"
659
660 wanted_languages() {
661 for u in ${IUSE_LINGUAS} ; do
662 use $u && echo -n "${u#linguas_} "
663 done
664 }
665
666 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pg_legacytimestamp=,nls=]
667 perl? ( >=dev-lang/perl-5.6.1-r2 )
668 python? ( dev-python/egenix-mx-base )
669 selinux? ( sec-policy/selinux-postgresql )
670 tcl? ( >=dev-lang/tcl-8 )
671 uuid? ( dev-libs/ossp-uuid )
672 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
673 DEPEND="${RDEPEND}
674 sys-devel/flex
675 xml? ( dev-util/pkgconfig )"
676 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
677
678 S="${WORKDIR}/postgresql-${PV}"
679
680 pkg_setup() {
681 enewgroup postgres 70
682 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
683
684 if use python; then
685 python_set_active_version 2
686 fi
687 }
688
689 src_prepare() {
690 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
691 "${FILESDIR}/postgresql-${SLOT}-server.patch"
692
693 if use test; then
694 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
695 else
696 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
697 fi
698
699 eautoconf
700 }
701
702 src_configure() {
703 # TODO: test if PPC really cannot work with other CFLAGS settings
704 # use ppc && CFLAGS="-pipe -fsigned-char"
705
706 # eval is needed to get along with pg_config quotation of space-rich entities.
707 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
708 $(use_with perl) \
709 $(use_with python) \
710 $(use_with tcl) \
711 $(use_with xml libxml) \
712 $(use_with xml libxslt) \
713 $(use_with uuid ossp-uuid) \
714 --with-system-tzdata="/usr/share/zoneinfo" \
715 --with-includes="/usr/include/postgresql-${SLOT}/" \
716 --with-libraries="/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
717 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")"
718 }
719
720 src_compile() {
721 local bd
722 for bd in . contrib $(use xml && echo contrib/xml2); do
723 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
724 emake -C $bd -j1 || die "emake in $bd failed"
725 done
726 }
727
728 src_install() {
729 if use perl ; then
730 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
731 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
732 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
733 fi
734
735 for bd in . contrib $(use xml && echo contrib/xml2) ; do
736 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
737 emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
738 done
739
740 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/postgresql-${SLOT}/html"
741 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
742
743 dodoc README HISTORY doc/{README.*,TODO,bug.template}
744
745 dodir /etc/eselect/postgresql/slots/${SLOT}
746 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
747 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
748 postgres_service="postgresql-${SLOT}"
749 __EOF__
750
751 newinitd "${FILESDIR}/postgresql.init-${SLOT}-r1" postgresql-${SLOT} || die "Inserting init.d-file failed"
752 newconfd "${FILESDIR}/postgresql.conf-${SLOT}-r1" postgresql-${SLOT} || die "Inserting conf.d-file failed"
753
754 keepdir /var/run/postgresql
755 fperms 0770 /var/run/postgresql
756 fowners postgres:postgres /var/run/postgresql
757 }
758
759 pkg_postinst() {
760 eselect postgresql update
761 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
762 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
763
764 ewarn "Please note that the standard location of the socket has changed from /tmp to"
765 ewarn "/var/run/postgresql and you have to be in the 'postgres' group to access the"
766 ewarn "socket. This can break applications which have the standard location"
767 ewarn "hard-coded. If such an application links against the libpq, please reemerge"
768 ewarn "it. If that doesn't help or the application accesses the socket without using"
769 ewarn "libpq, please file a bug-report."
770 ewarn
771 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the"
772 ewarn "original location."
773 ewarn
774
775 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
776 elog "contains your preferred locale and character encoding in:"
777 elog
778 elog " /etc/conf.d/postgresql-${SLOT}"
779 elog
780 elog "Then, execute the following command to setup the initial database environment:"
781 elog
782 elog " emerge --config =${CATEGORY}/${PF}"
783 elog
784 elog "The autovacuum function, which was in contrib, has been moved to the main"
785 elog "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled by"
786 elog "default. You can disable it in the cluster's postgresql.conf."
787 elog
788 elog "The timestamp format is 64 bit integers now. If you upgrade from older"
789 elog "databases, this may force you to either do a dump and reload or enable"
790 elog "pg_legacytimestamp until you find time to do so. If the database can't start"
791 elog "please try enabling pg_legacytimestamp and rebuild."
792 }
793
794 pkg_postrm() {
795 eselect postgresql update
796 }
797
798 pkg_config() {
799 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
800 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
801
802 # environment.bz2 may not contain the same locale as the current system
803 # locale. Unset and source from the current system locale.
804 if [ -f /etc/env.d/02locale ]; then
805 unset LANG
806 unset LC_CTYPE
807 unset LC_NUMERIC
808 unset LC_TIME
809 unset LC_COLLATE
810 unset LC_MONETARY
811 unset LC_MESSAGES
812 unset LC_ALL
813 source /etc/env.d/02locale
814 [ -n "${LANG}" ] && export LANG
815 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
816 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
817 [ -n "${LC_TIME}" ] && export LC_TIME
818 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
819 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
820 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
821 [ -n "${LC_ALL}" ] && export LC_ALL
822 fi
823
824 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
825 einfo "More information can be found here:"
826 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
827 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
828 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
829 einfo
830 einfo "You can change the directory where the database cluster is being created by setting"
831 einfo "the PGDATA variable."
832 einfo
833 einfo "PG_INITDB_OPTS is currently set to:"
834 einfo " \"${PG_INITDB_OPTS}\""
835 einfo "and the database cluster will be created in:"
836 einfo " \"${PGDATA}\""
837 einfo "Are you ready to continue? (Y/n)"
838 read answer
839 [ -z $answer ] && answer=Y
840 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
841
842 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
843 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
844 die "cluster already exists"
845 fi
846
847 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
848 einfo "Checking system parameters..."
849
850 if ! use kernel_linux ; then
851 SKIP_SYSTEM_TESTS=yes
852 einfo " Tests not supported on this OS (yet)"
853 fi
854
855 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
856 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
857
858 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
859 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
860 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
861 local SHMMAX=$(sysctl -n kernel.shmmax)
862
863 local SEMMSL_MIN=17
864 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
865 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
866 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
867
868 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
869 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
870 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
871 eerror "You have now several options:"
872 eerror " - Change the mentioned system parameter"
873 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
874 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
875 eerror "More information can be found here:"
876 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
877 die "System test failed."
878 fi
879 done
880 einfo "Passed."
881 else
882 einfo "Skipped."
883 fi
884
885 einfo "Creating the data directory ..."
886 mkdir -p "${PGDATA}"
887 chown -Rf postgres:postgres "${PGDATA}"
888 chmod 0700 "${PGDATA}"
889
890 einfo "Initializing the database ..."
891
892 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
893
894 einfo
895 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
896 einfo "instead of 'pg_ctl'."
897 einfo
898 }
899
900 src_test() {
901 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
902 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
903 emake -j1 check || die "Make check failed. See above for details."
904
905 einfo "Yes, there are other tests which could be run."
906 einfo "... and no, we don't plan to add/support them."
907 einfo "For now, the main regressions tests will suffice. If you think other tests are"
908 einfo "necessary, please submit a bug including a patch for this ebuild to enable them."
909 }
910
911
912
913 1.1 dev-db/postgresql-server/postgresql-server-7.4.29-r1.ebuild
914
915 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-7.4.29-r1.ebuild?rev=1.1&view=markup
916 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-7.4.29-r1.ebuild?rev=1.1&content-type=text/plain
917
918 Index: postgresql-server-7.4.29-r1.ebuild
919 ===================================================================
920 # Copyright 1999-2010 Gentoo Foundation
921 # Distributed under the terms of the GNU General Public License v2
922 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-7.4.29-r1.ebuild,v 1.1 2010/06/04 14:18:53 patrick Exp $
923
924 EAPI="2"
925
926 WANT_AUTOMAKE="none"
927 inherit eutils multilib versionator autotools
928
929 KEYWORDS="~amd64 ~hppa ~ppc ~x86"
930
931 DESCRIPTION="PostgreSQL server"
932 HOMEPAGE="http://www.postgresql.org/"
933 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
934 LICENSE="POSTGRESQL"
935 SLOT="$(get_version_component_range 1-2)"
936 IUSE_LINGUAS="
937 linguas_cs linguas_de linguas_es linguas_fr linguas_hr linguas_hu
938 linguas_it linguas_nb linguas_pt_BR linguas_ru linguas_sl linguas_sv
939 linguas_tr linguas_zh_CN linguas_zh_TW"
940 IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"
941
942 wanted_languages() {
943 for u in ${IUSE_LINGUAS} ; do
944 use $u && echo -n "${u#linguas_} "
945 done
946 }
947
948 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
949 perl? ( >=dev-lang/perl-5.6.1-r2 )
950 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
951 selinux? ( sec-policy/selinux-postgresql )
952 tcl? ( >=dev-lang/tcl-8 )
953 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
954 DEPEND="${RDEPEND}
955 sys-devel/flex
956 xml? ( dev-util/pkgconfig )"
957 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
958
959 S="${WORKDIR}/postgresql-${PV}"
960
961 pkg_setup() {
962 enewgroup postgres 70
963 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
964 }
965
966 src_prepare() {
967 # vacuum-delay patch doesn't apply anymore
968 epatch "${FILESDIR}/postgresql-${PV}-autoconf.patch" \
969 "${FILESDIR}/postgresql-${SLOT}-server.patch" \
970 "${FILESDIR}/postgresql-${SLOT}-hppa.patch" \
971 "${FILESDIR}/postgresql-${SLOT}-com_err.patch"
972
973 if use test; then
974 epatch "${FILESDIR}/postgresql-${SLOT}-regress.patch"
975 fi
976
977 eautoreconf
978 }
979
980 src_configure() {
981 # eval is needed to get along with pg_config quotation of space-rich entities.
982 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
983 $(use_with perl) \
984 $(use_with python) \
985 $(use_with tcl) \
986 --with-includes="/usr/include/postgresql-${SLOT}/" \
987 --with-libs="/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)/" \
988 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")" \
989 "CFLAGS='${CFLAGS} $(use xml && pkg-config --cflags libxml-2.0)'" \
990 "LIBS='${LIBS} -lpq $(use xml && pkg-config --libs libxml-2.0) -L/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)'" \
991 || die "configure failed"
992 }
993
994 src_compile() {
995 for bd in . contrib $(use xml && echo contrib/xml) ; do
996 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
997 emake -C $bd -j1 \
998 docdir=/usr/share/doc/${PF} SLOT=${SLOT} || die "emake in $bd failed"
999 done
1000 }
1001
1002 src_install() {
1003 if use perl ; then
1004 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
1005 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
1006 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
1007 fi
1008
1009 for bd in . contrib $(use xml && echo contrib/xml) ; do
1010 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1011 emake install -C $bd -j1 DESTDIR="${D}" \
1012 docdir=/usr/share/doc/${PF} SLOT=${SLOT} || die "emake install in $bd failed"
1013 done
1014
1015 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/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,vacuumdb,pgtksh,pgtclsh}.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 "Also note, that upstream support for the 7.4 branch will end June 2010. If you"
1040 ewarn "haven't made plans to update to a more recent, or the latest stable branch,"
1041 ewarn "start planning now."
1042 ewarn
1043 ewarn "Please note that the standard location of the socket has changed from /tmp to"
1044 ewarn "/var/run/postgresql and you have to be in the 'postgres' group to access the"
1045 ewarn "socket. This can break applications which have the standard location"
1046 ewarn "hard-coded. If such an application links against the libpq, please reemerge"
1047 ewarn "it. If that doesn't help or the application accesses the socket without using"
1048 ewarn "libpq, please file a bug-report."
1049 ewarn
1050 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the"
1051 ewarn "original location."
1052 ewarn
1053
1054 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
1055 elog "contains your preferred locale in:"
1056 elog
1057 elog " /etc/conf.d/postgresql-${SLOT}"
1058 elog
1059 elog "Then, execute the following command to setup the initial database environment:"
1060 elog
1061 elog " emerge --config =${CATEGORY}/${PF}"
1062 elog
1063 }
1064
1065 pkg_postrm() {
1066 eselect postgresql update
1067 }
1068
1069 pkg_config() {
1070 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
1071 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
1072
1073 # environment.bz2 may not contain the same locale as the current system
1074 # locale. Unset and source from the current system locale.
1075 if [ -f /etc/env.d/02locale ]; then
1076 unset LANG
1077 unset LC_CTYPE
1078 unset LC_NUMERIC
1079 unset LC_TIME
1080 unset LC_COLLATE
1081 unset LC_MONETARY
1082 unset LC_MESSAGES
1083 unset LC_ALL
1084 source /etc/env.d/02locale
1085 [ -n "${LANG}" ] && export LANG
1086 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1087 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1088 [ -n "${LC_TIME}" ] && export LC_TIME
1089 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1090 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1091 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1092 [ -n "${LC_ALL}" ] && export LC_ALL
1093 fi
1094
1095 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable. More"
1096 einfo "information can be found here:"
1097 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1098 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1099 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS variable."
1100 einfo
1101 einfo "You can change the directory where the database cluster is being created by"
1102 einfo "setting the PGDATA variable."
1103 einfo
1104 einfo "PG_INITDB_OPTS is currently set to:"
1105 einfo " \"${PG_INITDB_OPTS}\""
1106 einfo "and the database cluster will be created in:"
1107 einfo " \"${PGDATA}\""
1108 einfo "Are you ready to continue? (Y/n)"
1109 read answer
1110 [ -z $answer ] && answer=Y
1111 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
1112
1113 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
1114 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
1115 die "cluster already exists"
1116 fi
1117
1118 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
1119 einfo "Checking system parameters..."
1120
1121 if ! use kernel_linux ; then
1122 SKIP_SYSTEM_TESTS=yes
1123 einfo " Tests not supported on this OS (yet)"
1124 fi
1125
1126 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
1127 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
1128
1129 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
1130 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
1131 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
1132 local SHMMAX=$(sysctl -n kernel.shmmax)
1133
1134 local SEMMSL_MIN=17
1135 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
1136 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
1137 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
1138
1139 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
1140 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
1141 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
1142 eerror "You have now several options:"
1143 eerror " - Change the mentioned system parameter"
1144 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
1145 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
1146 eerror "More information can be found here:"
1147 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
1148 die "System test failed."
1149 fi
1150 done
1151 einfo "Passed."
1152 else
1153 einfo "Skipped."
1154 fi
1155
1156 einfo "Creating the data directory ..."
1157 mkdir -p "${PGDATA}"
1158 chown -Rf postgres:postgres "${PGDATA}"
1159 chmod 0700 "${PGDATA}"
1160
1161 einfo "Initializing the database ..."
1162
1163 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
1164
1165 einfo
1166 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL instead of 'pg_ctl'."
1167 einfo
1168 }
1169
1170 src_test() {
1171 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1172 if [[ $UID -eq 0 ]]; then
1173 die "Testing with FEATURES=-userpriv is no longer supported by upstream. Tests MUST be run as non-root."
1174 fi
1175 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1176 emake -j1 check \
1177 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
1178 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
1179
1180 einfo "Yes, there are other tests which could be run."
1181 einfo "... and no, we don't plan to add/support them."
1182 einfo "For now, the main regressions tests will suffice."
1183 einfo "If you think other tests are necessary, please submit a"
1184 einfo "bug including a patch for this ebuild to enable them."
1185 }
1186
1187
1188
1189 1.1 dev-db/postgresql-server/postgresql-server-8.1.21-r1.ebuild
1190
1191 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.1.21-r1.ebuild?rev=1.1&view=markup
1192 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.1.21-r1.ebuild?rev=1.1&content-type=text/plain
1193
1194 Index: postgresql-server-8.1.21-r1.ebuild
1195 ===================================================================
1196 # Copyright 1999-2010 Gentoo Foundation
1197 # Distributed under the terms of the GNU General Public License v2
1198 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.1.21-r1.ebuild,v 1.1 2010/06/04 14:18:53 patrick Exp $
1199
1200 EAPI="2"
1201
1202 WANT_AUTOMAKE="none"
1203 inherit eutils multilib versionator autotools
1204
1205 KEYWORDS="~amd64 ~hppa ~x86"
1206
1207 DESCRIPTION="PostgreSQL server"
1208 HOMEPAGE="http://www.postgresql.org/"
1209 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
1210 LICENSE="POSTGRESQL"
1211 SLOT="$(get_version_component_range 1-2)"
1212 IUSE_LINGUAS="
1213 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
1214 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
1215 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
1216 linguas_tr linguas_zh_CN linguas_zh_TW"
1217 IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"
1218
1219 wanted_languages() {
1220 for u in ${IUSE_LINGUAS} ; do
1221 use $u && echo -n "${u#linguas_} "
1222 done
1223 }
1224
1225 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
1226 perl? ( >=dev-lang/perl-5.6.1-r2 )
1227 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
1228 selinux? ( sec-policy/selinux-postgresql )
1229 tcl? ( >=dev-lang/tcl-8 )
1230 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
1231 DEPEND="${RDEPEND}
1232 sys-devel/flex
1233 xml? ( dev-util/pkgconfig )"
1234 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
1235
1236 S="${WORKDIR}/postgresql-${PV}"
1237
1238 pkg_setup() {
1239 enewgroup postgres 70
1240 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
1241 }
1242
1243 src_prepare() {
1244
1245 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
1246 "${FILESDIR}/postgresql-${SLOT}-server.patch"
1247
1248 if use test; then
1249 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
1250 fi
1251
1252 eautoconf
1253 }
1254
1255 src_configure() {
1256 # TODO: test if PPC really cannot work with other CFLAGS settings
1257 # use ppc && CFLAGS="-pipe -fsigned-char"
1258
1259 # eval is needed to get along with pg_config quotation of space-rich entities.
1260 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
1261 $(use_with perl) \
1262 $(use_with python) \
1263 $(use_with tcl) \
1264 --with-includes="/usr/include/postgresql-${SLOT}/" \
1265 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")" \
1266 || die "configure failed"
1267 }
1268
1269 src_compile() {
1270 for bd in . contrib $(use xml && echo contrib/xml2) ; do
1271 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1272 emake -C $bd -j1 \
1273 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
1274 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
1275 done
1276 }
1277
1278 src_install() {
1279 if use perl ; then
1280 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
1281 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
1282 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
1283 fi
1284
1285 for bd in . contrib $(use xml && echo contrib/xml2) ; do
1286 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1287 emake install -C $bd -j1 DESTDIR="${D}" \
1288 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
1289 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
1290 done
1291
1292 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
1293 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
1294
1295 dodoc README HISTORY doc/{README.*,TODO,bug.template}
1296
1297 dodir /etc/eselect/postgresql/slots/${SLOT}
1298 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
1299 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
1300 postgres_service="postgresql-${SLOT}"
1301 __EOF__
1302
1303 newinitd "${FILESDIR}/postgresql.init-${SLOT}-r1" postgresql-${SLOT} || die "Inserting init.d-file failed"
1304 newconfd "${FILESDIR}/postgresql.conf-${SLOT}-r1" postgresql-${SLOT} || die "Inserting conf.d-file failed"
1305
1306 keepdir /var/run/postgresql
1307 fperms 0770 /var/run/postgresql
1308 fowners postgres:postgres /var/run/postgresql
1309 }
1310
1311 pkg_postinst() {
1312 eselect postgresql update
1313 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
1314 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
1315
1316 ewarn "Please note that the standard location of the socket has changed from /tmp to"
1317 ewarn "/var/run/postgresql and you have to be in the 'postgres' group to access the"
1318 ewarn "socket. This can break applications which have the standard location"
1319 ewarn "hard-coded. If such an application links against the libpq, please reemerge"
1320 ewarn "it. If that doesn't help or the application accesses the socket without using"
1321 ewarn "libpq, please file a bug-report."
1322 ewarn
1323 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the original location."
1324 ewarn
1325
1326 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
1327 elog "contains your preferred locale in:"
1328 elog
1329 elog " /etc/conf.d/postgresql-${SLOT}"
1330 elog
1331 elog "Then, execute the following command to setup the initial database environment:"
1332 elog
1333 elog " emerge --config =${CATEGORY}/${PF}"
1334 elog
1335 elog "The autovacuum function, which was in contrib, has been moved to the main"
1336 elog "PostgreSQL functions starting with 8.1. You can enable it in the clusters"
1337 elog "postgresql.conf."
1338 }
1339
1340 pkg_postrm() {
1341 eselect postgresql update
1342 }
1343
1344 pkg_config() {
1345 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
1346 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
1347
1348 # environment.bz2 may not contain the same locale as the current system
1349 # locale. Unset and source from the current system locale.
1350 if [ -f /etc/env.d/02locale ]; then
1351 unset LANG
1352 unset LC_CTYPE
1353 unset LC_NUMERIC
1354 unset LC_TIME
1355 unset LC_COLLATE
1356 unset LC_MONETARY
1357 unset LC_MESSAGES
1358 unset LC_ALL
1359 source /etc/env.d/02locale
1360 [ -n "${LANG}" ] && export LANG
1361 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1362 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1363 [ -n "${LC_TIME}" ] && export LC_TIME
1364 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1365 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1366 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1367 [ -n "${LC_ALL}" ] && export LC_ALL
1368 fi
1369
1370 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
1371 einfo "More information can be found here:"
1372 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1373 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1374 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS"
1375 einfo "variable."
1376 einfo
1377 einfo "You can change the directory where the database cluster is being created by"
1378 einfo "setting the PGDATA variable."
1379 einfo
1380 einfo "PG_INITDB_OPTS is currently set to:"
1381 einfo " \"${PG_INITDB_OPTS}\""
1382 einfo "and the database cluster will be created in:"
1383 einfo " \"${PGDATA}\""
1384 einfo "Are you ready to continue? (Y/n)"
1385 read answer
1386 [ -z $answer ] && answer=Y
1387 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
1388
1389 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
1390 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
1391 die "cluster already exists"
1392 fi
1393
1394 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
1395 einfo "Checking system parameters..."
1396
1397 if ! use kernel_linux ; then
1398 SKIP_SYSTEM_TESTS=yes
1399 einfo " Tests not supported on this OS (yet)"
1400 fi
1401
1402 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
1403 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
1404
1405 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
1406 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
1407 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
1408 local SHMMAX=$(sysctl -n kernel.shmmax)
1409
1410 local SEMMSL_MIN=17
1411 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
1412 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
1413 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
1414
1415 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
1416 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
1417 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
1418 eerror "You have now several options:"
1419 eerror " - Change the mentioned system parameter"
1420 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
1421 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
1422 eerror "More information can be found here:"
1423 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
1424 die "System test failed."
1425 fi
1426 done
1427 einfo "Passed."
1428 else
1429 einfo "Skipped."
1430 fi
1431
1432 einfo "Creating the data directory ..."
1433 mkdir -p "${PGDATA}"
1434 chown -Rf postgres:postgres "${PGDATA}"
1435 chmod 0700 "${PGDATA}"
1436
1437 einfo "Initializing the database ..."
1438
1439 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
1440
1441 einfo
1442 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1443 einfo "instead of 'pg_ctl'."
1444 einfo
1445 }
1446
1447 src_test() {
1448 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1449 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1450 emake -j1 check \
1451 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
1452 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
1453
1454 einfo "Yes, there are other tests which could be run."
1455 einfo "... and no, we don't plan to add/support them."
1456 einfo "For now, the main regressions tests will suffice. If you think other tests are"
1457 einfo "necessary, please submit a bug including a patch for this ebuild to enable them."
1458 }
1459
1460
1461
1462 1.1 dev-db/postgresql-server/postgresql-server-9.0_beta1-r1.ebuild
1463
1464 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0_beta1-r1.ebuild?rev=1.1&view=markup
1465 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0_beta1-r1.ebuild?rev=1.1&content-type=text/plain
1466
1467 Index: postgresql-server-9.0_beta1-r1.ebuild
1468 ===================================================================
1469 # Copyright 1999-2010 Gentoo Foundation
1470 # Distributed under the terms of the GNU General Public License v2
1471 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0_beta1-r1.ebuild,v 1.1 2010/06/04 14:18:53 patrick Exp $
1472
1473 EAPI="2"
1474 PYTHON_DEPEND="python? 2"
1475
1476 # weird test failures.
1477 RESTRICT="test"
1478
1479 WANT_AUTOMAKE="none"
1480 inherit autotools eutils multilib python versionator
1481
1482 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
1483
1484 DESCRIPTION="PostgreSQL server"
1485 HOMEPAGE="http://www.postgresql.org/"
1486
1487 MY_PV=${PV/_/}
1488 SRC_URI="mirror://postgresql/source/${MY_PV}/postgresql-${MY_PV}.tar.bz2"
1489 S=${WORKDIR}/postgresql-${MY_PV}
1490
1491 LICENSE="POSTGRESQL"
1492 SLOT="$(get_version_component_range 1-2)"
1493 IUSE_LINGUAS="
1494 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
1495 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
1496 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
1497 linguas_tr linguas_zh_CN linguas_zh_TW"
1498 IUSE="pg_legacytimestamp doc perl python selinux tcl uuid xml nls kernel_linux ${IUSE_LINGUAS}"
1499
1500 wanted_languages() {
1501 for u in ${IUSE_LINGUAS} ; do
1502 use $u && echo -n "${u#linguas_} "
1503 done
1504 }
1505
1506 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pg_legacytimestamp=]
1507 perl? ( >=dev-lang/perl-5.6.1-r2 )
1508 python? ( dev-python/egenix-mx-base )
1509 selinux? ( sec-policy/selinux-postgresql )
1510 tcl? ( >=dev-lang/tcl-8 )
1511 uuid? ( dev-libs/ossp-uuid )
1512 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
1513 DEPEND="${RDEPEND}
1514 sys-devel/flex
1515 xml? ( dev-util/pkgconfig )"
1516 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
1517
1518 pkg_setup() {
1519 enewgroup postgres 70
1520 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
1521
1522 if use python; then
1523 python_set_active_version 2
1524 fi
1525 }
1526
1527 src_prepare() {
1528 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
1529 "${FILESDIR}/postgresql-${SLOT}-server.patch"
1530
1531 if use test; then
1532 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
1533 else
1534 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
1535 fi
1536
1537 eautoconf
1538 }
1539
1540 src_configure() {
1541 # TODO: test if PPC really cannot work with other CFLAGS settings
1542 # use ppc && CFLAGS="-pipe -fsigned-char"
1543
1544 # eval is needed to get along with pg_config quotation of space-rich entities.
1545 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
1546 --disable-thread-safety \
1547 $(use_with perl) \
1548 $(use_with python) \
1549 $(use_with tcl) \
1550 $(use_with xml libxml) \
1551 $(use_with xml libxslt) \
1552 $(use_with uuid ossp-uuid) \
1553 --with-system-tzdata="/usr/share/zoneinfo" \
1554 --with-includes="/usr/include/postgresql-${SLOT}/" \
1555 --with-libraries="/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
1556 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")"
1557 }
1558
1559 src_compile() {
1560 local bd
1561 for bd in . contrib $(use xml && echo contrib/xml2); do
1562 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1563 emake -C $bd -j1 || die "emake in $bd failed"
1564 done
1565 }
1566
1567 src_install() {
1568 if use perl ; then
1569 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
1570 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
1571 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
1572 fi
1573
1574 for bd in . contrib $(use xml && echo contrib/xml2) ; do
1575 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1576 emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
1577 done
1578
1579 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/postgresql-${SLOT}/html"
1580 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
1581
1582 dodoc README HISTORY doc/{README.*,TODO,bug.template}
1583
1584 dodir /etc/eselect/postgresql/slots/${SLOT}
1585 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
1586 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
1587 postgres_service="postgresql-${SLOT}"
1588 __EOF__
1589
1590 newinitd "${FILESDIR}/postgresql.init-${SLOT}-r1" postgresql-${SLOT} || die "Inserting init.d-file failed"
1591 newconfd "${FILESDIR}/postgresql.conf-${SLOT}-r1" postgresql-${SLOT} || die "Inserting conf.d-file failed"
1592
1593 keepdir /var/run/postgresql
1594 fperms 0770 /var/run/postgresql
1595 fowners postgres:postgres /var/run/postgresql
1596 }
1597
1598 pkg_postinst() {
1599 eselect postgresql update
1600 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
1601 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
1602
1603 ewarn "Please note that the standard location of the socket has changed from /tmp to"
1604 ewarn "/var/run/postgresql and you have to be in the 'postgres' group to access the"
1605 ewarn "socket. This can break applications which have the standard location"
1606 ewarn "hard-coded. If such an application links against the libpq, please reemerge"
1607 ewarn "it. If that doesn't help or the application accesses the socket without using"
1608 ewarn "libpq, please file a bug-report."
1609 ewarn
1610 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the"
1611 ewarn "original location."
1612 ewarn
1613
1614 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
1615 elog "contains your preferred locale and character encoding in:"
1616 elog
1617 elog " /etc/conf.d/postgresql-${SLOT}"
1618 elog
1619 elog "Then, execute the following command to setup the initial database environment:"
1620 elog
1621 elog " emerge --config =${CATEGORY}/${PF}"
1622 elog
1623 elog "The autovacuum function, which was in contrib, has been moved to the main"
1624 elog "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled by"
1625 elog "default. You can disable it in the cluster's postgresql.conf."
1626 elog
1627 elog "The timestamp format is 64 bit integers now. If you upgrade from older"
1628 elog "databases, this may force you to either do a dump and reload or enable"
1629 elog "pg_legacytimestamp until you find time to do so. If the database can't start"
1630 elog "please try enabling pg_legacytimestamp and rebuild."
1631 }
1632
1633 pkg_postrm() {
1634 eselect postgresql update
1635 }
1636
1637 pkg_config() {
1638 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
1639 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
1640
1641 # environment.bz2 may not contain the same locale as the current system
1642 # locale. Unset and source from the current system locale.
1643 if [ -f /etc/env.d/02locale ]; then
1644 unset LANG
1645 unset LC_CTYPE
1646 unset LC_NUMERIC
1647 unset LC_TIME
1648 unset LC_COLLATE
1649 unset LC_MONETARY
1650 unset LC_MESSAGES
1651 unset LC_ALL
1652 source /etc/env.d/02locale
1653 [ -n "${LANG}" ] && export LANG
1654 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1655 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1656 [ -n "${LC_TIME}" ] && export LC_TIME
1657 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1658 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1659 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1660 [ -n "${LC_ALL}" ] && export LC_ALL
1661 fi
1662
1663 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
1664 einfo "More information can be found here:"
1665 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1666 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1667 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS"
1668 einfo "variable."
1669 einfo
1670 einfo "You can change the directory where the database cluster is being created by"
1671 einfo "setting the PGDATA variable."
1672 einfo
1673 einfo "PG_INITDB_OPTS is currently set to:"
1674 einfo " \"${PG_INITDB_OPTS}\""
1675 einfo "and the database cluster will be created in:"
1676 einfo " \"${PGDATA}\""
1677 einfo "Are you ready to continue? (Y/n)"
1678 read answer
1679 [ -z $answer ] && answer=Y
1680 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
1681
1682 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
1683 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
1684 die "cluster already exists"
1685 fi
1686
1687 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
1688 einfo "Checking system parameters..."
1689
1690 if ! use kernel_linux ; then
1691 SKIP_SYSTEM_TESTS=yes
1692 einfo " Tests not supported on this OS (yet)"
1693 fi
1694
1695 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
1696 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
1697
1698 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
1699 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
1700 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
1701 local SHMMAX=$(sysctl -n kernel.shmmax)
1702
1703 local SEMMSL_MIN=17
1704 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
1705 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
1706 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
1707
1708 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
1709 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
1710 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
1711 eerror "You have now several options:"
1712 eerror " - Change the mentioned system parameter"
1713 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
1714 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
1715 eerror "More information can be found here:"
1716 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
1717 die "System test failed."
1718 fi
1719 done
1720 einfo "Passed."
1721 else
1722 einfo "Skipped."
1723 fi
1724
1725 einfo "Creating the data directory ..."
1726 mkdir -p "${PGDATA}"
1727 chown -Rf postgres:postgres "${PGDATA}"
1728 chmod 0700 "${PGDATA}"
1729
1730 einfo "Initializing the database ..."
1731
1732 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
1733
1734 einfo
1735 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1736 einfo "instead of 'pg_ctl'."
1737 einfo
1738 }
1739
1740 src_test() {
1741 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
1742 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1743 emake -j1 check || die "Make check failed. See above for details."
1744
1745 einfo "Yes, there are other tests which could be run."
1746 einfo "... and no, we don't plan to add/support them."
1747 einfo "For now, the main regressions tests will suffice. If you think other tests are"
1748 einfo "necessary, please submit a bug including a patch for this ebuild to enable them."
1749 }
1750
1751
1752
1753 1.1 dev-db/postgresql-server/postgresql-server-8.0.25-r1.ebuild
1754
1755 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.0.25-r1.ebuild?rev=1.1&view=markup
1756 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.0.25-r1.ebuild?rev=1.1&content-type=text/plain
1757
1758 Index: postgresql-server-8.0.25-r1.ebuild
1759 ===================================================================
1760 # Copyright 1999-2010 Gentoo Foundation
1761 # Distributed under the terms of the GNU General Public License v2
1762 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.0.25-r1.ebuild,v 1.1 2010/06/04 14:18:53 patrick Exp $
1763
1764 EAPI="2"
1765
1766 WANT_AUTOMAKE="none"
1767 inherit eutils multilib versionator autotools
1768
1769 KEYWORDS="~amd64 ~hppa ~ppc ~x86"
1770
1771 DESCRIPTION="PostgreSQL server"
1772 HOMEPAGE="http://www.postgresql.org/"
1773 SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
1774 LICENSE="POSTGRESQL"
1775 SLOT="$(get_version_component_range 1-2)"
1776 IUSE_LINGUAS="
1777 linguas_af linguas_cs linguas_de linguas_es linguas_fa linguas_fr
1778 linguas_hr linguas_hu linguas_it linguas_ko linguas_nb linguas_pl
1779 linguas_pt_BR linguas_ro linguas_ru linguas_sk linguas_sl linguas_sv
1780 linguas_tr linguas_zh_CN linguas_zh_TW"
1781 IUSE="doc perl python selinux tcl xml nls kernel_linux ${IUSE_LINGUAS}"
1782
1783 wanted_languages() {
1784 for u in ${IUSE_LINGUAS} ; do
1785 use $u && echo -n "${u#linguas_} "
1786 done
1787 }
1788
1789 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}
1790 perl? ( >=dev-lang/perl-5.6.1-r2 )
1791 python? ( >=dev-lang/python-2.2 dev-python/egenix-mx-base )
1792 selinux? ( sec-policy/selinux-postgresql )
1793 tcl? ( >=dev-lang/tcl-8 )
1794 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
1795 DEPEND="${RDEPEND}
1796 sys-devel/flex
1797 xml? ( dev-util/pkgconfig )"
1798 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
1799
1800 S="${WORKDIR}/postgresql-${PV}"
1801
1802 pkg_setup() {
1803 enewgroup postgres 70
1804 enewuser postgres 70 /bin/bash /var/lib/postgresql postgres
1805 }
1806
1807 src_prepare() {
1808
1809 epatch "${FILESDIR}/postgresql-${SLOT}-common.patch" \
1810 "${FILESDIR}/postgresql-${SLOT}-server.patch"
1811
1812 if use test; then
1813 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
1814 fi
1815
1816 eautoconf
1817 }
1818
1819 src_configure() {
1820 # TODO: test if PPC really cannot work with other CFLAGS settings
1821 # use ppc && CFLAGS="-pipe -fsigned-char"
1822
1823 # eval is needed to get along with pg_config quotation of space-rich entities.
1824 eval econf "$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
1825 $(use_with perl) \
1826 $(use_with python) \
1827 $(use_with tcl) \
1828 --with-includes="/usr/include/postgresql-${SLOT}/" \
1829 "$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")" \
1830 || die "configure failed"
1831 }
1832
1833 src_compile() {
1834 for bd in . contrib $(use xml && echo contrib/xml2) ; do
1835 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1836 emake -C $bd -j1 \
1837 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
1838 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake in $bd failed"
1839 done
1840 }
1841
1842 src_install() {
1843 if use perl ; then
1844 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
1845 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
1846 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
1847 fi
1848
1849 for bd in . contrib $(use xml && echo contrib/xml2) ; do
1850 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
1851 emake install -C $bd -j1 DESTDIR="${D}" \
1852 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
1853 NO_PGXS=0 USE_PGXS=1 docdir=/usr/share/doc/${PF} || die "emake install in $bd failed"
1854 done
1855
1856 rm -rf "${D}/usr/share/postgresql-${SLOT}/man/man7/" "${D}/usr/share/doc/${PF}/html"
1857 rm "${D}"/usr/share/postgresql-${SLOT}/man/man1/{clusterdb,create{db,lang,user},drop{db,lang,user},ecpg,pg_{config,dump,dumpall,restore},psql,vacuumdb}.1
1858
1859 dodoc README HISTORY doc/{README.*,TODO,bug.template}
1860
1861 dodir /etc/eselect/postgresql/slots/${SLOT}
1862 cat >"${D}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
1863 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
1864 postgres_service="postgresql-${SLOT}"
1865 __EOF__
1866
1867 newinitd "${FILESDIR}/postgresql.init-${SLOT}-r1" postgresql-${SLOT} || die "Inserting init.d-file failed"
1868 newconfd "${FILESDIR}/postgresql.conf-${SLOT}-r1" postgresql-${SLOT} || die "Inserting conf.d-file failed"
1869
1870 keepdir /var/run/postgresql
1871 fperms 0770 /var/run/postgresql
1872 fowners postgres:postgres /var/run/postgresql
1873 }
1874
1875 pkg_postinst() {
1876 eselect postgresql update
1877 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
1878 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
1879
1880 ewarn "Please note that the standard location of the socket has changed from /tmp to"
1881 ewarn "/var/run/postgresql and you have to be in the 'postgres' group to access the"
1882 ewarn "socket. This can break applications which have the standard location"
1883 ewarn "hard-coded. If such an application links against the libpq, please re-emerge"
1884 ewarn "it. If that doesn't help or the application accesses the socket without using"
1885 ewarn "libpq, please file a bug-report."
1886 ewarn
1887 ewarn "You can set PGOPTS='-k /tmp' in /etc/conf.d/postgresql-${SLOT} to restore the"
1888 ewarn "original location."
1889 ewarn
1890
1891 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that it"
1892 elog "contains your preferred locale in:"
1893 elog
1894 elog " /etc/conf.d/postgresql-${SLOT}"
1895 elog
1896 elog "Then, execute the following command to setup the initial database environment:"
1897 elog
1898 elog " emerge --config =${CATEGORY}/${PF}"
1899 elog
1900 }
1901
1902 pkg_postrm() {
1903 eselect postgresql update
1904 }
1905
1906 pkg_config() {
1907 [[ -f /etc/conf.d/postgresql-${SLOT} ]] && source /etc/conf.d/postgresql-${SLOT}
1908 [[ -z "${PGDATA}" ]] && PGDATA="/var/lib/postgresql/${SLOT}/data"
1909
1910 # environment.bz2 may not contain the same locale as the current system
1911 # locale. Unset and source from the current system locale.
1912 if [ -f /etc/env.d/02locale ]; then
1913 unset LANG
1914 unset LC_CTYPE
1915 unset LC_NUMERIC
1916 unset LC_TIME
1917 unset LC_COLLATE
1918 unset LC_MONETARY
1919 unset LC_MESSAGES
1920 unset LC_ALL
1921 source /etc/env.d/02locale
1922 [ -n "${LANG}" ] && export LANG
1923 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1924 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1925 [ -n "${LC_TIME}" ] && export LC_TIME
1926 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1927 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1928 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1929 [ -n "${LC_ALL}" ] && export LC_ALL
1930 fi
1931
1932 einfo "You can pass options to initdb by setting the PG_INITDB_OPTS variable."
1933 einfo "More information can be found here:"
1934 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1935 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1936 einfo "Simply add the options you would have added to initdb to the PG_INITDB_OPTS"
1937 einfo "variable."
1938 einfo
1939 einfo "You can change the directory where the database cluster is being created by"
1940 einfo "setting the PGDATA variable."
1941 einfo
1942 einfo "PG_INITDB_OPTS is currently set to:"
1943 einfo " \"${PG_INITDB_OPTS}\""
1944 einfo "and the database cluster will be created in:"
1945 einfo " \"${PGDATA}\""
1946 einfo "Are you ready to continue? (Y/n)"
1947 read answer
1948 [ -z $answer ] && answer=Y
1949 [ "$answer" == "Y" ] || [ "$answer" == "y" ] || die "aborted"
1950
1951 if [[ -f "${PGDATA}/PG_VERSION" ]] ; then
1952 eerror "The given directory \"${PGDATA}\" already contains a database cluster."
1953 die "cluster already exists"
1954 fi
1955
1956 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
1957 einfo "Checking system parameters..."
1958
1959 if ! use kernel_linux ; then
1960 SKIP_SYSTEM_TESTS=yes
1961 einfo " Tests not supported on this OS (yet)"
1962 fi
1963
1964 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
1965 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
1966
1967 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
1968 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
1969 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
1970 local SHMMAX=$(sysctl -n kernel.shmmax)
1971
1972 local SEMMSL_MIN=17
1973 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
1974 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
1975 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
1976
1977 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
1978 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
1979 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
1980 eerror "You have now several options:"
1981 eerror " - Change the mentioned system parameter"
1982 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a value lower than ${PG_MAX_CONNECTIONS}"
1983 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
1984 eerror "More information can be found here:"
1985 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
1986 die "System test failed."
1987 fi
1988 done
1989 einfo "Passed."
1990 else
1991 einfo "Skipped."
1992 fi
1993
1994 einfo "Creating the data directory ..."
1995 mkdir -p "${PGDATA}"
1996 chown -Rf postgres:postgres "${PGDATA}"
1997 chmod 0700 "${PGDATA}"
1998
1999 einfo "Initializing the database ..."
2000
2001 su postgres -c "/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb --pgdata \"${PGDATA}\" ${PG_INITDB_OPTS}"
2002
2003 einfo
2004 einfo "You can use the '${ROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
2005 einfo "instead of 'pg_ctl'."
2006 }
2007
2008 src_test() {
2009 sed -i \
2010 -e '/test: horology/d' \
2011 src/test/regress/{parallel_schedule,serial_schedule} || die "sed failed"
2012
2013 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
2014 PATH="/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
2015 emake -j1 check \
2016 PGXS=$(/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \
2017 NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} || die "Make check failed. See above for details."
2018
2019 einfo "Yes, there are other tests which could be run."
2020 einfo "... and no, we don't plan to add/support them."
2021 einfo "For now, the main regressions tests will suffice."
2022 einfo "If you think other tests are necessary, please submit a bug including a patch"
2023 einfo "for this ebuild to enable them."
2024 }