1 |
titanofold 14/12/28 18:07:22 |
2 |
|
3 |
Modified: postgresql-9999.ebuild ChangeLog |
4 |
Added: postgresql-9.3.5-r3.ebuild |
5 |
postgresql-9.2.9-r3.ebuild |
6 |
postgresql-9.1.14-r3.ebuild |
7 |
postgresql-9.0.18-r3.ebuild |
8 |
postgresql-9.4.0-r1.ebuild |
9 |
Log: |
10 |
Eliminate the patch, initscript, and systemd tarball maintained out |
11 |
of tree, and: |
12 |
- Fix bug 460956 by changing directory mask to 1775 which allows |
13 |
all to access sockets, users within the group to create a socket, |
14 |
and restricts the deletion or modification to the socket owner or |
15 |
directory owner. |
16 |
- Fix bug 488246 by creating symbolic links to the configuration |
17 |
files when PGDATA and DATADIR differ. |
18 |
- Fix bug 511942 by warning if CONFIG_SYSVIPC is not enabled. |
19 |
- Fix bug 518522 by appending the plperl.on_init workaround to |
20 |
postgresql.conf. (This only affects new installs.) |
21 |
- Fix bug 529680 by removing the autotools inherit, and removing |
22 |
the sed statement. We don't change anything in configure.in, which |
23 |
means we don't need to regenerate the configure script. |
24 |
- Fix bug 530790 by correcting the typo. |
25 |
- Fix bug 531820 by removing the pre-initdb tests. |
26 |
|
27 |
(Portage version: 2.2.14/cvs/Linux x86_64, signed Manifest commit with key D1BBFDA0) |
28 |
|
29 |
Revision Changes Path |
30 |
1.6 dev-db/postgresql/postgresql-9999.ebuild |
31 |
|
32 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild?rev=1.6&view=markup |
33 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild?rev=1.6&content-type=text/plain |
34 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild?r1=1.5&r2=1.6 |
35 |
|
36 |
Index: postgresql-9999.ebuild |
37 |
=================================================================== |
38 |
RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild,v |
39 |
retrieving revision 1.5 |
40 |
retrieving revision 1.6 |
41 |
diff -u -r1.5 -r1.6 |
42 |
--- postgresql-9999.ebuild 19 Dec 2014 02:09:03 -0000 1.5 |
43 |
+++ postgresql-9999.ebuild 28 Dec 2014 18:07:22 -0000 1.6 |
44 |
@@ -1,13 +1,13 @@ |
45 |
# Copyright 1999-2014 Gentoo Foundation |
46 |
# Distributed under the terms of the GNU General Public License v2 |
47 |
-# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild,v 1.5 2014/12/19 02:09:03 patrick Exp $ |
48 |
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9999.ebuild,v 1.6 2014/12/28 18:07:22 titanofold Exp $ |
49 |
|
50 |
EAPI="5" |
51 |
|
52 |
PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} ) |
53 |
-WANT_AUTOMAKE="none" |
54 |
|
55 |
-inherit autotools eutils flag-o-matic multilib pam prefix python-single-r1 systemd user versionator base git-2 |
56 |
+inherit base eutils flag-o-matic git-2 linux-info multilib pam prefix \ |
57 |
+ python-single-r1 systemd user versionator |
58 |
|
59 |
KEYWORDS="" |
60 |
|
61 |
@@ -16,15 +16,14 @@ |
62 |
|
63 |
EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git" |
64 |
|
65 |
-# Add initscript source |
66 |
-SRC_URI="http://dev.gentoo.org/~floppym/dist/postgresql-initscript-2.7.tbz2" |
67 |
- |
68 |
LICENSE="POSTGRESQL GPL-2" |
69 |
DESCRIPTION="PostgreSQL RDBMS" |
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 ldap nls pam perl -pg_legacytimestamp python +readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
74 |
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
75 |
+ zh_CN zh_TW" |
76 |
+IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python |
77 |
+ +readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
78 |
|
79 |
for lingua in ${LINGUAS}; do |
80 |
IUSE+=" linguas_${lingua}" |
81 |
@@ -85,6 +84,8 @@ |
82 |
" |
83 |
|
84 |
pkg_setup() { |
85 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
86 |
+ |
87 |
enewgroup postgres 70 |
88 |
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
89 |
|
90 |
@@ -92,9 +93,6 @@ |
91 |
} |
92 |
|
93 |
src_prepare() { |
94 |
- # Eliminate autotools version check |
95 |
- sed '/m4_PACKAGE_VERSION/,+3d' -i configure.in || die |
96 |
- |
97 |
# Work around PPC{,64} compilation bug where bool is already defined |
98 |
sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
99 |
|
100 |
@@ -102,10 +100,6 @@ |
101 |
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
102 |
-i src/include/pg_config_manual.h || die |
103 |
|
104 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
105 |
- -i "${WORKDIR}"/postgresql{.{init,confd,service},-check-db-dir} || \ |
106 |
- die "SLOT/LIBDIR sed failed" |
107 |
- |
108 |
use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
109 |
|
110 |
if use pam ; then |
111 |
@@ -113,8 +107,6 @@ |
112 |
-i src/backend/libpq/auth.c || \ |
113 |
die 'PGSQL_PAM_SERVICE rename failed.' |
114 |
fi |
115 |
- |
116 |
- eautoconf |
117 |
} |
118 |
|
119 |
src_configure() { |
120 |
@@ -198,14 +190,21 @@ |
121 |
fi |
122 |
|
123 |
if use server; then |
124 |
- newconfd "${WORKDIR}/postgresql.confd" postgresql-${SLOT} |
125 |
- newinitd "${WORKDIR}/postgresql.init" postgresql-${SLOT} |
126 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
127 |
+ "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
128 |
|
129 |
- systemd_newunit "${WORKDIR}"/postgresql.service postgresql-${SLOT}.service |
130 |
- systemd_newtmpfilesd "${WORKDIR}"/postgresql.tmpfilesd postgresql-${SLOT}.conf |
131 |
- newbin "${WORKDIR}"/postgresql-check-db-dir postgresql-${SLOT}-check-db-dir |
132 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
133 |
+ "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
134 |
|
135 |
- use pam && pamd_mimic system-auth postgresql-${SLOT} auth account session |
136 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
137 |
+ "${FILESDIR}/${PN}.service" | \ |
138 |
+ systemd_newunit - ${PN}-${SLOT}.service |
139 |
+ |
140 |
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf |
141 |
+ |
142 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
143 |
+ |
144 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
145 |
|
146 |
if use prefix ; then |
147 |
keepdir /run/postgresql |
148 |
@@ -259,9 +258,11 @@ |
149 |
pkg_config() { |
150 |
use server || die "USE flag 'server' not enabled. Nothing to configure." |
151 |
|
152 |
- [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
153 |
+ [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
154 |
+ && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
155 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
156 |
- [[ -z "${DATA_DIR}" ]] && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
157 |
+ [[ -z "${DATA_DIR}" ]] \ |
158 |
+ && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
159 |
|
160 |
# environment.bz2 may not contain the same locale as the current system |
161 |
# locale. Unset and source from the current system locale. |
162 |
@@ -323,45 +324,6 @@ |
163 |
die "${DATA_DIR} is not empty." |
164 |
fi |
165 |
|
166 |
- [ -z "${PG_MAX_CONNECTIONS}" ] && PG_MAX_CONNECTIONS="128" |
167 |
- einfo "Checking system parameters..." |
168 |
- |
169 |
- if ! use kernel_linux ; then |
170 |
- einfo "Skipped." |
171 |
- einfo " Tests not supported on this OS (yet)" |
172 |
- else |
173 |
- if [ -z ${SKIP_SYSTEM_TESTS} ] ; then |
174 |
- einfo "Checking whether your system supports at least ${PG_MAX_CONNECTIONS} connections..." |
175 |
- |
176 |
- local SEMMSL=$(sysctl -n kernel.sem | cut -f1) |
177 |
- local SEMMNS=$(sysctl -n kernel.sem | cut -f2) |
178 |
- local SEMMNI=$(sysctl -n kernel.sem | cut -f4) |
179 |
- local SHMMAX=$(sysctl -n kernel.shmmax) |
180 |
- |
181 |
- local SEMMSL_MIN=17 |
182 |
- local SEMMNS_MIN=$(( ( ${PG_MAX_CONNECTIONS}/16 ) * 17 )) |
183 |
- local SEMMNI_MIN=$(( ( ${PG_MAX_CONNECTIONS}+15 ) / 16 )) |
184 |
- local SHMMAX_MIN=$(( 500000 + ( 30600 * ${PG_MAX_CONNECTIONS} ) )) |
185 |
- |
186 |
- for p in SEMMSL SEMMNS SEMMNI SHMMAX ; do |
187 |
- if [ $(eval echo \$$p) -lt $(eval echo \$${p}_MIN) ] ; then |
188 |
- eerror "The value for ${p} $(eval echo \$$p) is below the recommended value $(eval echo \$${p}_MIN)" |
189 |
- eerror "You have now several options:" |
190 |
- eerror " - Change the mentioned system parameter" |
191 |
- eerror " - Lower the number of max.connections by setting PG_MAX_CONNECTIONS to a" |
192 |
- eerror " value lower than ${PG_MAX_CONNECTIONS}" |
193 |
- eerror " - Set SKIP_SYSTEM_TESTS in case you want to ignore this test completely" |
194 |
- eerror "More information can be found here:" |
195 |
- eerror " http://www.postgresql.org/docs/${SLOT}/static/kernel-resources.html" |
196 |
- die "System test failed." |
197 |
- fi |
198 |
- done |
199 |
- einfo "Passed." |
200 |
- else |
201 |
- ewarn "SKIP_SYSTEM_TESTS set, so skipping." |
202 |
- fi |
203 |
- fi |
204 |
- |
205 |
einfo "Creating the data directory ..." |
206 |
if [[ ${EUID} == 0 ]] ; then |
207 |
mkdir -p "${DATA_DIR}" |
208 |
@@ -377,7 +339,17 @@ |
209 |
"${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
210 |
fi |
211 |
|
212 |
- mv "${DATA_DIR%/}"/*.conf "${PGDATA}" |
213 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
214 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
215 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
216 |
+ fi |
217 |
+ |
218 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
219 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
220 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
221 |
+ # characters in PL/Perl |
222 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
223 |
+ EOF |
224 |
|
225 |
einfo "The autovacuum function, which was in contrib, has been moved to the main" |
226 |
einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
227 |
|
228 |
|
229 |
|
230 |
1.406 dev-db/postgresql/ChangeLog |
231 |
|
232 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/ChangeLog?rev=1.406&view=markup |
233 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/ChangeLog?rev=1.406&content-type=text/plain |
234 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/ChangeLog?r1=1.405&r2=1.406 |
235 |
|
236 |
Index: ChangeLog |
237 |
=================================================================== |
238 |
RCS file: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v |
239 |
retrieving revision 1.405 |
240 |
retrieving revision 1.406 |
241 |
diff -u -r1.405 -r1.406 |
242 |
--- ChangeLog 26 Dec 2014 17:55:41 -0000 1.405 |
243 |
+++ ChangeLog 28 Dec 2014 18:07:22 -0000 1.406 |
244 |
@@ -1,6 +1,36 @@ |
245 |
# ChangeLog for dev-db/postgresql |
246 |
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 |
247 |
-# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.405 2014/12/26 17:55:41 maekke Exp $ |
248 |
+# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/ChangeLog,v 1.406 2014/12/28 18:07:22 titanofold Exp $ |
249 |
+ |
250 |
+*postgresql-9.4.0-r1 (28 Dec 2014) |
251 |
+*postgresql-9.3.5-r3 (28 Dec 2014) |
252 |
+*postgresql-9.2.9-r3 (28 Dec 2014) |
253 |
+*postgresql-9.1.14-r3 (28 Dec 2014) |
254 |
+*postgresql-9.0.18-r3 (28 Dec 2014) |
255 |
+ |
256 |
+ 28 Dec 2014; Aaron W. Swenson <titanofold@g.o> |
257 |
+ +postgresql-9.0.18-r3.ebuild, +postgresql-9.1.14-r3.ebuild, |
258 |
+ +postgresql-9.2.9-r3.ebuild, +postgresql-9.3.5-r3.ebuild, |
259 |
+ +postgresql-9.4.0-r1.ebuild, postgresql-9999.ebuild, +files/postgresql.confd, |
260 |
+ +files/postgresql.init, +files/postgresql.init-pre_9.2, |
261 |
+ +files/postgresql.service, +files/postgresql.tmpfilesd, |
262 |
+ +files/postgresql-check-db-dir: |
263 |
+ Eliminate the patch, initscript, and systemd tarball maintained out |
264 |
+ of tree, and: |
265 |
+ - Fix bug 460956 by changing directory mask to 1775 which allows |
266 |
+ all to access sockets, users within the group to create a socket, |
267 |
+ and restricts the deletion or modification to the socket owner or |
268 |
+ directory owner. |
269 |
+ - Fix bug 488246 by creating symbolic links to the configuration |
270 |
+ files when PGDATA and DATADIR differ. |
271 |
+ - Fix bug 511942 by warning if CONFIG_SYSVIPC is not enabled. |
272 |
+ - Fix bug 518522 by appending the plperl.on_init workaround to |
273 |
+ postgresql.conf. (This only affects new installs.) |
274 |
+ - Fix bug 529680 by removing the autotools inherit, and removing |
275 |
+ the sed statement. We don't change anything in configure.in, which |
276 |
+ means we don't need to regenerate the configure script. |
277 |
+ - Fix bug 530790 by correcting the typo. |
278 |
+ - Fix bug 531820 by removing the pre-initdb tests. |
279 |
|
280 |
26 Dec 2014; Markus Meier <maekke@g.o> postgresql-9.0.18-r2.ebuild, |
281 |
postgresql-9.1.14-r2.ebuild, postgresql-9.2.9-r2.ebuild, |
282 |
|
283 |
|
284 |
|
285 |
1.1 dev-db/postgresql/postgresql-9.3.5-r3.ebuild |
286 |
|
287 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.3.5-r3.ebuild?rev=1.1&view=markup |
288 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.3.5-r3.ebuild?rev=1.1&content-type=text/plain |
289 |
|
290 |
Index: postgresql-9.3.5-r3.ebuild |
291 |
=================================================================== |
292 |
# Copyright 1999-2014 Gentoo Foundation |
293 |
# Distributed under the terms of the GNU General Public License v2 |
294 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9.3.5-r3.ebuild,v 1.1 2014/12/28 18:07:22 titanofold Exp $ |
295 |
|
296 |
EAPI="5" |
297 |
|
298 |
PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} ) |
299 |
|
300 |
inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
301 |
systemd user versionator |
302 |
|
303 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 |
304 |
~amd64-fbsd ~ppc-macos ~sparc-fbsd ~x86-fbsd ~x86-solaris" |
305 |
|
306 |
SLOT="$(get_version_component_range 1-2)" |
307 |
|
308 |
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
309 |
|
310 |
LICENSE="POSTGRESQL GPL-2" |
311 |
DESCRIPTION="PostgreSQL RDBMS" |
312 |
HOMEPAGE="http://www.postgresql.org/" |
313 |
|
314 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
315 |
zh_CN zh_TW" |
316 |
IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python |
317 |
+readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
318 |
|
319 |
for lingua in ${LINGUAS}; do |
320 |
IUSE+=" linguas_${lingua}" |
321 |
done |
322 |
|
323 |
wanted_languages() { |
324 |
local enable_langs |
325 |
|
326 |
for lingua in ${LINGUAS} ; do |
327 |
use linguas_${lingua} && enable_langs+="${lingua} " |
328 |
done |
329 |
|
330 |
echo -n ${enable_langs} |
331 |
} |
332 |
|
333 |
CDEPEND=" |
334 |
>=app-admin/eselect-postgresql-1.2.0 |
335 |
sys-apps/less |
336 |
virtual/libintl |
337 |
kerberos? ( virtual/krb5 ) |
338 |
ldap? ( net-nds/openldap ) |
339 |
pam? ( virtual/pam ) |
340 |
perl? ( >=dev-lang/perl-5.8 ) |
341 |
python? ( ${PYTHON_DEPS} ) |
342 |
readline? ( sys-libs/readline ) |
343 |
ssl? ( >=dev-libs/openssl-0.9.6-r1 ) |
344 |
tcl? ( >=dev-lang/tcl-8 ) |
345 |
uuid? ( dev-libs/ossp-uuid ) |
346 |
xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
347 |
zlib? ( sys-libs/zlib ) |
348 |
" |
349 |
|
350 |
DEPEND="${CDEPEND} |
351 |
!!<sys-apps/sandbox-2.0 |
352 |
sys-devel/bison |
353 |
sys-devel/flex |
354 |
nls? ( sys-devel/gettext ) |
355 |
xml? ( virtual/pkgconfig ) |
356 |
" |
357 |
|
358 |
RDEPEND="${CDEPEND} |
359 |
!dev-db/postgresql-docs:${SLOT} |
360 |
!dev-db/postgresql-base:${SLOT} |
361 |
!dev-db/postgresql-server:${SLOT} |
362 |
selinux? ( sec-policy/selinux-postgresql ) |
363 |
" |
364 |
|
365 |
pkg_setup() { |
366 |
use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
367 |
|
368 |
enewgroup postgres 70 |
369 |
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
370 |
|
371 |
use python && python-single-r1_pkg_setup |
372 |
} |
373 |
|
374 |
src_prepare() { |
375 |
# Work around PPC{,64} compilation bug where bool is already defined |
376 |
sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
377 |
|
378 |
# Set proper run directory |
379 |
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
380 |
-i src/include/pg_config_manual.h || die |
381 |
|
382 |
use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
383 |
|
384 |
if use pam ; then |
385 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
386 |
-i src/backend/libpq/auth.c || \ |
387 |
die 'PGSQL_PAM_SERVICE rename failed.' |
388 |
fi |
389 |
} |
390 |
|
391 |
src_configure() { |
392 |
case ${CHOST} in |
393 |
*-darwin*|*-solaris*) |
394 |
use nls && append-libs intl |
395 |
;; |
396 |
esac |
397 |
|
398 |
export LDFLAGS_SL="${LDFLAGS}" |
399 |
export LDFLAGS_EX="${LDFLAGS}" |
400 |
|
401 |
local PO="${EPREFIX%/}" |
402 |
|
403 |
econf \ |
404 |
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
405 |
--datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
406 |
--docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \ |
407 |
--includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
408 |
--mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
409 |
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
410 |
--with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
411 |
$(use_enable !pg_legacytimestamp integer-datetimes) \ |
412 |
$(use_enable threads thread-safety) \ |
413 |
$(use_with kerberos gssapi) \ |
414 |
$(use_with kerberos krb5) \ |
415 |
$(use_with ldap) \ |
416 |
$(use_with pam) \ |
417 |
$(use_with perl) \ |
418 |
$(use_with python) \ |
419 |
$(use_with readline) \ |
420 |
$(use_with ssl openssl) \ |
421 |
$(use_with tcl) \ |
422 |
$(use_with uuid ossp-uuid) \ |
423 |
$(use_with xml libxml) \ |
424 |
$(use_with xml libxslt) \ |
425 |
$(use_with zlib) \ |
426 |
"$(use_enable nls nls "$(wanted_languages)")" |
427 |
} |
428 |
|
429 |
src_compile() { |
430 |
emake |
431 |
emake -C contrib |
432 |
} |
433 |
|
434 |
src_install() { |
435 |
emake DESTDIR="${D}" install |
436 |
emake DESTDIR="${D}" install -C contrib |
437 |
|
438 |
dodoc README HISTORY doc/{TODO,bug.template} |
439 |
|
440 |
# man pages are already built, but if we have the target make them, |
441 |
# they'll be generated from source before being installed so we |
442 |
# manually install man pages. |
443 |
# We use ${SLOT} instead of doman for postgresql.eselect |
444 |
insinto /usr/share/postgresql-${SLOT}/man/ |
445 |
doins -r doc/src/sgml/man{1,3,7} |
446 |
if ! use server; then |
447 |
# Remove man pages for non-existent binaries |
448 |
for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
449 |
rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
450 |
done |
451 |
fi |
452 |
docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
453 |
|
454 |
insinto /etc/postgresql-${SLOT} |
455 |
newins src/bin/psql/psqlrc.sample psqlrc |
456 |
|
457 |
dodir /etc/eselect/postgresql/slots/${SLOT} |
458 |
echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
459 |
"${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
460 |
|
461 |
use static-libs || find "${ED}" -name '*.a' -delete |
462 |
|
463 |
if use doc ; then |
464 |
docinto html |
465 |
dodoc doc/src/sgml/html/* |
466 |
|
467 |
docinto sgml |
468 |
dodoc doc/src/sgml/*.{sgml,dsl} |
469 |
fi |
470 |
|
471 |
if use server; then |
472 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
473 |
"${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
474 |
|
475 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
476 |
"${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
477 |
|
478 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
479 |
"${FILESDIR}/${PN}.service" | \ |
480 |
systemd_newunit - ${PN}-${SLOT}.service |
481 |
|
482 |
systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf |
483 |
|
484 |
newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
485 |
|
486 |
use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
487 |
|
488 |
if use prefix ; then |
489 |
keepdir /run/postgresql |
490 |
fperms 0775 /run/postgresql |
491 |
fi |
492 |
fi |
493 |
} |
494 |
|
495 |
pkg_postinst() { |
496 |
postgresql-config update |
497 |
|
498 |
elog "If you need a global psqlrc-file, you can place it in:" |
499 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
500 |
|
501 |
if use server ; then |
502 |
elog |
503 |
elog "Gentoo specific documentation:" |
504 |
elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
505 |
elog |
506 |
elog "Official documentation:" |
507 |
elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
508 |
elog |
509 |
elog "The default location of the Unix-domain socket is:" |
510 |
elog " ${EROOT%/}/run/postgresql/" |
511 |
elog |
512 |
elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
513 |
elog "so that it contains your preferred locale in:" |
514 |
elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
515 |
elog |
516 |
elog "Then, execute the following command to setup the initial database" |
517 |
elog "environment:" |
518 |
elog " emerge --config =${CATEGORY}/${PF}" |
519 |
fi |
520 |
} |
521 |
|
522 |
pkg_prerm() { |
523 |
if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
524 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
525 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL#doc_chap5" |
526 |
|
527 |
ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
528 |
sleep 10 |
529 |
eend 0 |
530 |
fi |
531 |
} |
532 |
|
533 |
pkg_postrm() { |
534 |
postgresql-config update |
535 |
} |
536 |
|
537 |
pkg_config() { |
538 |
use server || die "USE flag 'server' not enabled. Nothing to configure." |
539 |
|
540 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
541 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
542 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
543 |
[[ -z "${DATA_DIR}" ]] \ |
544 |
&& DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
545 |
|
546 |
# environment.bz2 may not contain the same locale as the current system |
547 |
# locale. Unset and source from the current system locale. |
548 |
if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
549 |
unset LANG |
550 |
unset LC_CTYPE |
551 |
unset LC_NUMERIC |
552 |
unset LC_TIME |
553 |
unset LC_COLLATE |
554 |
unset LC_MONETARY |
555 |
unset LC_MESSAGES |
556 |
unset LC_ALL |
557 |
source "${EROOT%/}/etc/env.d/02locale" |
558 |
[ -n "${LANG}" ] && export LANG |
559 |
[ -n "${LC_CTYPE}" ] && export LC_CTYPE |
560 |
[ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
561 |
[ -n "${LC_TIME}" ] && export LC_TIME |
562 |
[ -n "${LC_COLLATE}" ] && export LC_COLLATE |
563 |
[ -n "${LC_MONETARY}" ] && export LC_MONETARY |
564 |
[ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
565 |
[ -n "${LC_ALL}" ] && export LC_ALL |
566 |
fi |
567 |
|
568 |
einfo "You can modify the paths and options passed to initdb by editing:" |
569 |
einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
570 |
einfo |
571 |
einfo "Information on options that can be passed to initdb are found at:" |
572 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
573 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
574 |
einfo |
575 |
einfo "PG_INITDB_OPTS is currently set to:" |
576 |
if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
577 |
einfo " (none)" |
578 |
else |
579 |
einfo " ${PG_INITDB_OPTS}" |
580 |
fi |
581 |
einfo |
582 |
einfo "Configuration files will be installed to:" |
583 |
einfo " ${PGDATA}" |
584 |
einfo |
585 |
einfo "The database cluster will be created in:" |
586 |
einfo " ${DATA_DIR}" |
587 |
einfo |
588 |
while [ "$correct" != "true" ] ; do |
589 |
einfo "Are you ready to continue? (y/n)" |
590 |
read answer |
591 |
if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
592 |
correct="true" |
593 |
elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
594 |
die "Aborting initialization." |
595 |
else |
596 |
echo "Answer not recognized" |
597 |
fi |
598 |
done |
599 |
|
600 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
601 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
602 |
eerror "Modify DATA_DIR to point to an empty directory." |
603 |
die "${DATA_DIR} is not empty." |
604 |
fi |
605 |
|
606 |
einfo "Creating the data directory ..." |
607 |
if [[ ${EUID} == 0 ]] ; then |
608 |
mkdir -p "${DATA_DIR}" |
609 |
chown -Rf postgres:postgres "${DATA_DIR}" |
610 |
chmod 0700 "${DATA_DIR}" |
611 |
fi |
612 |
|
613 |
einfo "Initializing the database ..." |
614 |
|
615 |
if [[ ${EUID} == 0 ]] ; then |
616 |
su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
617 |
else |
618 |
"${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
619 |
fi |
620 |
|
621 |
if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
622 |
mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
623 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
624 |
fi |
625 |
|
626 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
627 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
628 |
# On the off-chance that you might need to work with UTF-8 encoded |
629 |
# characters in PL/Perl |
630 |
plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
631 |
EOF |
632 |
|
633 |
einfo "The autovacuum function, which was in contrib, has been moved to the main" |
634 |
einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
635 |
einfo "by default. You can disable it in the cluster's:" |
636 |
einfo " ${PGDATA%/}/postgresql.conf" |
637 |
einfo |
638 |
einfo "The PostgreSQL server, by default, will log events to:" |
639 |
einfo " ${DATA_DIR%/}/postmaster.log" |
640 |
einfo |
641 |
if use prefix ; then |
642 |
einfo "The location of the configuration files have moved to:" |
643 |
einfo " ${PGDATA}" |
644 |
einfo "To start the server:" |
645 |
einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
646 |
einfo "To stop:" |
647 |
einfo " pg_ctl stop -D ${DATA_DIR}" |
648 |
einfo |
649 |
einfo "Or move the configuration files back:" |
650 |
einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
651 |
else |
652 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
653 |
einfo "instead of 'pg_ctl'." |
654 |
fi |
655 |
} |
656 |
|
657 |
src_test() { |
658 |
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
659 |
|
660 |
if use server && [[ ${UID} -ne 0 ]] ; then |
661 |
emake check |
662 |
|
663 |
einfo "If you think other tests besides the regression tests are necessary, please" |
664 |
einfo "submit a bug including a patch for this ebuild to enable them." |
665 |
else |
666 |
use server || \ |
667 |
ewarn 'Tests cannot be run without the "server" use flag enabled.' |
668 |
[[ ${UID} -eq 0 ]] || \ |
669 |
ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
670 |
|
671 |
ewarn 'Skipping.' |
672 |
fi |
673 |
} |
674 |
|
675 |
|
676 |
|
677 |
1.1 dev-db/postgresql/postgresql-9.2.9-r3.ebuild |
678 |
|
679 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.2.9-r3.ebuild?rev=1.1&view=markup |
680 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.2.9-r3.ebuild?rev=1.1&content-type=text/plain |
681 |
|
682 |
Index: postgresql-9.2.9-r3.ebuild |
683 |
=================================================================== |
684 |
# Copyright 1999-2014 Gentoo Foundation |
685 |
# Distributed under the terms of the GNU General Public License v2 |
686 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9.2.9-r3.ebuild,v 1.1 2014/12/28 18:07:22 titanofold Exp $ |
687 |
|
688 |
EAPI="5" |
689 |
|
690 |
PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} ) |
691 |
|
692 |
inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
693 |
systemd user versionator |
694 |
|
695 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 |
696 |
~amd64-fbsd ~ppc-macos ~sparc-fbsd ~x86-fbsd ~x86-solaris" |
697 |
|
698 |
SLOT="$(get_version_component_range 1-2)" |
699 |
|
700 |
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
701 |
|
702 |
LICENSE="POSTGRESQL GPL-2" |
703 |
DESCRIPTION="PostgreSQL RDBMS" |
704 |
HOMEPAGE="http://www.postgresql.org/" |
705 |
|
706 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
707 |
zh_CN zh_TW" |
708 |
IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python |
709 |
+readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
710 |
|
711 |
for lingua in ${LINGUAS}; do |
712 |
IUSE+=" linguas_${lingua}" |
713 |
done |
714 |
|
715 |
wanted_languages() { |
716 |
local enable_langs |
717 |
|
718 |
for lingua in ${LINGUAS} ; do |
719 |
use linguas_${lingua} && enable_langs+="${lingua} " |
720 |
done |
721 |
|
722 |
echo -n ${enable_langs} |
723 |
} |
724 |
|
725 |
CDEPEND=" |
726 |
>=app-admin/eselect-postgresql-1.2.0 |
727 |
sys-apps/less |
728 |
virtual/libintl |
729 |
kerberos? ( virtual/krb5 ) |
730 |
ldap? ( net-nds/openldap ) |
731 |
pam? ( virtual/pam ) |
732 |
perl? ( >=dev-lang/perl-5.8 ) |
733 |
python? ( ${PYTHON_DEPS} ) |
734 |
readline? ( sys-libs/readline ) |
735 |
ssl? ( >=dev-libs/openssl-0.9.6-r1 ) |
736 |
tcl? ( >=dev-lang/tcl-8 ) |
737 |
uuid? ( dev-libs/ossp-uuid ) |
738 |
xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
739 |
zlib? ( sys-libs/zlib ) |
740 |
" |
741 |
|
742 |
DEPEND="${CDEPEND} |
743 |
!!<sys-apps/sandbox-2.0 |
744 |
sys-devel/bison |
745 |
sys-devel/flex |
746 |
nls? ( sys-devel/gettext ) |
747 |
xml? ( virtual/pkgconfig ) |
748 |
" |
749 |
|
750 |
RDEPEND="${CDEPEND} |
751 |
!dev-db/postgresql-docs:${SLOT} |
752 |
!dev-db/postgresql-base:${SLOT} |
753 |
!dev-db/postgresql-server:${SLOT} |
754 |
selinux? ( sec-policy/selinux-postgresql ) |
755 |
" |
756 |
|
757 |
pkg_setup() { |
758 |
use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
759 |
|
760 |
enewgroup postgres 70 |
761 |
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
762 |
|
763 |
use python && python-single-r1_pkg_setup |
764 |
} |
765 |
|
766 |
src_prepare() { |
767 |
# Work around PPC{,64} compilation bug where bool is already defined |
768 |
sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
769 |
|
770 |
# Set proper run directory |
771 |
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
772 |
-i src/include/pg_config_manual.h || die |
773 |
|
774 |
use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
775 |
|
776 |
if use pam ; then |
777 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
778 |
-i src/backend/libpq/auth.c || \ |
779 |
die 'PGSQL_PAM_SERVICE rename failed.' |
780 |
fi |
781 |
} |
782 |
|
783 |
src_configure() { |
784 |
case ${CHOST} in |
785 |
*-darwin*|*-solaris*) |
786 |
use nls && append-libs intl |
787 |
;; |
788 |
esac |
789 |
|
790 |
export LDFLAGS_SL="${LDFLAGS}" |
791 |
export LDFLAGS_EX="${LDFLAGS}" |
792 |
|
793 |
local PO="${EPREFIX%/}" |
794 |
|
795 |
econf \ |
796 |
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
797 |
--datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
798 |
--docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \ |
799 |
--includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
800 |
--mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
801 |
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
802 |
--with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
803 |
$(use_enable !pg_legacytimestamp integer-datetimes) \ |
804 |
$(use_enable threads thread-safety) \ |
805 |
$(use_with kerberos gssapi) \ |
806 |
$(use_with kerberos krb5) \ |
807 |
$(use_with ldap) \ |
808 |
$(use_with pam) \ |
809 |
$(use_with perl) \ |
810 |
$(use_with python) \ |
811 |
$(use_with readline) \ |
812 |
$(use_with ssl openssl) \ |
813 |
$(use_with tcl) \ |
814 |
$(use_with uuid ossp-uuid) \ |
815 |
$(use_with xml libxml) \ |
816 |
$(use_with xml libxslt) \ |
817 |
$(use_with zlib) \ |
818 |
"$(use_enable nls nls "$(wanted_languages)")" |
819 |
} |
820 |
|
821 |
src_compile() { |
822 |
emake |
823 |
emake -C contrib |
824 |
} |
825 |
|
826 |
src_install() { |
827 |
emake DESTDIR="${D}" install |
828 |
emake DESTDIR="${D}" install -C contrib |
829 |
|
830 |
dodoc README HISTORY doc/{TODO,bug.template} |
831 |
|
832 |
# man pages are already built, but if we have the target make them, |
833 |
# they'll be generated from source before being installed so we |
834 |
# manually install man pages. |
835 |
# We use ${SLOT} instead of doman for postgresql.eselect |
836 |
insinto /usr/share/postgresql-${SLOT}/man/ |
837 |
doins -r doc/src/sgml/man{1,3,7} |
838 |
if ! use server; then |
839 |
# Remove man pages for non-existent binaries |
840 |
for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
841 |
rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
842 |
done |
843 |
fi |
844 |
docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
845 |
|
846 |
insinto /etc/postgresql-${SLOT} |
847 |
newins src/bin/psql/psqlrc.sample psqlrc |
848 |
|
849 |
dodir /etc/eselect/postgresql/slots/${SLOT} |
850 |
echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
851 |
"${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
852 |
|
853 |
use static-libs || find "${ED}" -name '*.a' -delete |
854 |
|
855 |
if use doc ; then |
856 |
docinto html |
857 |
dodoc doc/src/sgml/html/* |
858 |
|
859 |
docinto sgml |
860 |
dodoc doc/src/sgml/*.{sgml,dsl} |
861 |
fi |
862 |
|
863 |
if use server; then |
864 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
865 |
"${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
866 |
|
867 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
868 |
"${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
869 |
|
870 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
871 |
"${FILESDIR}/${PN}.service" | \ |
872 |
systemd_newunit - ${PN}-${SLOT}.service |
873 |
|
874 |
systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf |
875 |
|
876 |
newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
877 |
|
878 |
use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
879 |
|
880 |
if use prefix ; then |
881 |
keepdir /run/postgresql |
882 |
fperms 0775 /run/postgresql |
883 |
fi |
884 |
fi |
885 |
} |
886 |
|
887 |
pkg_postinst() { |
888 |
postgresql-config update |
889 |
|
890 |
elog "If you need a global psqlrc-file, you can place it in:" |
891 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
892 |
|
893 |
if use server ; then |
894 |
elog |
895 |
elog "Gentoo specific documentation:" |
896 |
elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
897 |
elog |
898 |
elog "Official documentation:" |
899 |
elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
900 |
elog |
901 |
elog "The default location of the Unix-domain socket is:" |
902 |
elog " ${EROOT%/}/run/postgresql/" |
903 |
elog |
904 |
elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
905 |
elog "so that it contains your preferred locale in:" |
906 |
elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
907 |
elog |
908 |
elog "Then, execute the following command to setup the initial database" |
909 |
elog "environment:" |
910 |
elog " emerge --config =${CATEGORY}/${PF}" |
911 |
fi |
912 |
} |
913 |
|
914 |
pkg_prerm() { |
915 |
if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
916 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
917 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL#doc_chap5" |
918 |
|
919 |
ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
920 |
sleep 10 |
921 |
eend 0 |
922 |
fi |
923 |
} |
924 |
|
925 |
pkg_postrm() { |
926 |
postgresql-config update |
927 |
} |
928 |
|
929 |
pkg_config() { |
930 |
use server || die "USE flag 'server' not enabled. Nothing to configure." |
931 |
|
932 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
933 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
934 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
935 |
[[ -z "${DATA_DIR}" ]] \ |
936 |
&& DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
937 |
|
938 |
# environment.bz2 may not contain the same locale as the current system |
939 |
# locale. Unset and source from the current system locale. |
940 |
if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
941 |
unset LANG |
942 |
unset LC_CTYPE |
943 |
unset LC_NUMERIC |
944 |
unset LC_TIME |
945 |
unset LC_COLLATE |
946 |
unset LC_MONETARY |
947 |
unset LC_MESSAGES |
948 |
unset LC_ALL |
949 |
source "${EROOT%/}/etc/env.d/02locale" |
950 |
[ -n "${LANG}" ] && export LANG |
951 |
[ -n "${LC_CTYPE}" ] && export LC_CTYPE |
952 |
[ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
953 |
[ -n "${LC_TIME}" ] && export LC_TIME |
954 |
[ -n "${LC_COLLATE}" ] && export LC_COLLATE |
955 |
[ -n "${LC_MONETARY}" ] && export LC_MONETARY |
956 |
[ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
957 |
[ -n "${LC_ALL}" ] && export LC_ALL |
958 |
fi |
959 |
|
960 |
einfo "You can modify the paths and options passed to initdb by editing:" |
961 |
einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
962 |
einfo |
963 |
einfo "Information on options that can be passed to initdb are found at:" |
964 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
965 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
966 |
einfo |
967 |
einfo "PG_INITDB_OPTS is currently set to:" |
968 |
if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
969 |
einfo " (none)" |
970 |
else |
971 |
einfo " ${PG_INITDB_OPTS}" |
972 |
fi |
973 |
einfo |
974 |
einfo "Configuration files will be installed to:" |
975 |
einfo " ${PGDATA}" |
976 |
einfo |
977 |
einfo "The database cluster will be created in:" |
978 |
einfo " ${DATA_DIR}" |
979 |
einfo |
980 |
while [ "$correct" != "true" ] ; do |
981 |
einfo "Are you ready to continue? (y/n)" |
982 |
read answer |
983 |
if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
984 |
correct="true" |
985 |
elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
986 |
die "Aborting initialization." |
987 |
else |
988 |
echo "Answer not recognized" |
989 |
fi |
990 |
done |
991 |
|
992 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
993 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
994 |
eerror "Modify DATA_DIR to point to an empty directory." |
995 |
die "${DATA_DIR} is not empty." |
996 |
fi |
997 |
|
998 |
einfo "Creating the data directory ..." |
999 |
if [[ ${EUID} == 0 ]] ; then |
1000 |
mkdir -p "${DATA_DIR}" |
1001 |
chown -Rf postgres:postgres "${DATA_DIR}" |
1002 |
chmod 0700 "${DATA_DIR}" |
1003 |
fi |
1004 |
|
1005 |
einfo "Initializing the database ..." |
1006 |
|
1007 |
if [[ ${EUID} == 0 ]] ; then |
1008 |
su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1009 |
else |
1010 |
"${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1011 |
fi |
1012 |
|
1013 |
if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1014 |
mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1015 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1016 |
fi |
1017 |
|
1018 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1019 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1020 |
# On the off-chance that you might need to work with UTF-8 encoded |
1021 |
# characters in PL/Perl |
1022 |
plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1023 |
EOF |
1024 |
|
1025 |
einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1026 |
einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1027 |
einfo "by default. You can disable it in the cluster's:" |
1028 |
einfo " ${PGDATA%/}/postgresql.conf" |
1029 |
einfo |
1030 |
einfo "The PostgreSQL server, by default, will log events to:" |
1031 |
einfo " ${DATA_DIR%/}/postmaster.log" |
1032 |
einfo |
1033 |
if use prefix ; then |
1034 |
einfo "The location of the configuration files have moved to:" |
1035 |
einfo " ${PGDATA}" |
1036 |
einfo "To start the server:" |
1037 |
einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1038 |
einfo "To stop:" |
1039 |
einfo " pg_ctl stop -D ${DATA_DIR}" |
1040 |
einfo |
1041 |
einfo "Or move the configuration files back:" |
1042 |
einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1043 |
else |
1044 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1045 |
einfo "instead of 'pg_ctl'." |
1046 |
fi |
1047 |
} |
1048 |
|
1049 |
src_test() { |
1050 |
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
1051 |
|
1052 |
if use server && [[ ${UID} -ne 0 ]] ; then |
1053 |
emake check |
1054 |
|
1055 |
einfo "If you think other tests besides the regression tests are necessary, please" |
1056 |
einfo "submit a bug including a patch for this ebuild to enable them." |
1057 |
else |
1058 |
use server || \ |
1059 |
ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1060 |
[[ ${UID} -eq 0 ]] || \ |
1061 |
ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1062 |
|
1063 |
ewarn 'Skipping.' |
1064 |
fi |
1065 |
} |
1066 |
|
1067 |
|
1068 |
|
1069 |
1.1 dev-db/postgresql/postgresql-9.1.14-r3.ebuild |
1070 |
|
1071 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.1.14-r3.ebuild?rev=1.1&view=markup |
1072 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.1.14-r3.ebuild?rev=1.1&content-type=text/plain |
1073 |
|
1074 |
Index: postgresql-9.1.14-r3.ebuild |
1075 |
=================================================================== |
1076 |
# Copyright 1999-2014 Gentoo Foundation |
1077 |
# Distributed under the terms of the GNU General Public License v2 |
1078 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9.1.14-r3.ebuild,v 1.1 2014/12/28 18:07:22 titanofold Exp $ |
1079 |
|
1080 |
EAPI="5" |
1081 |
|
1082 |
# Testing within Portage's environment is broken, and the patch no |
1083 |
# longer applies cleanly. |
1084 |
RESTRICT="test" |
1085 |
|
1086 |
PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} ) |
1087 |
|
1088 |
inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
1089 |
systemd user versionator |
1090 |
|
1091 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 |
1092 |
~amd64-fbsd ~ppc-macos ~sparc-fbsd ~x86-fbsd ~x86-solaris" |
1093 |
|
1094 |
SLOT="$(get_version_component_range 1-2)" |
1095 |
|
1096 |
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
1097 |
|
1098 |
LICENSE="POSTGRESQL GPL-2" |
1099 |
DESCRIPTION="PostgreSQL RDBMS" |
1100 |
HOMEPAGE="http://www.postgresql.org/" |
1101 |
|
1102 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
1103 |
zh_CN zh_TW" |
1104 |
IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python |
1105 |
+readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
1106 |
|
1107 |
for lingua in ${LINGUAS}; do |
1108 |
IUSE+=" linguas_${lingua}" |
1109 |
done |
1110 |
|
1111 |
wanted_languages() { |
1112 |
local enable_langs |
1113 |
|
1114 |
for lingua in ${LINGUAS} ; do |
1115 |
use linguas_${lingua} && enable_langs+="${lingua} " |
1116 |
done |
1117 |
|
1118 |
echo -n ${enable_langs} |
1119 |
} |
1120 |
|
1121 |
CDEPEND=" |
1122 |
>=app-admin/eselect-postgresql-1.2.0 |
1123 |
sys-apps/less |
1124 |
virtual/libintl |
1125 |
kerberos? ( virtual/krb5 ) |
1126 |
ldap? ( net-nds/openldap ) |
1127 |
pam? ( virtual/pam ) |
1128 |
perl? ( >=dev-lang/perl-5.8 ) |
1129 |
python? ( ${PYTHON_DEPS} ) |
1130 |
readline? ( sys-libs/readline ) |
1131 |
ssl? ( >=dev-libs/openssl-0.9.6-r1 ) |
1132 |
tcl? ( >=dev-lang/tcl-8 ) |
1133 |
uuid? ( dev-libs/ossp-uuid ) |
1134 |
xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1135 |
zlib? ( sys-libs/zlib ) |
1136 |
" |
1137 |
|
1138 |
DEPEND="${CDEPEND} |
1139 |
!!<sys-apps/sandbox-2.0 |
1140 |
sys-devel/bison |
1141 |
sys-devel/flex |
1142 |
nls? ( sys-devel/gettext ) |
1143 |
xml? ( virtual/pkgconfig ) |
1144 |
" |
1145 |
|
1146 |
RDEPEND="${CDEPEND} |
1147 |
!dev-db/postgresql-docs:${SLOT} |
1148 |
!dev-db/postgresql-base:${SLOT} |
1149 |
!dev-db/postgresql-server:${SLOT} |
1150 |
selinux? ( sec-policy/selinux-postgresql ) |
1151 |
" |
1152 |
|
1153 |
pkg_setup() { |
1154 |
use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1155 |
|
1156 |
enewgroup postgres 70 |
1157 |
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
1158 |
|
1159 |
use python && python-single-r1_pkg_setup |
1160 |
} |
1161 |
|
1162 |
src_prepare() { |
1163 |
# Work around PPC{,64} compilation bug where bool is already defined |
1164 |
sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
1165 |
|
1166 |
# Set proper run directory |
1167 |
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1168 |
-i src/include/pg_config_manual.h || die |
1169 |
|
1170 |
epatch "${FILESDIR}/pg_ctl-exit-status.patch" |
1171 |
|
1172 |
use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
1173 |
|
1174 |
if use pam ; then |
1175 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1176 |
-i src/backend/libpq/auth.c || \ |
1177 |
die 'PGSQL_PAM_SERVICE rename failed.' |
1178 |
fi |
1179 |
} |
1180 |
|
1181 |
src_configure() { |
1182 |
case ${CHOST} in |
1183 |
*-darwin*|*-solaris*) |
1184 |
use nls && append-libs intl |
1185 |
;; |
1186 |
esac |
1187 |
|
1188 |
export LDFLAGS_SL="${LDFLAGS}" |
1189 |
export LDFLAGS_EX="${LDFLAGS}" |
1190 |
|
1191 |
local PO="${EPREFIX%/}" |
1192 |
|
1193 |
econf \ |
1194 |
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1195 |
--datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1196 |
--docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \ |
1197 |
--includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1198 |
--mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1199 |
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1200 |
--with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1201 |
$(use_enable !pg_legacytimestamp integer-datetimes) \ |
1202 |
$(use_enable threads thread-safety) \ |
1203 |
$(use_with kerberos gssapi) \ |
1204 |
$(use_with kerberos krb5) \ |
1205 |
$(use_with ldap) \ |
1206 |
$(use_with pam) \ |
1207 |
$(use_with perl) \ |
1208 |
$(use_with python) \ |
1209 |
$(use_with readline) \ |
1210 |
$(use_with ssl openssl) \ |
1211 |
$(use_with tcl) \ |
1212 |
$(use_with uuid ossp-uuid) \ |
1213 |
$(use_with xml libxml) \ |
1214 |
$(use_with xml libxslt) \ |
1215 |
$(use_with zlib) \ |
1216 |
"$(use_enable nls nls "$(wanted_languages)")" |
1217 |
} |
1218 |
|
1219 |
src_compile() { |
1220 |
emake |
1221 |
emake -C contrib |
1222 |
} |
1223 |
|
1224 |
src_install() { |
1225 |
emake DESTDIR="${D}" install |
1226 |
emake DESTDIR="${D}" install -C contrib |
1227 |
|
1228 |
dodoc README HISTORY doc/{TODO,bug.template} |
1229 |
|
1230 |
# man pages are already built, but if we have the target make them, |
1231 |
# they'll be generated from source before being installed so we |
1232 |
# manually install man pages. |
1233 |
# We use ${SLOT} instead of doman for postgresql.eselect |
1234 |
insinto /usr/share/postgresql-${SLOT}/man/ |
1235 |
doins -r doc/src/sgml/man{1,3,7} |
1236 |
if ! use server; then |
1237 |
# Remove man pages for non-existent binaries |
1238 |
for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
1239 |
rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1240 |
done |
1241 |
fi |
1242 |
docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1243 |
|
1244 |
insinto /etc/postgresql-${SLOT} |
1245 |
newins src/bin/psql/psqlrc.sample psqlrc |
1246 |
|
1247 |
dodir /etc/eselect/postgresql/slots/${SLOT} |
1248 |
echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
1249 |
"${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
1250 |
|
1251 |
use static-libs || find "${ED}" -name '*.a' -delete |
1252 |
|
1253 |
if use doc ; then |
1254 |
docinto html |
1255 |
dodoc doc/src/sgml/html/* |
1256 |
|
1257 |
docinto sgml |
1258 |
dodoc doc/src/sgml/*.{sgml,dsl} |
1259 |
fi |
1260 |
|
1261 |
if use server; then |
1262 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1263 |
"${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
1264 |
|
1265 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1266 |
"${FILESDIR}/${PN}.init-pre_9.2" | newinitd - ${PN}-${SLOT} |
1267 |
|
1268 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1269 |
"${FILESDIR}/${PN}.service" | \ |
1270 |
systemd_newunit - ${PN}-${SLOT}.service |
1271 |
|
1272 |
systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf |
1273 |
|
1274 |
newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1275 |
|
1276 |
use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1277 |
|
1278 |
if use prefix ; then |
1279 |
keepdir /run/postgresql |
1280 |
fperms 0775 /run/postgresql |
1281 |
fi |
1282 |
fi |
1283 |
} |
1284 |
|
1285 |
pkg_postinst() { |
1286 |
postgresql-config update |
1287 |
|
1288 |
elog "If you need a global psqlrc-file, you can place it in:" |
1289 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
1290 |
|
1291 |
if use server ; then |
1292 |
elog |
1293 |
elog "Gentoo specific documentation:" |
1294 |
elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1295 |
elog |
1296 |
elog "Official documentation:" |
1297 |
elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1298 |
elog |
1299 |
elog "The default location of the Unix-domain socket is:" |
1300 |
elog " ${EROOT%/}/run/postgresql/" |
1301 |
elog |
1302 |
elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1303 |
elog "so that it contains your preferred locale in:" |
1304 |
elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1305 |
elog |
1306 |
elog "Then, execute the following command to setup the initial database" |
1307 |
elog "environment:" |
1308 |
elog " emerge --config =${CATEGORY}/${PF}" |
1309 |
fi |
1310 |
} |
1311 |
|
1312 |
pkg_prerm() { |
1313 |
if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1314 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1315 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL#doc_chap5" |
1316 |
|
1317 |
ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1318 |
sleep 10 |
1319 |
eend 0 |
1320 |
fi |
1321 |
} |
1322 |
|
1323 |
pkg_postrm() { |
1324 |
postgresql-config update |
1325 |
} |
1326 |
|
1327 |
pkg_config() { |
1328 |
use server || die "USE flag 'server' not enabled. Nothing to configure." |
1329 |
|
1330 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1331 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1332 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
1333 |
[[ -z "${DATA_DIR}" ]] \ |
1334 |
&& DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
1335 |
|
1336 |
# environment.bz2 may not contain the same locale as the current system |
1337 |
# locale. Unset and source from the current system locale. |
1338 |
if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
1339 |
unset LANG |
1340 |
unset LC_CTYPE |
1341 |
unset LC_NUMERIC |
1342 |
unset LC_TIME |
1343 |
unset LC_COLLATE |
1344 |
unset LC_MONETARY |
1345 |
unset LC_MESSAGES |
1346 |
unset LC_ALL |
1347 |
source "${EROOT%/}/etc/env.d/02locale" |
1348 |
[ -n "${LANG}" ] && export LANG |
1349 |
[ -n "${LC_CTYPE}" ] && export LC_CTYPE |
1350 |
[ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
1351 |
[ -n "${LC_TIME}" ] && export LC_TIME |
1352 |
[ -n "${LC_COLLATE}" ] && export LC_COLLATE |
1353 |
[ -n "${LC_MONETARY}" ] && export LC_MONETARY |
1354 |
[ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
1355 |
[ -n "${LC_ALL}" ] && export LC_ALL |
1356 |
fi |
1357 |
|
1358 |
einfo "You can modify the paths and options passed to initdb by editing:" |
1359 |
einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1360 |
einfo |
1361 |
einfo "Information on options that can be passed to initdb are found at:" |
1362 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1363 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1364 |
einfo |
1365 |
einfo "PG_INITDB_OPTS is currently set to:" |
1366 |
if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1367 |
einfo " (none)" |
1368 |
else |
1369 |
einfo " ${PG_INITDB_OPTS}" |
1370 |
fi |
1371 |
einfo |
1372 |
einfo "Configuration files will be installed to:" |
1373 |
einfo " ${PGDATA}" |
1374 |
einfo |
1375 |
einfo "The database cluster will be created in:" |
1376 |
einfo " ${DATA_DIR}" |
1377 |
einfo |
1378 |
while [ "$correct" != "true" ] ; do |
1379 |
einfo "Are you ready to continue? (y/n)" |
1380 |
read answer |
1381 |
if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
1382 |
correct="true" |
1383 |
elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
1384 |
die "Aborting initialization." |
1385 |
else |
1386 |
echo "Answer not recognized" |
1387 |
fi |
1388 |
done |
1389 |
|
1390 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1391 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
1392 |
eerror "Modify DATA_DIR to point to an empty directory." |
1393 |
die "${DATA_DIR} is not empty." |
1394 |
fi |
1395 |
|
1396 |
einfo "Creating the data directory ..." |
1397 |
if [[ ${EUID} == 0 ]] ; then |
1398 |
mkdir -p "${DATA_DIR}" |
1399 |
chown -Rf postgres:postgres "${DATA_DIR}" |
1400 |
chmod 0700 "${DATA_DIR}" |
1401 |
fi |
1402 |
|
1403 |
einfo "Initializing the database ..." |
1404 |
|
1405 |
if [[ ${EUID} == 0 ]] ; then |
1406 |
su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1407 |
else |
1408 |
"${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1409 |
fi |
1410 |
|
1411 |
if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1412 |
mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1413 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1414 |
fi |
1415 |
|
1416 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1417 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1418 |
# On the off-chance that you might need to work with UTF-8 encoded |
1419 |
# characters in PL/Perl |
1420 |
plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1421 |
EOF |
1422 |
|
1423 |
einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1424 |
einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1425 |
einfo "by default. You can disable it in the cluster's:" |
1426 |
einfo " ${PGDATA%/}/postgresql.conf" |
1427 |
einfo |
1428 |
einfo "The PostgreSQL server, by default, will log events to:" |
1429 |
einfo " ${DATA_DIR%/}/postmaster.log" |
1430 |
einfo |
1431 |
if use prefix ; then |
1432 |
einfo "The location of the configuration files have moved to:" |
1433 |
einfo " ${PGDATA}" |
1434 |
einfo "To start the server:" |
1435 |
einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1436 |
einfo "To stop:" |
1437 |
einfo " pg_ctl stop -D ${DATA_DIR}" |
1438 |
einfo |
1439 |
einfo "Or move the configuration files back:" |
1440 |
einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1441 |
else |
1442 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1443 |
einfo "instead of 'pg_ctl'." |
1444 |
fi |
1445 |
} |
1446 |
|
1447 |
|
1448 |
|
1449 |
1.1 dev-db/postgresql/postgresql-9.0.18-r3.ebuild |
1450 |
|
1451 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.0.18-r3.ebuild?rev=1.1&view=markup |
1452 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.0.18-r3.ebuild?rev=1.1&content-type=text/plain |
1453 |
|
1454 |
Index: postgresql-9.0.18-r3.ebuild |
1455 |
=================================================================== |
1456 |
# Copyright 1999-2014 Gentoo Foundation |
1457 |
# Distributed under the terms of the GNU General Public License v2 |
1458 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9.0.18-r3.ebuild,v 1.1 2014/12/28 18:07:22 titanofold Exp $ |
1459 |
|
1460 |
EAPI="5" |
1461 |
|
1462 |
# Testing within Portage's environment is broken, and the patch no |
1463 |
# longer applies cleanly. |
1464 |
RESTRICT="test" |
1465 |
|
1466 |
PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} ) |
1467 |
|
1468 |
inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
1469 |
systemd user versionator |
1470 |
|
1471 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 |
1472 |
~amd64-fbsd ~ppc-macos ~sparc-fbsd ~x86-fbsd ~x86-solaris" |
1473 |
|
1474 |
SLOT="$(get_version_component_range 1-2)" |
1475 |
|
1476 |
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
1477 |
|
1478 |
LICENSE="POSTGRESQL GPL-2" |
1479 |
DESCRIPTION="PostgreSQL RDBMS" |
1480 |
HOMEPAGE="http://www.postgresql.org/" |
1481 |
|
1482 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
1483 |
zh_CN zh_TW" |
1484 |
IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python |
1485 |
+readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
1486 |
|
1487 |
for lingua in ${LINGUAS}; do |
1488 |
IUSE+=" linguas_${lingua}" |
1489 |
done |
1490 |
|
1491 |
wanted_languages() { |
1492 |
local enable_langs |
1493 |
|
1494 |
for lingua in ${LINGUAS} ; do |
1495 |
use linguas_${lingua} && enable_langs+="${lingua} " |
1496 |
done |
1497 |
|
1498 |
echo -n ${enable_langs} |
1499 |
} |
1500 |
|
1501 |
CDEPEND=" |
1502 |
>=app-admin/eselect-postgresql-1.2.0 |
1503 |
sys-apps/less |
1504 |
virtual/libintl |
1505 |
kerberos? ( virtual/krb5 ) |
1506 |
ldap? ( net-nds/openldap ) |
1507 |
pam? ( virtual/pam ) |
1508 |
perl? ( >=dev-lang/perl-5.8 ) |
1509 |
python? ( ${PYTHON_DEPS} ) |
1510 |
readline? ( sys-libs/readline ) |
1511 |
ssl? ( >=dev-libs/openssl-0.9.6-r1 ) |
1512 |
tcl? ( >=dev-lang/tcl-8 ) |
1513 |
uuid? ( dev-libs/ossp-uuid ) |
1514 |
xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1515 |
zlib? ( sys-libs/zlib ) |
1516 |
" |
1517 |
|
1518 |
DEPEND="${CDEPEND} |
1519 |
!!<sys-apps/sandbox-2.0 |
1520 |
sys-devel/bison |
1521 |
sys-devel/flex |
1522 |
nls? ( sys-devel/gettext ) |
1523 |
xml? ( virtual/pkgconfig ) |
1524 |
" |
1525 |
|
1526 |
RDEPEND="${CDEPEND} |
1527 |
!dev-db/postgresql-docs:${SLOT} |
1528 |
!dev-db/postgresql-base:${SLOT} |
1529 |
!dev-db/postgresql-server:${SLOT} |
1530 |
selinux? ( sec-policy/selinux-postgresql ) |
1531 |
" |
1532 |
|
1533 |
pkg_setup() { |
1534 |
use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1535 |
|
1536 |
enewgroup postgres 70 |
1537 |
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
1538 |
|
1539 |
use python && python-single-r1_pkg_setup |
1540 |
} |
1541 |
|
1542 |
src_prepare() { |
1543 |
# Work around PPC{,64} compilation bug where bool is already defined |
1544 |
sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
1545 |
|
1546 |
# Set proper run directory |
1547 |
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1548 |
-i src/include/pg_config_manual.h || die |
1549 |
|
1550 |
epatch "${FILESDIR}/pg_ctl-exit-status.patch" |
1551 |
|
1552 |
use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
1553 |
|
1554 |
if use pam ; then |
1555 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1556 |
-i src/backend/libpq/auth.c || \ |
1557 |
die 'PGSQL_PAM_SERVICE rename failed.' |
1558 |
fi |
1559 |
} |
1560 |
|
1561 |
src_configure() { |
1562 |
case ${CHOST} in |
1563 |
*-darwin*|*-solaris*) |
1564 |
use nls && append-libs intl |
1565 |
;; |
1566 |
esac |
1567 |
|
1568 |
export LDFLAGS_SL="${LDFLAGS}" |
1569 |
export LDFLAGS_EX="${LDFLAGS}" |
1570 |
|
1571 |
local PO="${EPREFIX%/}" |
1572 |
|
1573 |
econf \ |
1574 |
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1575 |
--datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1576 |
--docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \ |
1577 |
--includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1578 |
--mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1579 |
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1580 |
--with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1581 |
$(use_enable !pg_legacytimestamp integer-datetimes) \ |
1582 |
$(use_enable threads thread-safety) \ |
1583 |
$(use_with kerberos gssapi) \ |
1584 |
$(use_with kerberos krb5) \ |
1585 |
$(use_with ldap) \ |
1586 |
$(use_with pam) \ |
1587 |
$(use_with perl) \ |
1588 |
$(use_with python) \ |
1589 |
$(use_with readline) \ |
1590 |
$(use_with ssl openssl) \ |
1591 |
$(use_with tcl) \ |
1592 |
$(use_with uuid ossp-uuid) \ |
1593 |
$(use_with xml libxml) \ |
1594 |
$(use_with xml libxslt) \ |
1595 |
$(use_with zlib) \ |
1596 |
"$(use_enable nls nls "$(wanted_languages)")" |
1597 |
} |
1598 |
|
1599 |
src_compile() { |
1600 |
emake |
1601 |
emake -C contrib |
1602 |
} |
1603 |
|
1604 |
src_install() { |
1605 |
emake DESTDIR="${D}" install |
1606 |
emake DESTDIR="${D}" install -C contrib |
1607 |
|
1608 |
dodoc README HISTORY doc/{TODO,bug.template} |
1609 |
|
1610 |
# man pages are already built, but if we have the target make them, |
1611 |
# they'll be generated from source before being installed so we |
1612 |
# manually install man pages. |
1613 |
# We use ${SLOT} instead of doman for postgresql.eselect |
1614 |
insinto /usr/share/postgresql-${SLOT}/man/ |
1615 |
doins -r doc/src/sgml/man{1,3,7} |
1616 |
if ! use server; then |
1617 |
# Remove man pages for non-existent binaries |
1618 |
for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
1619 |
rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1620 |
done |
1621 |
fi |
1622 |
docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1623 |
|
1624 |
insinto /etc/postgresql-${SLOT} |
1625 |
newins src/bin/psql/psqlrc.sample psqlrc |
1626 |
|
1627 |
dodir /etc/eselect/postgresql/slots/${SLOT} |
1628 |
echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
1629 |
"${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
1630 |
|
1631 |
use static-libs || find "${ED}" -name '*.a' -delete |
1632 |
|
1633 |
if use doc ; then |
1634 |
docinto html |
1635 |
dodoc doc/src/sgml/html/* |
1636 |
|
1637 |
docinto sgml |
1638 |
dodoc doc/src/sgml/*.{sgml,dsl} |
1639 |
fi |
1640 |
|
1641 |
if use server; then |
1642 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1643 |
"${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
1644 |
|
1645 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1646 |
"${FILESDIR}/${PN}.init-pre_9.2" | newinitd - ${PN}-${SLOT} |
1647 |
|
1648 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1649 |
"${FILESDIR}/${PN}.service" | \ |
1650 |
systemd_newunit - ${PN}-${SLOT}.service |
1651 |
|
1652 |
systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf |
1653 |
|
1654 |
newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1655 |
|
1656 |
use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1657 |
|
1658 |
if use prefix ; then |
1659 |
keepdir /run/postgresql |
1660 |
fperms 0775 /run/postgresql |
1661 |
fi |
1662 |
fi |
1663 |
} |
1664 |
|
1665 |
pkg_postinst() { |
1666 |
postgresql-config update |
1667 |
|
1668 |
elog "If you need a global psqlrc-file, you can place it in:" |
1669 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
1670 |
|
1671 |
if use server ; then |
1672 |
elog |
1673 |
elog "Gentoo specific documentation:" |
1674 |
elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1675 |
elog |
1676 |
elog "Official documentation:" |
1677 |
elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1678 |
elog |
1679 |
elog "The default location of the Unix-domain socket is:" |
1680 |
elog " ${EROOT%/}/run/postgresql/" |
1681 |
elog |
1682 |
elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1683 |
elog "so that it contains your preferred locale in:" |
1684 |
elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1685 |
elog |
1686 |
elog "Then, execute the following command to setup the initial database" |
1687 |
elog "environment:" |
1688 |
elog " emerge --config =${CATEGORY}/${PF}" |
1689 |
fi |
1690 |
} |
1691 |
|
1692 |
pkg_prerm() { |
1693 |
if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1694 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1695 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL#doc_chap5" |
1696 |
|
1697 |
ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1698 |
sleep 10 |
1699 |
eend 0 |
1700 |
fi |
1701 |
} |
1702 |
|
1703 |
pkg_postrm() { |
1704 |
postgresql-config update |
1705 |
} |
1706 |
|
1707 |
pkg_config() { |
1708 |
use server || die "USE flag 'server' not enabled. Nothing to configure." |
1709 |
|
1710 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1711 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1712 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
1713 |
[[ -z "${DATA_DIR}" ]] \ |
1714 |
&& DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
1715 |
|
1716 |
# environment.bz2 may not contain the same locale as the current system |
1717 |
# locale. Unset and source from the current system locale. |
1718 |
if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
1719 |
unset LANG |
1720 |
unset LC_CTYPE |
1721 |
unset LC_NUMERIC |
1722 |
unset LC_TIME |
1723 |
unset LC_COLLATE |
1724 |
unset LC_MONETARY |
1725 |
unset LC_MESSAGES |
1726 |
unset LC_ALL |
1727 |
source "${EROOT%/}/etc/env.d/02locale" |
1728 |
[ -n "${LANG}" ] && export LANG |
1729 |
[ -n "${LC_CTYPE}" ] && export LC_CTYPE |
1730 |
[ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
1731 |
[ -n "${LC_TIME}" ] && export LC_TIME |
1732 |
[ -n "${LC_COLLATE}" ] && export LC_COLLATE |
1733 |
[ -n "${LC_MONETARY}" ] && export LC_MONETARY |
1734 |
[ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
1735 |
[ -n "${LC_ALL}" ] && export LC_ALL |
1736 |
fi |
1737 |
|
1738 |
einfo "You can modify the paths and options passed to initdb by editing:" |
1739 |
einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1740 |
einfo |
1741 |
einfo "Information on options that can be passed to initdb are found at:" |
1742 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1743 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1744 |
einfo |
1745 |
einfo "PG_INITDB_OPTS is currently set to:" |
1746 |
if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1747 |
einfo " (none)" |
1748 |
else |
1749 |
einfo " ${PG_INITDB_OPTS}" |
1750 |
fi |
1751 |
einfo |
1752 |
einfo "Configuration files will be installed to:" |
1753 |
einfo " ${PGDATA}" |
1754 |
einfo |
1755 |
einfo "The database cluster will be created in:" |
1756 |
einfo " ${DATA_DIR}" |
1757 |
einfo |
1758 |
while [ "$correct" != "true" ] ; do |
1759 |
einfo "Are you ready to continue? (y/n)" |
1760 |
read answer |
1761 |
if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
1762 |
correct="true" |
1763 |
elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
1764 |
die "Aborting initialization." |
1765 |
else |
1766 |
echo "Answer not recognized" |
1767 |
fi |
1768 |
done |
1769 |
|
1770 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1771 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
1772 |
eerror "Modify DATA_DIR to point to an empty directory." |
1773 |
die "${DATA_DIR} is not empty." |
1774 |
fi |
1775 |
|
1776 |
einfo "Creating the data directory ..." |
1777 |
if [[ ${EUID} == 0 ]] ; then |
1778 |
mkdir -p "${DATA_DIR}" |
1779 |
chown -Rf postgres:postgres "${DATA_DIR}" |
1780 |
chmod 0700 "${DATA_DIR}" |
1781 |
fi |
1782 |
|
1783 |
einfo "Initializing the database ..." |
1784 |
|
1785 |
if [[ ${EUID} == 0 ]] ; then |
1786 |
su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1787 |
else |
1788 |
"${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1789 |
fi |
1790 |
|
1791 |
if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1792 |
mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1793 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1794 |
fi |
1795 |
|
1796 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1797 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1798 |
# On the off-chance that you might need to work with UTF-8 encoded |
1799 |
# characters in PL/Perl |
1800 |
plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1801 |
EOF |
1802 |
|
1803 |
einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1804 |
einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1805 |
einfo "by default. You can disable it in the cluster's:" |
1806 |
einfo " ${PGDATA%/}/postgresql.conf" |
1807 |
einfo |
1808 |
einfo "The PostgreSQL server, by default, will log events to:" |
1809 |
einfo " ${DATA_DIR%/}/postmaster.log" |
1810 |
einfo |
1811 |
if use prefix ; then |
1812 |
einfo "The location of the configuration files have moved to:" |
1813 |
einfo " ${PGDATA}" |
1814 |
einfo "To start the server:" |
1815 |
einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1816 |
einfo "To stop:" |
1817 |
einfo " pg_ctl stop -D ${DATA_DIR}" |
1818 |
einfo |
1819 |
einfo "Or move the configuration files back:" |
1820 |
einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1821 |
else |
1822 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1823 |
einfo "instead of 'pg_ctl'." |
1824 |
fi |
1825 |
} |
1826 |
|
1827 |
|
1828 |
|
1829 |
1.1 dev-db/postgresql/postgresql-9.4.0-r1.ebuild |
1830 |
|
1831 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.4.0-r1.ebuild?rev=1.1&view=markup |
1832 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/dev-db/postgresql/postgresql-9.4.0-r1.ebuild?rev=1.1&content-type=text/plain |
1833 |
|
1834 |
Index: postgresql-9.4.0-r1.ebuild |
1835 |
=================================================================== |
1836 |
# Copyright 1999-2014 Gentoo Foundation |
1837 |
# Distributed under the terms of the GNU General Public License v2 |
1838 |
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-9.4.0-r1.ebuild,v 1.1 2014/12/28 18:07:22 titanofold Exp $ |
1839 |
|
1840 |
EAPI="5" |
1841 |
|
1842 |
PYTHON_COMPAT=( python{2_{6,7},3_{2,3,4}} ) |
1843 |
|
1844 |
inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
1845 |
systemd user versionator |
1846 |
|
1847 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 |
1848 |
~amd64-fbsd ~ppc-macos ~sparc-fbsd ~x86-fbsd ~x86-solaris" |
1849 |
|
1850 |
SLOT="$(get_version_component_range 1-2)" |
1851 |
|
1852 |
SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
1853 |
|
1854 |
LICENSE="POSTGRESQL GPL-2" |
1855 |
DESCRIPTION="PostgreSQL RDBMS" |
1856 |
HOMEPAGE="http://www.postgresql.org/" |
1857 |
|
1858 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
1859 |
zh_CN zh_TW" |
1860 |
IUSE="doc kerberos kernel_linux ldap nls pam perl -pg_legacytimestamp python |
1861 |
+readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
1862 |
|
1863 |
for lingua in ${LINGUAS}; do |
1864 |
IUSE+=" linguas_${lingua}" |
1865 |
done |
1866 |
|
1867 |
wanted_languages() { |
1868 |
local enable_langs |
1869 |
|
1870 |
for lingua in ${LINGUAS} ; do |
1871 |
use linguas_${lingua} && enable_langs+="${lingua} " |
1872 |
done |
1873 |
|
1874 |
echo -n ${enable_langs} |
1875 |
} |
1876 |
|
1877 |
CDEPEND=" |
1878 |
>=app-admin/eselect-postgresql-1.2.0 |
1879 |
sys-apps/less |
1880 |
virtual/libintl |
1881 |
kerberos? ( virtual/krb5 ) |
1882 |
ldap? ( net-nds/openldap ) |
1883 |
pam? ( virtual/pam ) |
1884 |
perl? ( >=dev-lang/perl-5.8 ) |
1885 |
python? ( ${PYTHON_DEPS} ) |
1886 |
readline? ( sys-libs/readline ) |
1887 |
ssl? ( >=dev-libs/openssl-0.9.6-r1 ) |
1888 |
tcl? ( >=dev-lang/tcl-8 ) |
1889 |
uuid? ( dev-libs/ossp-uuid ) |
1890 |
xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1891 |
zlib? ( sys-libs/zlib ) |
1892 |
" |
1893 |
|
1894 |
DEPEND="${CDEPEND} |
1895 |
!!<sys-apps/sandbox-2.0 |
1896 |
sys-devel/bison |
1897 |
sys-devel/flex |
1898 |
nls? ( sys-devel/gettext ) |
1899 |
xml? ( virtual/pkgconfig ) |
1900 |
" |
1901 |
|
1902 |
RDEPEND="${CDEPEND} |
1903 |
!dev-db/postgresql-docs:${SLOT} |
1904 |
!dev-db/postgresql-base:${SLOT} |
1905 |
!dev-db/postgresql-server:${SLOT} |
1906 |
selinux? ( sec-policy/selinux-postgresql ) |
1907 |
" |
1908 |
|
1909 |
pkg_setup() { |
1910 |
use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1911 |
|
1912 |
enewgroup postgres 70 |
1913 |
enewuser postgres 70 /bin/bash /var/lib/postgresql postgres |
1914 |
|
1915 |
use python && python-single-r1_pkg_setup |
1916 |
} |
1917 |
|
1918 |
src_prepare() { |
1919 |
# Work around PPC{,64} compilation bug where bool is already defined |
1920 |
sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
1921 |
|
1922 |
# Set proper run directory |
1923 |
sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1924 |
-i src/include/pg_config_manual.h || die |
1925 |
|
1926 |
use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
1927 |
|
1928 |
if use pam ; then |
1929 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1930 |
-i src/backend/libpq/auth.c || \ |
1931 |
die 'PGSQL_PAM_SERVICE rename failed.' |
1932 |
fi |
1933 |
} |
1934 |
|
1935 |
src_configure() { |
1936 |
case ${CHOST} in |
1937 |
*-darwin*|*-solaris*) |
1938 |
use nls && append-libs intl |
1939 |
;; |
1940 |
esac |
1941 |
|
1942 |
export LDFLAGS_SL="${LDFLAGS}" |
1943 |
export LDFLAGS_EX="${LDFLAGS}" |
1944 |
|
1945 |
local PO="${EPREFIX%/}" |
1946 |
|
1947 |
econf \ |
1948 |
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1949 |
--datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1950 |
--docdir="${PO}/usr/share/doc/postgresql-${SLOT}" \ |
1951 |
--includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1952 |
--mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1953 |
--sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1954 |
--with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1955 |
$(use_enable !pg_legacytimestamp integer-datetimes) \ |
1956 |
$(use_enable threads thread-safety) \ |
1957 |
$(use_with kerberos gssapi) \ |
1958 |
$(use_with ldap) \ |
1959 |
$(use_with pam) \ |
1960 |
$(use_with perl) \ |
1961 |
$(use_with python) \ |
1962 |
$(use_with readline) \ |
1963 |
$(use_with ssl openssl) \ |
1964 |
$(use_with tcl) \ |
1965 |
$(use_with uuid ossp-uuid) \ |
1966 |
$(use_with xml libxml) \ |
1967 |
$(use_with xml libxslt) \ |
1968 |
$(use_with zlib) \ |
1969 |
"$(use_enable nls nls "$(wanted_languages)")" |
1970 |
} |
1971 |
|
1972 |
src_compile() { |
1973 |
emake |
1974 |
emake -C contrib |
1975 |
} |
1976 |
|
1977 |
src_install() { |
1978 |
emake DESTDIR="${D}" install |
1979 |
emake DESTDIR="${D}" install -C contrib |
1980 |
|
1981 |
dodoc README HISTORY doc/{TODO,bug.template} |
1982 |
|
1983 |
# man pages are already built, but if we have the target make them, |
1984 |
# they'll be generated from source before being installed so we |
1985 |
# manually install man pages. |
1986 |
# We use ${SLOT} instead of doman for postgresql.eselect |
1987 |
insinto /usr/share/postgresql-${SLOT}/man/ |
1988 |
doins -r doc/src/sgml/man{1,3,7} |
1989 |
if ! use server; then |
1990 |
# Remove man pages for non-existent binaries |
1991 |
for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
1992 |
rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1993 |
done |
1994 |
fi |
1995 |
docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1996 |
|
1997 |
insinto /etc/postgresql-${SLOT} |
1998 |
newins src/bin/psql/psqlrc.sample psqlrc |
1999 |
|
2000 |
dodir /etc/eselect/postgresql/slots/${SLOT} |
2001 |
echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
2002 |
"${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
2003 |
|
2004 |
use static-libs || find "${ED}" -name '*.a' -delete |
2005 |
|
2006 |
if use doc ; then |
2007 |
docinto html |
2008 |
dodoc doc/src/sgml/html/* |
2009 |
|
2010 |
docinto sgml |
2011 |
dodoc doc/src/sgml/*.{sgml,dsl} |
2012 |
fi |
2013 |
|
2014 |
if use server; then |
2015 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2016 |
"${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
2017 |
|
2018 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2019 |
"${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
2020 |
|
2021 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2022 |
"${FILESDIR}/${PN}.service" | \ |
2023 |
systemd_newunit - ${PN}-${SLOT}.service |
2024 |
|
2025 |
systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfilesd ${PN}-${SLOT}.conf |
2026 |
|
2027 |
newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
2028 |
|
2029 |
use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
2030 |
|
2031 |
if use prefix ; then |
2032 |
keepdir /run/postgresql |
2033 |
fperms 0775 /run/postgresql |
2034 |
fi |
2035 |
fi |
2036 |
} |
2037 |
|
2038 |
pkg_postinst() { |
2039 |
postgresql-config update |
2040 |
|
2041 |
elog "If you need a global psqlrc-file, you can place it in:" |
2042 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
2043 |
|
2044 |
if use server ; then |
2045 |
elog |
2046 |
elog "Gentoo specific documentation:" |
2047 |
elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
2048 |
elog |
2049 |
elog "Official documentation:" |
2050 |
elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
2051 |
elog |
2052 |
elog "The default location of the Unix-domain socket is:" |
2053 |
elog " ${EROOT%/}/run/postgresql/" |
2054 |
elog |
2055 |
elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
2056 |
elog "so that it contains your preferred locale in:" |
2057 |
elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2058 |
elog |
2059 |
elog "Then, execute the following command to setup the initial database" |
2060 |
elog "environment:" |
2061 |
elog " emerge --config =${CATEGORY}/${PF}" |
2062 |
fi |
2063 |
} |
2064 |
|
2065 |
pkg_prerm() { |
2066 |
if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
2067 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
2068 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL#doc_chap5" |
2069 |
|
2070 |
ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
2071 |
sleep 10 |
2072 |
eend 0 |
2073 |
fi |
2074 |
} |
2075 |
|
2076 |
pkg_postrm() { |
2077 |
postgresql-config update |
2078 |
} |
2079 |
|
2080 |
pkg_config() { |
2081 |
use server || die "USE flag 'server' not enabled. Nothing to configure." |
2082 |
|
2083 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
2084 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2085 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
2086 |
[[ -z "${DATA_DIR}" ]] \ |
2087 |
&& DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
2088 |
|
2089 |
# environment.bz2 may not contain the same locale as the current system |
2090 |
# locale. Unset and source from the current system locale. |
2091 |
if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
2092 |
unset LANG |
2093 |
unset LC_CTYPE |
2094 |
unset LC_NUMERIC |
2095 |
unset LC_TIME |
2096 |
unset LC_COLLATE |
2097 |
unset LC_MONETARY |
2098 |
unset LC_MESSAGES |
2099 |
unset LC_ALL |
2100 |
source "${EROOT%/}/etc/env.d/02locale" |
2101 |
[ -n "${LANG}" ] && export LANG |
2102 |
[ -n "${LC_CTYPE}" ] && export LC_CTYPE |
2103 |
[ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
2104 |
[ -n "${LC_TIME}" ] && export LC_TIME |
2105 |
[ -n "${LC_COLLATE}" ] && export LC_COLLATE |
2106 |
[ -n "${LC_MONETARY}" ] && export LC_MONETARY |
2107 |
[ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
2108 |
[ -n "${LC_ALL}" ] && export LC_ALL |
2109 |
fi |
2110 |
|
2111 |
einfo "You can modify the paths and options passed to initdb by editing:" |
2112 |
einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2113 |
einfo |
2114 |
einfo "Information on options that can be passed to initdb are found at:" |
2115 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
2116 |
einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
2117 |
einfo |
2118 |
einfo "PG_INITDB_OPTS is currently set to:" |
2119 |
if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
2120 |
einfo " (none)" |
2121 |
else |
2122 |
einfo " ${PG_INITDB_OPTS}" |
2123 |
fi |
2124 |
einfo |
2125 |
einfo "Configuration files will be installed to:" |
2126 |
einfo " ${PGDATA}" |
2127 |
einfo |
2128 |
einfo "The database cluster will be created in:" |
2129 |
einfo " ${DATA_DIR}" |
2130 |
einfo |
2131 |
while [ "$correct" != "true" ] ; do |
2132 |
einfo "Are you ready to continue? (y/n)" |
2133 |
read answer |
2134 |
if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
2135 |
correct="true" |
2136 |
elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
2137 |
die "Aborting initialization." |
2138 |
else |
2139 |
echo "Answer not recognized" |
2140 |
fi |
2141 |
done |
2142 |
|
2143 |
if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
2144 |
eerror "The given directory, '${DATA_DIR}', is not empty." |
2145 |
eerror "Modify DATA_DIR to point to an empty directory." |
2146 |
die "${DATA_DIR} is not empty." |
2147 |
fi |
2148 |
|
2149 |
einfo "Creating the data directory ..." |
2150 |
if [[ ${EUID} == 0 ]] ; then |
2151 |
mkdir -p "${DATA_DIR}" |
2152 |
chown -Rf postgres:postgres "${DATA_DIR}" |
2153 |
chmod 0700 "${DATA_DIR}" |
2154 |
fi |
2155 |
|
2156 |
einfo "Initializing the database ..." |
2157 |
|
2158 |
if [[ ${EUID} == 0 ]] ; then |
2159 |
su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
2160 |
else |
2161 |
"${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
2162 |
fi |
2163 |
|
2164 |
if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
2165 |
mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
2166 |
ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
2167 |
fi |
2168 |
|
2169 |
cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
2170 |
# This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
2171 |
# On the off-chance that you might need to work with UTF-8 encoded |
2172 |
# characters in PL/Perl |
2173 |
plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
2174 |
EOF |
2175 |
|
2176 |
einfo "The autovacuum function, which was in contrib, has been moved to the main" |
2177 |
einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
2178 |
einfo "by default. You can disable it in the cluster's:" |
2179 |
einfo " ${PGDATA%/}/postgresql.conf" |
2180 |
einfo |
2181 |
einfo "The PostgreSQL server, by default, will log events to:" |
2182 |
einfo " ${DATA_DIR%/}/postmaster.log" |
2183 |
einfo |
2184 |
if use prefix ; then |
2185 |
einfo "The location of the configuration files have moved to:" |
2186 |
einfo " ${PGDATA}" |
2187 |
einfo "To start the server:" |
2188 |
einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
2189 |
einfo "To stop:" |
2190 |
einfo " pg_ctl stop -D ${DATA_DIR}" |
2191 |
einfo |
2192 |
einfo "Or move the configuration files back:" |
2193 |
einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
2194 |
else |
2195 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
2196 |
einfo "instead of 'pg_ctl'." |
2197 |
fi |
2198 |
} |
2199 |
|
2200 |
src_test() { |
2201 |
einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
2202 |
|
2203 |
if use server && [[ ${UID} -ne 0 ]] ; then |
2204 |
emake check |
2205 |
|
2206 |
einfo "If you think other tests besides the regression tests are necessary, please" |
2207 |
einfo "submit a bug including a patch for this ebuild to enable them." |
2208 |
else |
2209 |
use server || \ |
2210 |
ewarn 'Tests cannot be run without the "server" use flag enabled.' |
2211 |
[[ ${UID} -eq 0 ]] || \ |
2212 |
ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
2213 |
|
2214 |
ewarn 'Skipping.' |
2215 |
fi |
2216 |
} |