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