Gentoo Archives: gentoo-commits

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