1 |
titanofold 12/02/28 02:04:06 |
2 |
|
3 |
Modified: ChangeLog |
4 |
Added: postgresql-server-8.4.11.ebuild |
5 |
postgresql-server-8.3.18.ebuild |
6 |
postgresql-server-9.1.3.ebuild |
7 |
postgresql-server-9.0.7.ebuild |
8 |
Log: |
9 |
Security bump. (Bug 406037) |
10 |
|
11 |
(Portage version: 2.1.10.44/cvs/Linux i686) |
12 |
|
13 |
Revision Changes Path |
14 |
1.171 dev-db/postgresql-server/ChangeLog |
15 |
|
16 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.171&view=markup |
17 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.171&content-type=text/plain |
18 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?r1=1.170&r2=1.171 |
19 |
|
20 |
Index: ChangeLog |
21 |
=================================================================== |
22 |
RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v |
23 |
retrieving revision 1.170 |
24 |
retrieving revision 1.171 |
25 |
diff -u -r1.170 -r1.171 |
26 |
--- ChangeLog 19 Feb 2012 13:25:25 -0000 1.170 |
27 |
+++ ChangeLog 28 Feb 2012 02:04:06 -0000 1.171 |
28 |
@@ -1,6 +1,16 @@ |
29 |
# ChangeLog for dev-db/postgresql-server |
30 |
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 |
31 |
-# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.170 2012/02/19 13:25:25 klausman Exp $ |
32 |
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.171 2012/02/28 02:04:06 titanofold Exp $ |
33 |
+ |
34 |
+*postgresql-server-9.1.3 (28 Feb 2012) |
35 |
+*postgresql-server-9.0.7 (28 Feb 2012) |
36 |
+*postgresql-server-8.4.11 (28 Feb 2012) |
37 |
+*postgresql-server-8.3.18 (28 Feb 2012) |
38 |
+ |
39 |
+ 28 Feb 2012; Aaron W. Swenson <titanofold@g.o> |
40 |
+ +postgresql-server-8.3.18.ebuild, +postgresql-server-8.4.11.ebuild, |
41 |
+ +postgresql-server-9.0.7.ebuild, +postgresql-server-9.1.3.ebuild: |
42 |
+ Security bump. (Bug 406037) |
43 |
|
44 |
19 Feb 2012; Tobias Klausmann <klausman@g.o> |
45 |
postgresql-server-9.1.2-r2.ebuild: |
46 |
|
47 |
|
48 |
|
49 |
1.1 dev-db/postgresql-server/postgresql-server-8.4.11.ebuild |
50 |
|
51 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.11.ebuild?rev=1.1&view=markup |
52 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.4.11.ebuild?rev=1.1&content-type=text/plain |
53 |
|
54 |
Index: postgresql-server-8.4.11.ebuild |
55 |
=================================================================== |
56 |
# Copyright 1999-2012 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.4.11.ebuild,v 1.1 2012/02/28 02:04:06 titanofold Exp $ |
59 |
|
60 |
EAPI="4" |
61 |
PYTHON_DEPEND="python? 2" |
62 |
|
63 |
WANT_AUTOMAKE="none" |
64 |
inherit autotools eutils multilib pam prefix python versionator |
65 |
|
66 |
SLOT="$(get_version_component_range 1-2)" |
67 |
|
68 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" |
69 |
|
70 |
DESCRIPTION="PostgreSQL server" |
71 |
HOMEPAGE="http://www.postgresql.org/" |
72 |
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 |
73 |
http://dev.gentoo.org/~titanofold/postgresql-patches-8.4-r2.tbz2 |
74 |
http://dev.gentoo.org/~titanofold/postgresql-initscript-2.1.tbz2" |
75 |
LICENSE="POSTGRESQL" |
76 |
|
77 |
S="${WORKDIR}/postgresql-${PV}" |
78 |
|
79 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" |
80 |
IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml" |
81 |
|
82 |
for lingua in ${LINGUAS} ; do |
83 |
IUSE+=" linguas_${lingua}" |
84 |
done |
85 |
|
86 |
wanted_languages() { |
87 |
local enable_langs |
88 |
|
89 |
for lingua in ${LINGUAS} ; do |
90 |
use linguas_${lingua} && enable_langs+="${lingua} " |
91 |
done |
92 |
|
93 |
echo -n ${enable_langs} |
94 |
} |
95 |
|
96 |
RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=] |
97 |
perl? ( >=dev-lang/perl-5.8 ) |
98 |
selinux? ( sec-policy/selinux-postgresql ) |
99 |
tcl? ( >=dev-lang/tcl-8 ) |
100 |
uuid? ( dev-libs/ossp-uuid ) |
101 |
xml? ( dev-libs/libxml2 dev-libs/libxslt )" |
102 |
|
103 |
DEPEND="${RDEPEND} |
104 |
sys-devel/flex |
105 |
xml? ( dev-util/pkgconfig )" |
106 |
|
107 |
PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" |
108 |
|
109 |
# Support /var/run or /run for the socket directory |
110 |
[[ ! -d /run ]] && RUNDIR=/var |
111 |
|
112 |
pkg_setup() { |
113 |
enewgroup postgres 70 |
114 |
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
115 |
|
116 |
use python && python_set_active_version 2 |
117 |
} |
118 |
|
119 |
src_prepare() { |
120 |
epatch "${WORKDIR}/autoconf.patch" \ |
121 |
"${WORKDIR}/bool.patch" \ |
122 |
"${WORKDIR}/darwin.patch" \ |
123 |
"${WORKDIR}/ldflags.patch" \ |
124 |
"${WORKDIR}/pg_ctl-exit-status.patch" \ |
125 |
"${WORKDIR}/server.patch" \ |
126 |
"${WORKDIR}/SuperH.patch" |
127 |
|
128 |
eprefixify src/include/pg_config_manual.h |
129 |
|
130 |
if use test ; then |
131 |
epatch "${WORKDIR}/regress.patch" |
132 |
sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c |
133 |
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \ |
134 |
-i src/test/regress/{input,output}/tablespace.source |
135 |
else |
136 |
echo "all install:" > "${S}/src/test/regress/GNUmakefile" |
137 |
fi |
138 |
|
139 |
sed -e "s|@RUNDIR@|${RUNDIR}|g" \ |
140 |
-i src/include/pg_config_manual.h "${WORKDIR}/postgresql.init" || \ |
141 |
die "RUNDIR sed failed" |
142 |
sed -e "s|@SLOT@|${SLOT}|g" \ |
143 |
-i "${WORKDIR}/postgresql.init" "${WORKDIR}/postgresql.confd" || \ |
144 |
die "SLOT sed failed" |
145 |
|
146 |
eautoconf |
147 |
} |
148 |
|
149 |
src_configure() { |
150 |
# eval is needed to get along with pg_config quotation of space-rich entities. |
151 |
eval econf "$(${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ |
152 |
--with-includes="${EPREFIX%/}/usr/include/postgresql-${SLOT}/" \ |
153 |
--with-libraries="${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \ |
154 |
--with-system-tzdata="${EPREFIX%/}/usr/share/zoneinfo" \ |
155 |
$(use_with perl) \ |
156 |
$(use_with python) \ |
157 |
$(use_with tcl) \ |
158 |
$(use_with xml libxml) \ |
159 |
$(use_with xml libxslt) \ |
160 |
$(use_with uuid ossp-uuid) \ |
161 |
"$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")" |
162 |
} |
163 |
|
164 |
src_compile() { |
165 |
local bd |
166 |
for bd in . contrib $(use xml && echo contrib/xml2) ; do |
167 |
PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ |
168 |
emake -C $bd -j1 || die "emake in $bd failed" |
169 |
done |
170 |
} |
171 |
|
172 |
src_install() { |
173 |
if use perl ; then |
174 |
mv -f "${S}/src/pl/plperl/GNUmakefile" \ |
175 |
"${S}/src/pl/plperl/GNUmakefile_orig" |
176 |
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ |
177 |
"${S}/src/pl/plperl/GNUmakefile_orig" \ |
178 |
> "${S}/src/pl/plperl/GNUmakefile" |
179 |
fi |
180 |
|
181 |
local bd |
182 |
for bd in . contrib $(use xml && echo contrib/xml2) ; do |
183 |
PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ |
184 |
emake install -C $bd -j1 DESTDIR="${D}" \ |
185 |
|| die "emake install in $bd failed" |
186 |
done |
187 |
|
188 |
rm -r "${ED}/usr/share/postgresql-${SLOT}/man/man7/" \ |
189 |
"${ED}/usr/share/doc/postgresql-${SLOT}/html" |
190 |
rm "${ED}"/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 |
191 |
|
192 |
dodoc README HISTORY doc/{README.*,TODO,bug.template} |
193 |
|
194 |
dodir /etc/eselect/postgresql/slots/${SLOT} |
195 |
echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \ |
196 |
> "${ED}/etc/eselect/postgresql/slots/${SLOT}/server" |
197 |
|
198 |
newconfd "${WORKDIR}"/postgresql.confd postgresql-${SLOT} \ |
199 |
|| die "Inserting conf.d file failed" |
200 |
|
201 |
newinitd "${WORKDIR}"/postgresql.init postgresql-${SLOT} \ |
202 |
|| die "Inserting init.d file failed" |
203 |
|
204 |
use pam && pamd_mimic system-auth postgresql auth account session |
205 |
|
206 |
if use prefix ; then |
207 |
keepdir ${RUNDIR}/run/postgresql |
208 |
fperms 0770 ${RUNDIR}/run/postgresql |
209 |
fi |
210 |
} |
211 |
|
212 |
pkg_postinst() { |
213 |
postgresql-config update |
214 |
|
215 |
elog "The time stamp format is 64 bit integers now. If you upgrade from older" |
216 |
elog "databases, this may force you to either do a dump and reload of enable" |
217 |
elog "pg_legacytimestamp until you find time to do so. If the database can't start" |
218 |
elog "please try enabling pg_legacytimestamp and rebuild." |
219 |
elog |
220 |
elog "Gentoo specific documentation:" |
221 |
elog "http://www.gentoo.org/doc/en/postgres-howto.xml" |
222 |
elog |
223 |
elog "Official documentation:" |
224 |
elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
225 |
elog |
226 |
elog "The default location of the Unix-domain socket is:" |
227 |
elog " ${EROOT%/}${RUNDIR}/run/postgresql/" |
228 |
elog |
229 |
elog "If you have users and/or services that you would like to utilize the" |
230 |
elog "socket, you must add them to the 'postgres' system group:" |
231 |
elog " usermod -a -G postgres <user>" |
232 |
elog |
233 |
elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
234 |
elog "so that it contains your preferred locale in:" |
235 |
elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
236 |
elog |
237 |
elog "Then, execute the following command to setup the initial database" |
238 |
elog "environment:" |
239 |
elog " emerge --config =${CATEGORY}/${PF}" |
240 |
} |
241 |
|
242 |
pkg_postrm() { |
243 |
postgresql-config update |
244 |
} |
245 |
|
246 |
pkg_config() { |
247 |
[[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
248 |
[[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
249 |
[[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
250 |
|
251 |
# environment.bz2 may not contain the same locale as the current system |
252 |
# locale. Unset and source from the current system locale. |
253 |
if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then |
254 |
unset LANG |
255 |
unset LC_CTYPE |
256 |
unset LC_NUMERIC |
257 |
unset LC_TIME |
258 |
unset LC_COLLATE |
259 |
unset LC_MONETARY |
260 |
unset LC_MESSAGES |
261 |
unset LC_ALL |
262 |
source "${EROOT%/}/etc/env.d/02locale" |
263 |
[[ -n ${LANG} ]] && export LANG |
264 |
[[ -n ${LC_CTYPE} ]] && export LC_CTYPE |
265 |
[[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC |
266 |
[[ -n ${LC_TIME} ]] && export LC_TIME |
267 |
[[ -n ${LC_COLLATE} ]] && export LC_COLLATE |
268 |
[[ -n ${LC_MONETARY} ]] && export LC_MONETARY |
269 |
[[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES |
270 |
[[ -n ${LC_ALL} ]] && export LC_ALL |
271 |
fi |
272 |
|
273 |
einfo "You can modify the paths and options passed to initdb by editing:" |
274 |
einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
275 |
einfo |
276 |
einfo "Information on options that can be passed to initdb are found at:" |
277 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
278 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
279 |
einfo |
280 |
einfo "PG_INITDB_OPTS is currently set to:" |
281 |
if [[ -z ${PG_INITDB_OPTS} ]] ; then |
282 |
einfo " (none)" |
283 |
else |
284 |
einfo " ${PG_INITDB_OPTS}" |
285 |
fi |
286 |
einfo |
287 |
einfo "Configuration files will be installed to:" |
288 |
einfo " ${PGDATA}" |
289 |
einfo |
290 |
einfo "The database cluster will be created in:" |
291 |
einfo " ${DATA_DIR}" |
292 |
einfo |
293 |
while [[ $correct != "true" ]] ; do |
294 |
einfo "Are you ready to continue? (y/n)" |
295 |
read answer |
296 |
if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
297 |
correct="true" |
298 |
elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
299 |
die "Aborting initialization." |
300 |
else |
301 |
echo "Answer not recognized" |
302 |
fi |
303 |
done |
304 |
|
305 |
if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then |
306 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
307 |
eerror "Modify DATA_DIR to point to an empty directory." |
308 |
die "${DATA_DIR} is not empty." |
309 |
fi |
310 |
|
311 |
[[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128 |
312 |
einfo "Checking system parameters..." |
313 |
|
314 |
if ! use kernel_linux ; then |
315 |
einfo "Skipped." |
316 |
einfo " Tests not supported on this OS (yet)" |
317 |
else |
318 |
if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then |
319 |
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..." |
320 |
|
321 |
local SEMMSL=$(sysctl -n kernel.sem | cut -f1) |
322 |
local SEMMNS=$(sysctl -n kernel.sem | cut -f2) |
323 |
local SEMMNI=$(sysctl -n kernel.sem | cut -f4) |
324 |
local SHMMAX=$(sysctl -n kernel.shmmax) |
325 |
|
326 |
local SEMMSL_MIN=17 |
327 |
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 )) |
328 |
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 )) |
329 |
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) )) |
330 |
|
331 |
for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do |
332 |
if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then |
333 |
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)" |
334 |
eerror "You have now several options:" |
335 |
eerror " - Change the mentioned system parameter" |
336 |
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a" |
337 |
eerror " value lower than ${PG_MAX_CONNECTIONS}" |
338 |
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely" |
339 |
eerror "More information can be found here:" |
340 |
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html" |
341 |
die "System test failed." |
342 |
fi |
343 |
done |
344 |
einfo "Passed." |
345 |
else |
346 |
ewarn "SKIP_SYSTEM_TESTS set, so skipping." |
347 |
fi |
348 |
fi |
349 |
|
350 |
if [[ ${EUID} == 0 ]] ; then |
351 |
einfo "Creating the data directory ..." |
352 |
mkdir -p "${DATA_DIR}" |
353 |
chown -Rf postgres:postgres "${DATA_DIR}" |
354 |
chmod 0700 "${DATA_DIR}" |
355 |
fi |
356 |
|
357 |
einfo "Initializing the database ..." |
358 |
if [[ ${EUID} == 0 ]] ; then |
359 |
su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
360 |
else |
361 |
"${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
362 |
fi |
363 |
mv "${DATA_DIR%/}"/*.conf "${PGDATA}" |
364 |
|
365 |
einfo "The autovacuum function, which was in contrib, has been moved to the main" |
366 |
einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled by" |
367 |
einfo "default. You can disable it in the cluster's:" |
368 |
einfo " ${PGDATA%/}/postgresql.conf" |
369 |
einfo |
370 |
einfo "The PostgreSQL server, by default, will log events to:" |
371 |
einfo " ${DATA_DIR%/}/postmaster.log" |
372 |
einfo |
373 |
if use prefix ; then |
374 |
einfo "The location of the configuration files have moved to:" |
375 |
einfo " ${PGDATA}" |
376 |
einfo |
377 |
einfo "To start the server:" |
378 |
einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
379 |
einfo |
380 |
einfo "To stop:" |
381 |
einfo " pg_ctl stop -D ${DATA_DIR}" |
382 |
einfo |
383 |
einfo "Or move the configuration files back:" |
384 |
einfo " mv ${PGDATA}*.conf ${DATA_DIR}" |
385 |
else |
386 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
387 |
einfo "instead of 'pg_ctl'." |
388 |
fi |
389 |
} |
390 |
|
391 |
src_test() { |
392 |
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
393 |
|
394 |
if [[ ${UID} != 0 ]] ; then |
395 |
emake check || die "Make check failed. See above for details." |
396 |
|
397 |
einfo "If you think other tests besides the regression tests are necessary, please" |
398 |
einfo "submit a bug including a patch for this ebuild to enable them." |
399 |
else |
400 |
ewarn "Tests cannot be run as root. Skipping." |
401 |
ewarn "HINT: FEATURES=\"userpriv\"" |
402 |
fi |
403 |
} |
404 |
|
405 |
|
406 |
|
407 |
1.1 dev-db/postgresql-server/postgresql-server-8.3.18.ebuild |
408 |
|
409 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.18.ebuild?rev=1.1&view=markup |
410 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.18.ebuild?rev=1.1&content-type=text/plain |
411 |
|
412 |
Index: postgresql-server-8.3.18.ebuild |
413 |
=================================================================== |
414 |
# Copyright 1999-2012 Gentoo Foundation |
415 |
# Distributed under the terms of the GNU General Public License v2 |
416 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-8.3.18.ebuild,v 1.1 2012/02/28 02:04:06 titanofold Exp $ |
417 |
|
418 |
EAPI="4" |
419 |
|
420 |
WANT_AUTOMAKE="none" |
421 |
inherit autotools eutils multilib pam prefix versionator |
422 |
|
423 |
SLOT="$(get_version_component_range 1-2)" |
424 |
|
425 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd" |
426 |
|
427 |
DESCRIPTION="PostgreSQL server" |
428 |
HOMEPAGE="http://www.postgresql.org/" |
429 |
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 |
430 |
http://dev.gentoo.org/~titanofold/postgresql-patches-8.3-r2.tbz2 |
431 |
http://dev.gentoo.org/~titanofold/postgresql-initscript-2.1.tbz2" |
432 |
LICENSE="POSTGRESQL" |
433 |
|
434 |
S="${WORKDIR}/postgresql-${PV}" |
435 |
|
436 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" |
437 |
IUSE="doc kernel_linux nls pam perl python selinux tcl uuid xml" |
438 |
|
439 |
for lingua in ${LINGUAS} ; do |
440 |
IUSE+=" linguas_${lingua}" |
441 |
done |
442 |
|
443 |
wanted_languages() { |
444 |
local enable_langs |
445 |
|
446 |
for lingua in ${LINGUAS} ; do |
447 |
use linguas_${lingua} && enable_langs+="${lingua} " |
448 |
done |
449 |
|
450 |
echo -n ${enable_langs} |
451 |
} |
452 |
|
453 |
RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,nls=] |
454 |
perl? ( >=dev-lang/perl-5.8 ) |
455 |
selinux? ( sec-policy/selinux-postgresql ) |
456 |
tcl? ( >=dev-lang/tcl-8 ) |
457 |
uuid? ( dev-libs/ossp-uuid ) |
458 |
xml? ( dev-libs/libxml2 dev-libs/libxslt )" |
459 |
|
460 |
DEPEND="${RDEPEND} |
461 |
sys-devel/flex |
462 |
xml? ( dev-util/pkgconfig )" |
463 |
|
464 |
PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" |
465 |
|
466 |
# Support /var/run or /run for the socket directory |
467 |
[[ ! -d /run ]] && RUNDIR=/var |
468 |
|
469 |
pkg_setup() { |
470 |
enewgroup postgres 70 |
471 |
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
472 |
} |
473 |
|
474 |
src_prepare() { |
475 |
epatch "${WORKDIR}/autoconf.patch" \ |
476 |
"${WORKDIR}/bool.patch" \ |
477 |
"${WORKDIR}/darwin.patch" \ |
478 |
"${WORKDIR}/pg_ctl-exit-status.patch" \ |
479 |
"${WORKDIR}/server.patch" \ |
480 |
"${WORKDIR}/SuperH.patch" |
481 |
|
482 |
eprefixify src/include/pg_config_manual.h |
483 |
|
484 |
if use test ; then |
485 |
epatch "${WORKDIR}/regress.patch" |
486 |
sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c |
487 |
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \ |
488 |
-i src/test/regress/{input,output}/tablespace.source |
489 |
else |
490 |
echo "all install:" > "${S}/src/test/regress/GNUmakefile" |
491 |
fi |
492 |
|
493 |
sed -e "s|@RUNDIR@|${RUNDIR}|g" \ |
494 |
-i src/include/pg_config_manual.h "${WORKDIR}/postgresql.init" || \ |
495 |
die "RUNDIR sed failed" |
496 |
sed -e "s|@SLOT@|${SLOT}|g" \ |
497 |
-i "${WORKDIR}/postgresql.init" "${WORKDIR}/postgresql.confd" || \ |
498 |
die "SLOT sed failed" |
499 |
|
500 |
eautoconf |
501 |
} |
502 |
|
503 |
src_configure() { |
504 |
# eval is needed to get along with pg_config quotation of space-rich entities. |
505 |
eval econf "$(${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ |
506 |
--with-includes="${EPREFIX%/}/usr/include/postgresql-${SLOT}/" \ |
507 |
--with-system-tzdata="${EPREFIX%/}/usr/share/zoneinfo" \ |
508 |
$(use_with perl) \ |
509 |
$(use_with python) \ |
510 |
$(use_with tcl) \ |
511 |
$(use_with xml libxml) \ |
512 |
$(use_with xml libxslt) \ |
513 |
$(use_with uuid ossp-uuid) \ |
514 |
"$(has_version ~dev-db/postgresql-base-${PV}[nls] && use_enable nls nls "$(wanted_languages)")" |
515 |
} |
516 |
|
517 |
src_compile() { |
518 |
local bd |
519 |
for bd in . contrib $(use xml && echo contrib/xml2); do |
520 |
PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ |
521 |
emake -C $bd -j1 \ |
522 |
PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \ |
523 |
PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \ |
524 |
NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF} |
525 |
done |
526 |
} |
527 |
|
528 |
src_install() { |
529 |
if use perl ; then |
530 |
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig" |
531 |
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ |
532 |
"${S}/src/pl/plperl/GNUmakefile_orig" \ |
533 |
> "${S}/src/pl/plperl/GNUmakefile" |
534 |
fi |
535 |
|
536 |
local bd |
537 |
for bd in . contrib $(use xml && echo contrib/xml2) ; do |
538 |
PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ |
539 |
emake install -C $bd -j1 DESTDIR="${D}" \ |
540 |
PGXS_IN_SERVER=1 PGXS_WITH_SERVER="${S}/src/backend/postgres" \ |
541 |
PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \ |
542 |
NO_PGXS=0 USE_PGXS=1 docdir=${EROOT%/}/usr/share/doc/${PF} |
543 |
done |
544 |
|
545 |
rm -r "${ED}/usr/share/postgresql-${SLOT}/man/man7/" \ |
546 |
"${ED}/usr/share/doc/${PF}/html" |
547 |
rm "${ED}"/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 |
548 |
docompress /usr/share/postgresql-${SLOT}/man/man1 |
549 |
|
550 |
dodoc README HISTORY doc/{README.*,TODO,bug.template} |
551 |
|
552 |
dodir /etc/eselect/postgresql/slots/${SLOT} |
553 |
echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \ |
554 |
> "${ED}/etc/eselect/postgresql/slots/${SLOT}/server" |
555 |
|
556 |
newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} |
557 |
newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} |
558 |
|
559 |
use pam && pamd_mimic system-auth postgresql auth account session |
560 |
|
561 |
if use prefix ; then |
562 |
keepdir ${RUNDIR}/run/postgresql |
563 |
fperms 0770 ${RUNDIR}/run/postgresql |
564 |
fi |
565 |
} |
566 |
|
567 |
pkg_postinst() { |
568 |
postgresql-config update |
569 |
|
570 |
elog "Gentoo specific documentation:" |
571 |
elog "http://www.gentoo.org/doc/en/postgres-howto.xml" |
572 |
elog |
573 |
elog "Official documentation:" |
574 |
elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
575 |
elog |
576 |
elog "The default location of the Unix-domain socket is:" |
577 |
elog " ${EROOT%/}${RUNDIR}/run/postgresql/" |
578 |
elog |
579 |
elog "If you have users and/or services that you would like to utilize the" |
580 |
elog "socket, you must add them to the 'postgres' system group:" |
581 |
elog " usermod -a -G postgres <user>" |
582 |
elog |
583 |
elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
584 |
elog "so that it contains your preferred locale in:" |
585 |
elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
586 |
elog |
587 |
elog "Then, execute the following command to setup the initial database" |
588 |
elog "environment:" |
589 |
elog " emerge --config =${CATEGORY}/${PF}" |
590 |
} |
591 |
|
592 |
pkg_postrm() { |
593 |
postgresql-config update |
594 |
} |
595 |
|
596 |
pkg_config() { |
597 |
[[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
598 |
[[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
599 |
[[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
600 |
|
601 |
# environment.bz2 may not contain the same locale as the current system |
602 |
# locale. Unset and source from the current system locale. |
603 |
if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then |
604 |
unset LANG |
605 |
unset LC_CTYPE |
606 |
unset LC_NUMERIC |
607 |
unset LC_TIME |
608 |
unset LC_COLLATE |
609 |
unset LC_MONETARY |
610 |
unset LC_MESSAGES |
611 |
unset LC_ALL |
612 |
source ${EROOT%/}/etc/env.d/02locale |
613 |
[[ -n ${LANG} ]] && export LANG |
614 |
[[ -n ${LC_CTYPE} ]] && export LC_CTYPE |
615 |
[[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC |
616 |
[[ -n ${LC_TIME} ]] && export LC_TIME |
617 |
[[ -n ${LC_COLLATE} ]] && export LC_COLLATE |
618 |
[[ -n ${LC_MONETARY} ]] && export LC_MONETARY |
619 |
[[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES |
620 |
[[ -n ${LC_ALL} ]] && export LC_ALL |
621 |
fi |
622 |
|
623 |
einfo "You can modify the paths and options passed to initdb by editing:" |
624 |
einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
625 |
einfo |
626 |
einfo "Information on options that can be passed to initdb are found at:" |
627 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
628 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
629 |
einfo |
630 |
einfo "PG_INITDB_OPTS is currently set to:" |
631 |
if [[ -z ${PG_INITDB_OPTS} ]] ; then |
632 |
einfo " (none)" |
633 |
else |
634 |
einfo " ${PG_INITDB_OPTS}" |
635 |
fi |
636 |
einfo |
637 |
einfo "Configuration files will be installed to:" |
638 |
einfo " ${PGDATA}" |
639 |
einfo |
640 |
einfo "The database cluster will be created in:" |
641 |
einfo " ${DATA_DIR}" |
642 |
einfo |
643 |
while [[ $correct != "true" ]] ; do |
644 |
einfo "Are you ready to continue? (y/n)" |
645 |
read answer |
646 |
if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
647 |
correct="true" |
648 |
elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
649 |
die "Aborting initialization." |
650 |
else |
651 |
echo "Answer not recognized." |
652 |
fi |
653 |
done |
654 |
|
655 |
if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then |
656 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
657 |
eerror "Modify DATA_DIR to point to an empty directory." |
658 |
die "${DATA_DIR} is not empty." |
659 |
fi |
660 |
|
661 |
[[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128 |
662 |
einfo "Checking system parameters..." |
663 |
|
664 |
if ! use kernel_linux ; then |
665 |
einfo "Skipped." |
666 |
einfo "Tests not supported on this OS (yet)." |
667 |
else |
668 |
if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then |
669 |
ebegin "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections" |
670 |
|
671 |
local SEMMSL=$(sysctl -n kernel.sem | cut -f1) |
672 |
local SEMMNS=$(sysctl -n kernel.sem | cut -f2) |
673 |
local SEMMNI=$(sysctl -n kernel.sem | cut -f4) |
674 |
local SHMMAX=$(sysctl -n kernel.shmmax) |
675 |
|
676 |
local SEMMSL_MIN=17 |
677 |
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 )) |
678 |
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 )) |
679 |
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) )) |
680 |
|
681 |
for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do |
682 |
if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then |
683 |
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)" |
684 |
eerror "You have now several options:" |
685 |
eerror " - Change the mentioned system parameter" |
686 |
eerror " - Lower the number of max connections by setting PG_MAX_CONNECTIONS to a" |
687 |
eerror " value lower than ${PG_MAX_CONNECTIONS}" |
688 |
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely" |
689 |
eerror "More information can be found here:" |
690 |
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html" |
691 |
die "System test failed." |
692 |
fi |
693 |
done |
694 |
eend |
695 |
else |
696 |
ewarn "SKIP_SYSTEM_TESTS is set, so skipping." |
697 |
fi |
698 |
fi |
699 |
|
700 |
if [[ ${EUID} == 0 ]] ; then |
701 |
einfo "Creating the data directory ..." |
702 |
mkdir -p "${DATA_DIR}" |
703 |
chown -Rf postgres:postgres "${DATA_DIR}" |
704 |
chmod 0700 "${DATA_DIR}" |
705 |
fi |
706 |
|
707 |
einfo "Initializing the database ..." |
708 |
if [[ ${EUID} == 0 ]] ; then |
709 |
su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
710 |
else |
711 |
"${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
712 |
fi |
713 |
mv "${DATA_DIR%/}"/*.conf "${PGDATA}" |
714 |
|
715 |
einfo "The autovacuum function, which was in contrib, has been moved to the main" |
716 |
einfo "PostgreSQL functions starting with 8.1. You can enable it in the clusters" |
717 |
einfo "postgresql.conf." |
718 |
einfo |
719 |
if use prefix ; then |
720 |
einfo "The location of the configuration files have moved to:" |
721 |
einfo " ${PGDATA}" |
722 |
einfo |
723 |
einfo "To start the server:" |
724 |
einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
725 |
einfo |
726 |
einfo "To stop:" |
727 |
einfo " pg_ctl stop -D ${DATA_DIR}" |
728 |
einfo |
729 |
einfo "Or move the configuration files back:" |
730 |
einfo " mv ${PGDATA}*.conf ${DATA_DIR}" |
731 |
else |
732 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
733 |
einfo "instead of 'pg_ctl'." |
734 |
fi |
735 |
} |
736 |
|
737 |
src_test() { |
738 |
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
739 |
|
740 |
if [[ ${UID} != 0 ]] ; then |
741 |
PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/:${PATH}" \ |
742 |
emake check \ |
743 |
PGXS=$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --pgxs) \ |
744 |
NO_PGXS=0 USE_PGXS=1 SLOT=${SLOT} |
745 |
|
746 |
einfo "If you think other tests besides the regression tests are necessary, please" |
747 |
einfo "submit a bug including a patch for this ebuild to enable them." |
748 |
else |
749 |
ewarn "Tests cannot be run as root. Skipping." |
750 |
ewarn "HINT: FEATURES=\"userpriv\"" |
751 |
fi |
752 |
} |
753 |
|
754 |
|
755 |
|
756 |
1.1 dev-db/postgresql-server/postgresql-server-9.1.3.ebuild |
757 |
|
758 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1.3.ebuild?rev=1.1&view=markup |
759 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1.3.ebuild?rev=1.1&content-type=text/plain |
760 |
|
761 |
Index: postgresql-server-9.1.3.ebuild |
762 |
=================================================================== |
763 |
# Copyright 1999-2012 Gentoo Foundation |
764 |
# Distributed under the terms of the GNU General Public License v2 |
765 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1.3.ebuild,v 1.1 2012/02/28 02:04:06 titanofold Exp $ |
766 |
|
767 |
EAPI="4" |
768 |
PYTHON_DEPEND="python? 2" |
769 |
|
770 |
WANT_AUTOMAKE="none" |
771 |
inherit autotools eutils flag-o-matic multilib pam prefix python versionator |
772 |
|
773 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~ppc-macos ~x86-solaris" |
774 |
|
775 |
SLOT="$(get_version_component_range 1-2)" |
776 |
S="${WORKDIR}/postgresql-${PV}" |
777 |
|
778 |
DESCRIPTION="PostgreSQL server" |
779 |
HOMEPAGE="http://www.postgresql.org/" |
780 |
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 |
781 |
http://dev.gentoo.org/~titanofold/postgresql-patches-9.1-r1.tbz2 |
782 |
http://dev.gentoo.org/~titanofold/postgresql-initscript-2.1.tbz2" |
783 |
LICENSE="POSTGRESQL" |
784 |
|
785 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" |
786 |
IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml" |
787 |
|
788 |
for lingua in ${LINGUAS}; do |
789 |
IUSE+=" linguas_${lingua}" |
790 |
done |
791 |
|
792 |
wanted_languages() { |
793 |
local enable_langs |
794 |
|
795 |
for lingua in ${LINGUAS} ; do |
796 |
use linguas_${lingua} && enable_langs+="${lingua} " |
797 |
done |
798 |
|
799 |
echo -n ${enable_langs} |
800 |
} |
801 |
|
802 |
RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=] |
803 |
perl? ( >=dev-lang/perl-5.8 ) |
804 |
selinux? ( sec-policy/selinux-postgresql ) |
805 |
tcl? ( >=dev-lang/tcl-8 ) |
806 |
uuid? ( dev-libs/ossp-uuid ) |
807 |
xml? ( dev-libs/libxml2 dev-libs/libxslt )" |
808 |
DEPEND="${RDEPEND} |
809 |
sys-devel/flex |
810 |
xml? ( dev-util/pkgconfig )" |
811 |
PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" |
812 |
|
813 |
# Support /var/run or /run for the socket directory |
814 |
[[ ! -d /run ]] && RUNDIR=/var |
815 |
|
816 |
pkg_setup() { |
817 |
enewgroup postgres 70 |
818 |
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
819 |
|
820 |
use python && python_set_active_version 2 |
821 |
} |
822 |
|
823 |
src_prepare() { |
824 |
epatch "${WORKDIR}/autoconf.patch" \ |
825 |
"${WORKDIR}/bool.patch" \ |
826 |
"${WORKDIR}/pg_ctl-exit-status.patch" \ |
827 |
"${WORKDIR}/server.patch" |
828 |
|
829 |
eprefixify src/include/pg_config_manual.h |
830 |
|
831 |
if use test ; then |
832 |
epatch "${WORKDIR}/regress.patch" |
833 |
sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c |
834 |
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \ |
835 |
-i src/test/regress/{input,output}/tablespace.source |
836 |
else |
837 |
echo "all install:" > "${S}/src/test/regress/GNUmakefile" |
838 |
fi |
839 |
|
840 |
sed -e "s|@RUNDIR@|${RUNDIR}|g" \ |
841 |
-i src/include/pg_config_manual.h "${WORKDIR}/postgresql.init" || \ |
842 |
die "RUNDIR sed failed" |
843 |
sed -e "s|@SLOT@|${SLOT}|g" \ |
844 |
-i "${WORKDIR}/postgresql.init" "${WORKDIR}/postgresql.confd" || \ |
845 |
die "SLOT sed failed" |
846 |
|
847 |
eautoconf |
848 |
} |
849 |
|
850 |
src_configure() { |
851 |
case ${CHOST} in |
852 |
*-darwin*|*-solaris*) |
853 |
use nls && append-libs intl |
854 |
;; |
855 |
esac |
856 |
|
857 |
local PO="${EPREFIX%/}" |
858 |
|
859 |
# eval is needed to get along with pg_config quotation of space-rich entities. |
860 |
eval econf "$(${PO}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ |
861 |
$(use_with perl) \ |
862 |
$(use_with python) \ |
863 |
$(use_with tcl) \ |
864 |
$(use_with xml libxml) \ |
865 |
$(use_with xml libxslt) \ |
866 |
$(use_with uuid ossp-uuid) \ |
867 |
--with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
868 |
--with-includes="${PO}/usr/include/postgresql-${SLOT}/" \ |
869 |
--with-libraries="${PO}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \ |
870 |
"$(use_enable nls nls "$(wanted_languages)")" |
871 |
} |
872 |
|
873 |
src_compile() { |
874 |
local bd |
875 |
for bd in . contrib $(use xml && echo contrib/xml2); do |
876 |
PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ |
877 |
emake -C $bd || die "emake in $bd failed" |
878 |
done |
879 |
} |
880 |
|
881 |
src_install() { |
882 |
if use perl ; then |
883 |
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig" |
884 |
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ |
885 |
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile" |
886 |
fi |
887 |
|
888 |
local bd |
889 |
for bd in . contrib $(use xml && echo contrib/xml2) ; do |
890 |
PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ |
891 |
emake install -C $bd DESTDIR="${D}" || die "emake install in $bd failed" |
892 |
done |
893 |
|
894 |
dodoc README HISTORY doc/{TODO,bug.template} |
895 |
|
896 |
dodir /etc/eselect/postgresql/slots/${SLOT} |
897 |
echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
898 |
"${ED}/etc/eselect/postgresql/slots/${SLOT}/server" |
899 |
|
900 |
newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} || \ |
901 |
die "Inserting conf failed" |
902 |
newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} || \ |
903 |
die "Inserting conf failed" |
904 |
|
905 |
use pam && pamd_mimic system-auth postgresql auth account session |
906 |
|
907 |
if use prefix ; then |
908 |
keepdir ${RUNDIR}/run/postgresql |
909 |
fperms 0770 ${RUNDIR}/run/postgresql |
910 |
fi |
911 |
} |
912 |
|
913 |
pkg_postinst() { |
914 |
postgresql-config update |
915 |
|
916 |
elog "Gentoo specific documentation:" |
917 |
elog "http://www.gentoo.org/doc/en/postgres-howto.xml" |
918 |
elog |
919 |
elog "Official documentation:" |
920 |
elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
921 |
elog |
922 |
elog "The default location of the Unix-domain socket is:" |
923 |
elog " ${EROOT%/}${RUNDIR}/run/postgresql/" |
924 |
elog |
925 |
elog "If you have users and/or services that you would like to utilize the" |
926 |
elog "socket, you must add them to the 'postgres' system group:" |
927 |
elog " usermod -a -G postgres <user>" |
928 |
elog |
929 |
elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
930 |
elog "so that it contains your preferred locale in:" |
931 |
elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
932 |
elog |
933 |
elog "Then, execute the following command to setup the initial database" |
934 |
elog "environment:" |
935 |
elog " emerge --config =${CATEGORY}/${PF}" |
936 |
} |
937 |
|
938 |
pkg_prerm() { |
939 |
if [[ -z ${REPLACED_BY_VERSION} ]] ; then |
940 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
941 |
ewarn "\thttp://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5" |
942 |
|
943 |
ebegin "Resuming removal 10 seconds. Control-C to cancel" |
944 |
sleep 10 |
945 |
eend 0 |
946 |
fi |
947 |
} |
948 |
|
949 |
pkg_postrm() { |
950 |
postgresql-config update |
951 |
} |
952 |
|
953 |
pkg_config() { |
954 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
955 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
956 |
[[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
957 |
|
958 |
# environment.bz2 may not contain the same locale as the current system |
959 |
# locale. Unset and source from the current system locale. |
960 |
if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
961 |
unset LANG |
962 |
unset LC_CTYPE |
963 |
unset LC_NUMERIC |
964 |
unset LC_TIME |
965 |
unset LC_COLLATE |
966 |
unset LC_MONETARY |
967 |
unset LC_MESSAGES |
968 |
unset LC_ALL |
969 |
source "${EROOT%/}/etc/env.d/02locale" |
970 |
[ -n "${LANG}" ] && export LANG |
971 |
[ -n "${LC_CTYPE}" ] && export LC_CTYPE |
972 |
[ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
973 |
[ -n "${LC_TIME}" ] && export LC_TIME |
974 |
[ -n "${LC_COLLATE}" ] && export LC_COLLATE |
975 |
[ -n "${LC_MONETARY}" ] && export LC_MONETARY |
976 |
[ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
977 |
[ -n "${LC_ALL}" ] && export LC_ALL |
978 |
fi |
979 |
|
980 |
einfo "You can modify the paths and options passed to initdb by editing:" |
981 |
einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
982 |
einfo |
983 |
einfo "Information on options that can be passed to initdb are found at:" |
984 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
985 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
986 |
einfo |
987 |
einfo "PG_INITDB_OPTS is currently set to:" |
988 |
if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
989 |
einfo " (none)" |
990 |
else |
991 |
einfo " ${PG_INITDB_OPTS}" |
992 |
fi |
993 |
einfo |
994 |
einfo "Configuration files will be installed to:" |
995 |
einfo " ${PGDATA}" |
996 |
einfo |
997 |
einfo "The database cluster will be created in:" |
998 |
einfo " ${DATA_DIR}" |
999 |
einfo |
1000 |
while [ "$correct" != "true" ] ; do |
1001 |
einfo "Are you ready to continue? (y/n)" |
1002 |
read answer |
1003 |
if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
1004 |
correct="true" |
1005 |
elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
1006 |
die "Aborting initialization." |
1007 |
else |
1008 |
echo "Answer not recognized" |
1009 |
fi |
1010 |
done |
1011 |
|
1012 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1013 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
1014 |
eerror "Modify DATA_DIR to point to an empty directory." |
1015 |
die "${DATA_DIR} is not empty." |
1016 |
fi |
1017 |
|
1018 |
[ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128" |
1019 |
einfo "Checking system parameters..." |
1020 |
|
1021 |
if ! use kernel_linux ; then |
1022 |
einfo "Skipped." |
1023 |
einfo " Tests not supported on this OS (yet)" |
1024 |
else |
1025 |
if [ -z ${SKIP_SYSTEM_TESTS} ] ; then |
1026 |
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..." |
1027 |
|
1028 |
local SEMMSL=$(sysctl -n kernel.sem | cut -f1) |
1029 |
local SEMMNS=$(sysctl -n kernel.sem | cut -f2) |
1030 |
local SEMMNI=$(sysctl -n kernel.sem | cut -f4) |
1031 |
local SHMMAX=$(sysctl -n kernel.shmmax) |
1032 |
|
1033 |
local SEMMSL_MIN=17 |
1034 |
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 )) |
1035 |
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 )) |
1036 |
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) )) |
1037 |
|
1038 |
for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do |
1039 |
if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then |
1040 |
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)" |
1041 |
eerror "You have now several options:" |
1042 |
eerror " - Change the mentioned system parameter" |
1043 |
eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a" |
1044 |
eerror " value lower than ${PG_MAX_CONNECTIONS}" |
1045 |
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely" |
1046 |
eerror "More information can be found here:" |
1047 |
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html" |
1048 |
die "System test failed." |
1049 |
fi |
1050 |
done |
1051 |
einfo "Passed." |
1052 |
else |
1053 |
ewarn "SKIP_SYSTEM_TESTS set, so skipping." |
1054 |
fi |
1055 |
fi |
1056 |
|
1057 |
einfo "Creating the data directory ..." |
1058 |
if [[ ${EUID} == 0 ]] ; then |
1059 |
mkdir -p "${DATA_DIR}" |
1060 |
chown -Rf postgres:postgres "${DATA_DIR}" |
1061 |
chmod 0700 "${DATA_DIR}" |
1062 |
fi |
1063 |
|
1064 |
einfo "Initializing the database ..." |
1065 |
|
1066 |
if [[ ${EUID} == 0 ]] ; then |
1067 |
su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1068 |
else |
1069 |
"${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1070 |
fi |
1071 |
|
1072 |
mv "${DATA_DIR%/}"/*.conf "${PGDATA}" |
1073 |
|
1074 |
einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1075 |
einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1076 |
einfo "by default. You can disable it in the cluster's:" |
1077 |
einfo " ${PGDATA%/}/postgresql.conf" |
1078 |
einfo |
1079 |
einfo "The PostgreSQL server, by default, will log events to:" |
1080 |
einfo " ${DATA_DIR%/}/postmaster.log" |
1081 |
einfo |
1082 |
if use prefix ; then |
1083 |
einfo "The location of the configuration files have moved to:" |
1084 |
einfo " ${PGDATA}" |
1085 |
einfo "To start the server:" |
1086 |
einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1087 |
einfo "To stop:" |
1088 |
einfo " pg_ctl stop -D ${DATA_DIR}" |
1089 |
einfo |
1090 |
einfo "Or move the configuration files back:" |
1091 |
einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1092 |
else |
1093 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1094 |
einfo "instead of 'pg_ctl'." |
1095 |
fi |
1096 |
} |
1097 |
|
1098 |
src_test() { |
1099 |
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
1100 |
|
1101 |
if [ ${UID} -ne 0 ] ; then |
1102 |
emake -j1 check || die "Make check failed. See above for details." |
1103 |
|
1104 |
einfo "If you think other tests besides the regression tests are necessary, please" |
1105 |
einfo "submit a bug including a patch for this ebuild to enable them." |
1106 |
else |
1107 |
ewarn "Tests cannot be run as root. Skipping." |
1108 |
ewarn "HINT: FEATURES=\"userpriv\"" |
1109 |
fi |
1110 |
} |
1111 |
|
1112 |
|
1113 |
|
1114 |
1.1 dev-db/postgresql-server/postgresql-server-9.0.7.ebuild |
1115 |
|
1116 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.7.ebuild?rev=1.1&view=markup |
1117 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.7.ebuild?rev=1.1&content-type=text/plain |
1118 |
|
1119 |
Index: postgresql-server-9.0.7.ebuild |
1120 |
=================================================================== |
1121 |
# Copyright 1999-2012 Gentoo Foundation |
1122 |
# Distributed under the terms of the GNU General Public License v2 |
1123 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.0.7.ebuild,v 1.1 2012/02/28 02:04:06 titanofold Exp $ |
1124 |
|
1125 |
EAPI="4" |
1126 |
PYTHON_DEPEND="python? 2" |
1127 |
|
1128 |
WANT_AUTOMAKE="none" |
1129 |
inherit autotools eutils multilib pam prefix python versionator |
1130 |
|
1131 |
SLOT="$(get_version_component_range 1-2)" |
1132 |
|
1133 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~ppc-macos ~x86-solaris" |
1134 |
|
1135 |
DESCRIPTION="PostgreSQL server" |
1136 |
HOMEPAGE="http://www.postgresql.org/" |
1137 |
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2 |
1138 |
http://dev.gentoo.org/~titanofold/postgresql-patches-9.0-r3.tbz2 |
1139 |
http://dev.gentoo.org/~titanofold/postgresql-initscript-2.1.tbz2" |
1140 |
LICENSE="POSTGRESQL" |
1141 |
|
1142 |
S="${WORKDIR}/postgresql-${PV}" |
1143 |
|
1144 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW" |
1145 |
IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml" |
1146 |
|
1147 |
for lingua in ${LINGUAS}; do |
1148 |
IUSE+=" linguas_${lingua}" |
1149 |
done |
1150 |
|
1151 |
wanted_languages() { |
1152 |
local enable_langs |
1153 |
|
1154 |
for lingua in ${LINGUAS} ; do |
1155 |
use linguas_${lingua} && enable_langs+="${lingua} " |
1156 |
done |
1157 |
|
1158 |
echo -n ${enable_langs} |
1159 |
} |
1160 |
|
1161 |
RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=] |
1162 |
perl? ( >=dev-lang/perl-5.8 ) |
1163 |
selinux? ( sec-policy/selinux-postgresql ) |
1164 |
tcl? ( >=dev-lang/tcl-8 ) |
1165 |
uuid? ( dev-libs/ossp-uuid ) |
1166 |
xml? ( dev-libs/libxml2 dev-libs/libxslt )" |
1167 |
|
1168 |
DEPEND="${RDEPEND} |
1169 |
sys-devel/flex |
1170 |
xml? ( dev-util/pkgconfig )" |
1171 |
|
1172 |
PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )" |
1173 |
|
1174 |
# Support /var/run or /run for the socket directory |
1175 |
[[ ! -d /run ]] && RUNDIR=/var |
1176 |
|
1177 |
pkg_setup() { |
1178 |
enewgroup postgres 70 |
1179 |
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
1180 |
|
1181 |
use python && python_set_active_version 2 |
1182 |
} |
1183 |
|
1184 |
src_prepare() { |
1185 |
epatch "${WORKDIR}/autoconf.patch" \ |
1186 |
"${WORKDIR}/bool.patch" \ |
1187 |
"${WORKDIR}/pg_ctl-exit-status.patch" \ |
1188 |
"${WORKDIR}/server.patch" |
1189 |
|
1190 |
eprefixify src/include/pg_config_manual.h |
1191 |
|
1192 |
if use test ; then |
1193 |
epatch "${WORKDIR}/regress.patch" |
1194 |
sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c |
1195 |
sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" \ |
1196 |
-i src/test/regress/{input,output}/tablespace.source |
1197 |
else |
1198 |
echo "all install:" > "${S}/src/test/regress/GNUmakefile" |
1199 |
fi |
1200 |
|
1201 |
sed -e "s|@RUNDIR@|${RUNDIR}|g" \ |
1202 |
-i src/include/pg_config_manual.h "${WORKDIR}/postgresql.init" || \ |
1203 |
die "RUNDIR sed failed" |
1204 |
sed -e "s|@SLOT@|${SLOT}|g" \ |
1205 |
-i "${WORKDIR}/postgresql.init" "${WORKDIR}/postgresql.confd" || \ |
1206 |
die "SLOT sed failed" |
1207 |
|
1208 |
eautoconf |
1209 |
} |
1210 |
|
1211 |
src_configure() { |
1212 |
# eval is needed to get along with pg_config quotation of space-rich entities. |
1213 |
eval econf "$(${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \ |
1214 |
--with-includes="${EPREFIX%/}/usr/include/postgresql-${SLOT}/" \ |
1215 |
--with-libraries="${EPREFIX%/}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \ |
1216 |
--with-system-tzdata="${EPREFIX%/}/usr/share/zoneinfo" \ |
1217 |
$(use_with perl) \ |
1218 |
$(use_with python) \ |
1219 |
$(use_with tcl) \ |
1220 |
$(use_with xml libxml) \ |
1221 |
$(use_with xml libxslt) \ |
1222 |
$(use_with uuid ossp-uuid) \ |
1223 |
"$(use_enable nls nls "$(wanted_languages)")" |
1224 |
} |
1225 |
|
1226 |
src_compile() { |
1227 |
local bd |
1228 |
for bd in . contrib $(use xml && echo contrib/xml2); do |
1229 |
PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ |
1230 |
emake -C $bd -j1 || die "emake in $bd failed" |
1231 |
done |
1232 |
} |
1233 |
|
1234 |
src_install() { |
1235 |
if use perl ; then |
1236 |
mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig" |
1237 |
sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \ |
1238 |
"${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile" |
1239 |
fi |
1240 |
|
1241 |
local bd |
1242 |
for bd in . contrib $(use xml && echo contrib/xml2) ; do |
1243 |
PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \ |
1244 |
emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed" |
1245 |
done |
1246 |
|
1247 |
dodir /usr/share/postgresql-${SLOT}/man/man1/ |
1248 |
cp "${S}"/doc/src/sgml/man1/{initdb,pg_controldata,pg_ctl,pg_resetxlog,post{gres,master}}.1 \ |
1249 |
"${ED}"/usr/share/postgresql-${SLOT}/man/man1/ || die |
1250 |
|
1251 |
dodoc README HISTORY doc/{README.*,TODO,bug.template} |
1252 |
|
1253 |
dodir /etc/eselect/postgresql/slots/${SLOT} |
1254 |
echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" \ |
1255 |
> "${ED}/etc/eselect/postgresql/slots/${SLOT}/server" |
1256 |
|
1257 |
newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} \ |
1258 |
|| die "Inserting conf.d file failed" |
1259 |
|
1260 |
newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} \ |
1261 |
|| die "Inserting init.d file failed" |
1262 |
|
1263 |
use pam && pamd_mimic system-auth postgresql auth account session |
1264 |
|
1265 |
if use prefix ; then |
1266 |
keepdir ${RUNDIR}/run/postgresql |
1267 |
fperms 0770 ${RUNDIR}/run/postgresql |
1268 |
fi |
1269 |
} |
1270 |
|
1271 |
pkg_postinst() { |
1272 |
postgresql-config update |
1273 |
|
1274 |
elog "Gentoo specific documentation:" |
1275 |
elog "http://www.gentoo.org/doc/en/postgres-howto.xml" |
1276 |
elog |
1277 |
elog "Official documentation:" |
1278 |
elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1279 |
elog |
1280 |
elog "The default location of the Unix-domain socket is:" |
1281 |
elog " ${EROOT%/}${RUNDIR}/run/postgresql/" |
1282 |
elog |
1283 |
elog "If you have users and/or services that you would like to utilize the" |
1284 |
elog "socket, you must add them to the 'postgres' system group:" |
1285 |
elog " usermod -a -G postgres <user>" |
1286 |
elog |
1287 |
elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1288 |
elog "so that it contains your preferred locale in:" |
1289 |
elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1290 |
elog |
1291 |
elog "Then, execute the following command to setup the initial database" |
1292 |
elog "environment:" |
1293 |
elog " emerge --config =${CATEGORY}/${PF}" |
1294 |
} |
1295 |
|
1296 |
pkg_postrm() { |
1297 |
postgresql-config update |
1298 |
} |
1299 |
|
1300 |
pkg_config() { |
1301 |
[[ -f ${EROOT%/}/etc/conf.d/postgresql-${SLOT} ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1302 |
[[ -z ${PGDATA} ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
1303 |
[[ -z ${DATA_DIR} ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
1304 |
|
1305 |
# environment.bz2 may not contain the same locale as the current system |
1306 |
# locale. Unset and source from the current system locale. |
1307 |
if [[ -f ${EROOT%/}/etc/env.d/02locale ]] ; then |
1308 |
unset LANG |
1309 |
unset LC_CTYPE |
1310 |
unset LC_NUMERIC |
1311 |
unset LC_TIME |
1312 |
unset LC_COLLATE |
1313 |
unset LC_MONETARY |
1314 |
unset LC_MESSAGES |
1315 |
unset LC_ALL |
1316 |
source "${EROOT%/}/etc/env.d/02locale" |
1317 |
[[ -n ${LANG} ]] && export LANG |
1318 |
[[ -n ${LC_CTYPE} ]] && export LC_CTYPE |
1319 |
[[ -n ${LC_NUMERIC} ]] && export LC_NUMERIC |
1320 |
[[ -n ${LC_TIME} ]] && export LC_TIME |
1321 |
[[ -n ${LC_COLLATE} ]] && export LC_COLLATE |
1322 |
[[ -n ${LC_MONETARY} ]] && export LC_MONETARY |
1323 |
[[ -n ${LC_MESSAGES} ]] && export LC_MESSAGES |
1324 |
[[ -n ${LC_ALL} ]] && export LC_ALL |
1325 |
fi |
1326 |
|
1327 |
einfo "You can modify the paths and options passed to initdb by editing:" |
1328 |
einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1329 |
einfo |
1330 |
einfo "Information on options that can be passed to initdb are found at:" |
1331 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1332 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1333 |
einfo |
1334 |
einfo "PG_INITDB_OPTS is currently set to:" |
1335 |
if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1336 |
einfo " (none)" |
1337 |
else |
1338 |
einfo " ${PG_INITDB_OPTS}" |
1339 |
fi |
1340 |
einfo |
1341 |
einfo "Configuration files will be installed to:" |
1342 |
einfo " ${PGDATA}" |
1343 |
einfo |
1344 |
einfo "The database cluster will be created in:" |
1345 |
einfo " ${DATA_DIR}" |
1346 |
einfo |
1347 |
while [[ $correct != "true" ]] ; do |
1348 |
einfo "Are you ready to continue? (y/n)" |
1349 |
read answer |
1350 |
if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
1351 |
correct="true" |
1352 |
elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
1353 |
die "Aborting initialization." |
1354 |
else |
1355 |
echo "Answer not recognized" |
1356 |
fi |
1357 |
done |
1358 |
|
1359 |
if [[ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ]] ; then |
1360 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
1361 |
eerror "Modify DATA_DIR to point to an empty directory." |
1362 |
die "${DATA_DIR} is not empty." |
1363 |
fi |
1364 |
|
1365 |
[[ -z ${PG_MAX_CONNECTIONS} ]] && PG_MAX_CONNECTIONS=128 |
1366 |
einfo "Checking system parameters..." |
1367 |
|
1368 |
if ! use kernel_linux ; then |
1369 |
einfo "Skipped." |
1370 |
einfo " Tests not supported on this OS (yet)" |
1371 |
else |
1372 |
if [[ -z ${SKIP_SYSTEM_TESTS} ]] ; then |
1373 |
einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..." |
1374 |
|
1375 |
local SEMMSL=$(sysctl -n kernel.sem | cut -f1) |
1376 |
local SEMMNS=$(sysctl -n kernel.sem | cut -f2) |
1377 |
local SEMMNI=$(sysctl -n kernel.sem | cut -f4) |
1378 |
local SHMMAX=$(sysctl -n kernel.shmmax) |
1379 |
|
1380 |
local SEMMSL_MIN=17 |
1381 |
local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 )) |
1382 |
local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 )) |
1383 |
local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) )) |
1384 |
|
1385 |
for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do |
1386 |
if [[ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ]] ; then |
1387 |
eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)" |
1388 |
eerror "You have now several options:" |
1389 |
eerror " - Change the mentioned system parameter" |
1390 |
eerror " - Lower the number of max connections by setting PG_MAX_CONNECTIONS to a" |
1391 |
eerror " value lower than ${PG_MAX_CONNECTIONS}" |
1392 |
eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely" |
1393 |
eerror "More information can be found here:" |
1394 |
eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html" |
1395 |
die "System test failed." |
1396 |
fi |
1397 |
done |
1398 |
einfo "Passed." |
1399 |
else |
1400 |
ewarn "SKIP_SYSTEM_TESTS set, so skipping." |
1401 |
fi |
1402 |
fi |
1403 |
|
1404 |
if [[ ${EUID} == 0 ]] ; then |
1405 |
einfo "Creating the data directory ..." |
1406 |
mkdir -p "${DATA_DIR}" |
1407 |
chown -Rf postgres:postgres "${DATA_DIR}" |
1408 |
chmod 0700 "${DATA_DIR}" |
1409 |
fi |
1410 |
|
1411 |
einfo "Initializing the database ..." |
1412 |
|
1413 |
if [[ ${EUID} == 0 ]] ; then |
1414 |
su postgres \ |
1415 |
-c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D '${DATA_DIR}' -L '${EROOT%/}/usr/share/postgresql-${SLOT}/' ${PG_INITDB_OPTS}" |
1416 |
else |
1417 |
"${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb \ |
1418 |
-U postgres -D "${DATA_DIR}" \ |
1419 |
-L "${EROOT%/}/usr/share/postgresql-${SLOT}/" ${PG_INITDB_OPTS} |
1420 |
fi |
1421 |
|
1422 |
mv "${DATA_DIR%/}"/*.conf "${PGDATA}" |
1423 |
|
1424 |
einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1425 |
einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1426 |
einfo "by default. You can disable it in the cluster's:" |
1427 |
einfo " ${PGDATA%/}/postgresql.conf" |
1428 |
einfo |
1429 |
einfo "The PostgreSQL server, by default, will log events to:" |
1430 |
einfo " ${DATA_DIR%/}/postmaster.log" |
1431 |
einfo |
1432 |
if use prefix ; then |
1433 |
einfo "The location of the configuration files have moved to:" |
1434 |
einfo " ${PGDATA}" |
1435 |
einfo |
1436 |
einfo "To start the server:" |
1437 |
einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1438 |
einfo |
1439 |
einfo "To stop:" |
1440 |
einfo " pg_ctl stop -D ${DATA_DIR}" |
1441 |
einfo |
1442 |
einfo "Or move the configuration files back:" |
1443 |
einfo " mv ${PGDATA}*.conf ${DATA_DIR}" |
1444 |
else |
1445 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1446 |
einfo "instead of 'pg_ctl'." |
1447 |
fi |
1448 |
} |
1449 |
|
1450 |
src_test() { |
1451 |
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
1452 |
|
1453 |
if [[ ${UID} != 0 ]] ; then |
1454 |
emake check || die "Make check failed. See above for details." |
1455 |
|
1456 |
einfo "If you think other tests besides the regression tests are necessary, please" |
1457 |
einfo "submit a bug including a patch for this ebuild to enable them." |
1458 |
else |
1459 |
ewarn "Tests cannot be run as root. Skipping." |
1460 |
ewarn "HINT: FEATURES=\"userpriv\"" |
1461 |
fi |
1462 |
} |