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