Gentoo Archives: gentoo-commits

From: "Aaron Swenson (titanofold)" <titanofold@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-db/postgresql-server: ChangeLog postgresql-server-9.1_alpha5.ebuild
Date: Thu, 31 Mar 2011 03:17:16
Message-Id: 20110331031704.36B9E20051@flycatcher.gentoo.org
1 titanofold 11/03/31 03:17:04
2
3 Modified: ChangeLog
4 Added: postgresql-server-9.1_alpha5.ebuild
5 Log:
6 Version bump.
7
8 (Portage version: 2.1.9.42/cvs/Linux i686)
9
10 Revision Changes Path
11 1.118 dev-db/postgresql-server/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.118&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?rev=1.118&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/ChangeLog?r1=1.117&r2=1.118
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v
20 retrieving revision 1.117
21 retrieving revision 1.118
22 diff -u -r1.117 -r1.118
23 --- ChangeLog 27 Mar 2011 01:38:27 -0000 1.117
24 +++ ChangeLog 31 Mar 2011 03:17:04 -0000 1.118
25 @@ -1,6 +1,12 @@
26 # ChangeLog for dev-db/postgresql-server
27 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.117 2011/03/27 01:38:27 titanofold Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/ChangeLog,v 1.118 2011/03/31 03:17:04 titanofold Exp $
30 +
31 +*postgresql-server-9.1_alpha5 (31 Mar 2011)
32 +
33 + 31 Mar 2011; Aaron W. Swenson <titanofold@g.o>
34 + +postgresql-server-9.1_alpha5.ebuild:
35 + Version bump.
36
37 *postgresql-server-9.1_alpha4-r1 (27 Mar 2011)
38 *postgresql-server-9.0.3-r3 (27 Mar 2011)
39
40
41
42 1.1 dev-db/postgresql-server/postgresql-server-9.1_alpha5.ebuild
43
44 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1_alpha5.ebuild?rev=1.1&view=markup
45 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1_alpha5.ebuild?rev=1.1&content-type=text/plain
46
47 Index: postgresql-server-9.1_alpha5.ebuild
48 ===================================================================
49 # Copyright 1999-2011 Gentoo Foundation
50 # Distributed under the terms of the GNU General Public License v2
51 # $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql-server/postgresql-server-9.1_alpha5.ebuild,v 1.1 2011/03/31 03:17:04 titanofold Exp $
52
53 EAPI="3"
54 PYTHON_DEPEND="python? 2"
55
56 WANT_AUTOMAKE="none"
57 inherit autotools eutils multilib pam prefix python versionator
58
59 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd"
60
61 # Upstream doesn't have an underscore in the file name
62 MY_PV=${PV/_/}
63
64 DESCRIPTION="PostgreSQL server"
65 HOMEPAGE="http://www.postgresql.org/"
66 SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2
67 http://dev.gentoo.org/~titanofold/postgresql-patches-${MY_PV}.tbz2
68 http://dev.gentoo.org/~titanofold/postgresql-initscript-1.2.tbz2"
69 LICENSE="POSTGRESQL"
70
71 S=${WORKDIR}/postgresql-${MY_PV}
72 SLOT="$(get_version_component_range 1-2)"
73
74 LINGUAS="af cs de es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN zh_TW"
75 IUSE="doc kernel_linux nls pam perl -pg_legacytimestamp python selinux tcl uuid xml"
76
77 for lingua in ${LINGUAS}; do
78 IUSE+=" linguas_${lingua}"
79 done
80
81 wanted_languages() {
82 local enable_langs
83
84 for lingua in ${LINGUAS} ; do
85 use linguas_${lingua} && enable_langs+="${lingua} "
86 done
87
88 echo -n ${enable_langs}
89 }
90
91 RDEPEND="~dev-db/postgresql-base-${PV}:${SLOT}[pam?,pg_legacytimestamp=,nls=]
92 perl? ( >=dev-lang/perl-5.8 )
93 python? ( dev-python/egenix-mx-base )
94 selinux? ( sec-policy/selinux-postgresql )
95 tcl? ( >=dev-lang/tcl-8 )
96 uuid? ( dev-libs/ossp-uuid )
97 xml? ( dev-libs/libxml2 dev-libs/libxslt )"
98 DEPEND="${RDEPEND}
99 sys-devel/flex
100 xml? ( dev-util/pkgconfig )"
101 PDEPEND="doc? ( ~dev-db/postgresql-docs-${PV} )"
102
103 pkg_setup() {
104 enewgroup postgres 70
105 enewuser postgres 70 /bin/bash ${EROOT%/}/var/lib/postgresql postgres
106
107 use python && python_set_active_version 2
108 }
109
110 src_prepare() {
111 epatch "${WORKDIR}/autoconf.patch" \
112 "${WORKDIR}/server.patch"
113
114 eprefixify src/include/pg_config_manual.h
115
116 if use test ; then
117 epatch "${WORKDIR}/regress.patch"
118 sed -e "s|@SOCKETDIR@|${T}|g" -i src/test/regress/pg_regress{,_main}.c
119 sed -e "s|/no/such/location|${S}/src/test/regress/tmp_check/no/such/location|g" -i src/test/regress/{input,output}/tablespace.source
120 else
121 echo "all install:" > "${S}/src/test/regress/GNUmakefile"
122 fi
123
124 eautoconf
125 }
126
127 src_configure() {
128 # eval is needed to get along with pg_config quotation of space-rich entities.
129 eval econf "$(${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/pg_config --configure)" \
130 $(use_with perl) \
131 $(use_with python) \
132 $(use_with tcl) \
133 $(use_with xml libxml) \
134 $(use_with xml libxslt) \
135 $(use_with uuid ossp-uuid) \
136 --with-system-tzdata="${EROOT%/}/usr/share/zoneinfo" \
137 --with-includes="${EROOT%/}/usr/include/postgresql-${SLOT}/" \
138 --with-libraries="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/$(get_libdir)" \
139 "$(use_enable nls nls "$(wanted_languages)")"
140 }
141
142 src_compile() {
143 local bd
144 for bd in . contrib $(use xml && echo contrib/xml2); do
145 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
146 emake -C $bd -j1 || die "emake in $bd failed"
147 done
148 }
149
150 src_install() {
151 if use perl ; then
152 mv -f "${S}/src/pl/plperl/GNUmakefile" "${S}/src/pl/plperl/GNUmakefile_orig"
153 sed -e "s:\$(DESTDIR)\$(plperl_installdir):\$(plperl_installdir):" \
154 "${S}/src/pl/plperl/GNUmakefile_orig" > "${S}/src/pl/plperl/GNUmakefile"
155 fi
156
157 for bd in . contrib $(use xml && echo contrib/xml2) ; do
158 PATH="${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin:${PATH}" \
159 emake install -C $bd -j1 DESTDIR="${D}" || die "emake install in $bd failed"
160 done
161
162 dodoc README HISTORY doc/{README.*,TODO,bug.template}
163
164 dodir /etc/eselect/postgresql/slots/${SLOT}
165 cat > "${ED}/etc/eselect/postgresql/slots/${SLOT}/service" <<-__EOF__
166 postgres_ebuilds="\${postgres_ebuilds} ${PF}"
167 postgres_service="postgresql-${SLOT}"
168 __EOF__
169
170 sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.confd
171 newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} || die "Inserting conf failed"
172 sed -e "s/@SLOT@/${SLOT}/g" -i "${WORKDIR}"/postgresql.init
173 newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} || die "Inserting conf failed"
174
175 use pam && pamd_mimic system-auth postgresql auth account session
176
177 keepdir /var/run/postgresql
178 fperms 0770 /var/run/postgresql
179 fowners postgres:postgres /var/run/postgresql
180 }
181
182 pkg_postinst() {
183 eselect postgresql update
184 [[ "$(eselect postgresql show)" = "(none)" ]] && eselect postgresql set ${SLOT}
185 [[ "$(eselect postgresql show-service)" = "(none)" ]] && eselect postgresql set-service ${SLOT}
186
187 elog "The Unix-domain socket is located in:"
188 elog " ${EROOT%/}/var/run/postgresql/"
189 elog
190 elog "If you have users and/or services that you would like to utilize the socket,"
191 elog "you must add them to the 'postgres' system group:"
192 elog " usermod -a -G postgres <user>"
193 elog
194 elog "Before initializing the database, you may want to edit PG_INITDB_OPTS so that"
195 elog "it contains your preferred locale in:"
196 elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
197 elog
198 elog "Then, execute the following command to setup the initial database"
199 elog "environment:"
200 elog " emerge --config =${CATEGORY}/${PF}"
201 }
202
203 pkg_postrm() {
204 eselect postgresql update
205 }
206
207 pkg_config() {
208 [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
209 [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
210 [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
211
212 # environment.bz2 may not contain the same locale as the current system
213 # locale. Unset and source from the current system locale.
214 if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
215 unset LANG
216 unset LC_CTYPE
217 unset LC_NUMERIC
218 unset LC_TIME
219 unset LC_COLLATE
220 unset LC_MONETARY
221 unset LC_MESSAGES
222 unset LC_ALL
223 source "${EROOT%/}/etc/env.d/02locale"
224 [ -n "${LANG}" ] && export LANG
225 [ -n "${LC_CTYPE}" ] && export LC_CTYPE
226 [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
227 [ -n "${LC_TIME}" ] && export LC_TIME
228 [ -n "${LC_COLLATE}" ] && export LC_COLLATE
229 [ -n "${LC_MONETARY}" ] && export LC_MONETARY
230 [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
231 [ -n "${LC_ALL}" ] && export LC_ALL
232 fi
233
234 einfo "You can modify the paths and options passed to initdb by editing:"
235 einfo " ${EROOT%/}"
236 einfo
237 einfo "Information on options that can be passed to initdb are found at:"
238 einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
239 einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
240 einfo
241 einfo "PG_INITDB_OPTS is currently set to:"
242 if [[ -z "${PG_INITDB_OPTS}" ]] ; then
243 einfo " (none)"
244 else
245 einfo " ${PG_INITDB_OPTS}"
246 fi
247 einfo
248 einfo "Configuration files will be installed to:"
249 einfo " ${PGDATA}"
250 einfo
251 einfo "The database cluster will be created in:"
252 einfo " ${DATA_DIR}"
253 einfo
254 while [ "$correct" != "true" ] ; do
255 einfo "Are you ready to continue? (y/n)"
256 read answer
257 if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then
258 correct="true"
259 elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then
260 die "Aborting initialization."
261 else
262 echo "Answer not recognized"
263 fi
264 done
265
266 if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
267 eerror "The given directory, '${DATA_DIR}', is not empty."
268 eerror "Modify DATA_DIR to point to an empty directory."
269 die "${DATA_DIR} is not empty."
270 fi
271
272 [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128"
273 einfo "Checking system parameters..."
274
275 if ! use kernel_linux ; then
276 einfo "Skipped."
277 einfo " Tests not supported on this OS (yet)"
278 else
279 if [ -z ${SKIP_SYSTEM_TESTS} ] ; then
280 einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..."
281
282 local SEMMSL=$(sysctl -n kernel.sem | cut -f1)
283 local SEMMNS=$(sysctl -n kernel.sem | cut -f2)
284 local SEMMNI=$(sysctl -n kernel.sem | cut -f4)
285 local SHMMAX=$(sysctl -n kernel.shmmax)
286
287 local SEMMSL_MIN=17
288 local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 ))
289 local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 ))
290 local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) ))
291
292 for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do
293 if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then
294 eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)"
295 eerror "You have now several options:"
296 eerror " - Change the mentioned system parameter"
297 eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a"
298 eerror " value lower than ${PG_MAX_CONNECTIONS}"
299 eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely"
300 eerror "More information can be found here:"
301 eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html"
302 die "System test failed."
303 fi
304 done
305 einfo "Passed."
306 else
307 ewarn "SKIP_SYSTEM_TESTS set, so skipping."
308 fi
309 fi
310
311 einfo "Creating the data directory ..."
312 if [[ ${EUID} == 0 ]] ; then
313 mkdir -p "${DATA_DIR}"
314 chown -Rf postgres:postgres "${DATA_DIR}"
315 chmod 0700 "${DATA_DIR}"
316 fi
317
318 einfo "Initializing the database ..."
319
320 if [[ ${EUID} == 0 ]] ; then
321 su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
322 else
323 "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
324 fi
325
326 mv "${DATA_DIR%/}"/*.conf "${PGDATA}"
327
328 einfo "The autovacuum function, which was in contrib, has been moved to the main"
329 einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
330 einfo "by default. You can disable it in the cluster's:"
331 einfo " ${PGDATA%/}/postgresql.conf"
332 einfo
333 einfo "The PostgreSQL server, by default, will log events to:"
334 einfo " ${DATA_DIR%/}/postmaster.log"
335 einfo
336 if use prefix ; then
337 einfo "The location of the configuration files have moved to:"
338 einfo " ${PGDATA}"
339 einfo "To start the server:"
340 einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
341 einfo "To stop:"
342 einfo " pg_ctl stop -D ${DATA_DIR}"
343 einfo
344 einfo "Or move the configuration files back:"
345 einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
346 else
347 einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
348 einfo "instead of 'pg_ctl'."
349 fi
350 }
351
352 src_test() {
353 einfo ">>> Test phase [check]: ${CATEGORY}/${PF}"
354
355 if [ ${UID} -ne 0 ] ; then
356 emake -j1 check || die "Make check failed. See above for details."
357
358 einfo "If you think other tests besides the regression tests are necessary, please"
359 einfo "submit a bug including a patch for this ebuild to enable them."
360 else
361 ewarn "Tests cannot be run as root. Skipping."
362 ewarn "HINT: FEATURES=\"userpriv\""
363 fi
364 }