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