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