1 |
commit: adffb1e0b71aad1d26c422fd23b4dabebee89874 |
2 |
Author: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 15 17:59:32 2018 +0000 |
4 |
Commit: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 15 17:59:32 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=adffb1e0 |
7 |
|
8 |
dev-db/postgresql: Bump to 11_beta2 |
9 |
|
10 |
Package-Manager: Portage-2.3.42, Repoman-2.3.9 |
11 |
|
12 |
dev-db/postgresql/Manifest | 1 + |
13 |
dev-db/postgresql/postgresql-11_beta2.ebuild | 449 +++++++++++++++++++++++++++ |
14 |
2 files changed, 450 insertions(+) |
15 |
|
16 |
diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest |
17 |
index 22930870b63..b7bc43b96fa 100644 |
18 |
--- a/dev-db/postgresql/Manifest |
19 |
+++ b/dev-db/postgresql/Manifest |
20 |
@@ -1,6 +1,7 @@ |
21 |
DIST postgresql-10.3.tar.bz2 19959653 BLAKE2B ba3b05f53b0f879b18d6d0649bf819697c77a066b49d941a96d13a4741854b01aeb0c8b868d6550a08ad52572c9463c968660aa83c16cbaa5b4bf7a89387a524 SHA512 05cf82d3483bdf38734e6ff0fef6b80e7f8fd3cb5ea6792ffe222a599d97d1a29638970bf28ebf5bd1f877e8dcd9986d88f5c5e5379e74fe79ce83e20d2babba |
22 |
DIST postgresql-10.4.tar.bz2 20201838 BLAKE2B 6d1cdc44547740c8f9fbc2e989364640409c6d2a365568b75731277dd0fba473ce07e2ee27e8ebfad507a6ce0ab3d3a44156c0e3a069d96d320771d8a97ba82f SHA512 b7c0d2fdc724e2eb1cda9fc1eb01b47352bbe6ba6357b3e898b7f5990fd78499c8c68dcb3aa9bde7821d71b5882d8856131384e899f8055d89d51cdfdbc9e663 |
23 |
DIST postgresql-11beta1.tar.bz2 20945387 BLAKE2B a99aff17a656da2250309f2652237c8df3a3aeed088250be6114964c103dec40d0c4cc60b048b2ffa1e9733aed8e9df2597d57cab58482512c42f25139dc3499 SHA512 fa4e9cf8293fecf384d98d3a5bbed208eda2e4dd8bf05a9922a74355daba74dde4dbe0cd42bea1de155f4fea3cdcd0d7621d7e315c1d5f49ce5ee794b01b9f6d |
24 |
+DIST postgresql-11beta2.tar.bz2 21086270 BLAKE2B ecea671334cc8dcc59ef46e1e9dfc16c1f0c44623d5355a42ef07797c6794109f10532fb6bfd6b4165e92a83d42514547e402cbe1a3618a6e6894432b3e2945d SHA512 3f9120af5f39d10937d92344c45e19f6d4de097dc24a081cd1984b27df4ecb8b0c15c638c8b1f8830b0003f01808159bd91305f9744eb6ae6c3425b3bf677937 |
25 |
DIST postgresql-9.3.22.tar.bz2 17022938 BLAKE2B 198705e438717d0d9e12c73e0c0e3eff0ba89ea50a1b183de70f065e13c153c164890fe56bc6ec13b0cb9617df4f66894c122eeddaf9303b9a02b8e08b19b085 SHA512 667ff496172626d2fe35c6795935fb07f4f7967a3b0631dd3b96278f8dc00b3d08794f091a5ab060a45d6f2a861e0f10f0e9660f9e343ab34eeabd693104c47f |
26 |
DIST postgresql-9.3.23.tar.bz2 17033683 BLAKE2B f02ad25f6b8755a9a57c3a6dcb63b78672e29473b061ad1616be2fb97fbfd83fe0dc9fc9fda66ac0231fb30fb13f9ef8975ba5a9701d83f33495bcf2c2651b4a SHA512 bb2d54312de728aa0379ea5bc6385036bbe69d3b7f85bbd78c210840eed19ace29840849caf38d0689e21130a0c94818a362b3927805d8eded53b68e240a52b0 |
27 |
DIST postgresql-9.4.17.tar.bz2 17807762 BLAKE2B 7640c29a71c6aeff47d9b43dd1e4f52edac4295b646b34da3a0ed9c26a8a826061bfd892e9907b62f31b7f01ee3aaf437c88d79b84d1d786d608dcd088309ecf SHA512 9ac03d460e521dcd142ac463dd5bb0f3e3f47333367bf8d61499ec7e8d0129d338c6f111667d0006df0c8ced9ae8a337d4c1b40eb5f55e6bc8dd5a24dfd376f0 |
28 |
|
29 |
diff --git a/dev-db/postgresql/postgresql-11_beta2.ebuild b/dev-db/postgresql/postgresql-11_beta2.ebuild |
30 |
new file mode 100644 |
31 |
index 00000000000..8c9760a046d |
32 |
--- /dev/null |
33 |
+++ b/dev-db/postgresql/postgresql-11_beta2.ebuild |
34 |
@@ -0,0 +1,449 @@ |
35 |
+# Copyright 1999-2018 Gentoo Foundation |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI="6" |
39 |
+ |
40 |
+PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) |
41 |
+ |
42 |
+PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
43 |
+ zh_TW" |
44 |
+ |
45 |
+inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
46 |
+ systemd user versionator |
47 |
+ |
48 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
49 |
+ |
50 |
+SLOT=$(get_major_version) |
51 |
+ |
52 |
+MY_PV=${PV/_/} |
53 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
54 |
+ |
55 |
+SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
56 |
+ |
57 |
+LICENSE="POSTGRESQL GPL-2" |
58 |
+DESCRIPTION="PostgreSQL RDBMS" |
59 |
+HOMEPAGE="http://www.postgresql.org/" |
60 |
+ |
61 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl python +readline |
62 |
+ selinux +server systemd ssl static-libs tcl threads uuid xml zlib" |
63 |
+ |
64 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
65 |
+ |
66 |
+CDEPEND=" |
67 |
+>=app-eselect/eselect-postgresql-2.0 |
68 |
+sys-apps/less |
69 |
+virtual/libintl |
70 |
+kerberos? ( virtual/krb5 ) |
71 |
+ldap? ( net-nds/openldap ) |
72 |
+pam? ( virtual/pam ) |
73 |
+perl? ( >=dev-lang/perl-5.8:= ) |
74 |
+python? ( ${PYTHON_DEPS} ) |
75 |
+readline? ( sys-libs/readline:0= ) |
76 |
+server? ( systemd? ( sys-apps/systemd ) ) |
77 |
+ssl? ( |
78 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
79 |
+ libressl? ( dev-libs/libressl:= ) |
80 |
+) |
81 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
82 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
83 |
+zlib? ( sys-libs/zlib ) |
84 |
+" |
85 |
+ |
86 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
87 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
88 |
+# the libc includes UUID functions. |
89 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
90 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
91 |
+ |
92 |
+nest_usedep() { |
93 |
+ local front back |
94 |
+ while [[ ${#} -gt 1 ]]; do |
95 |
+ front+="${1}? ( " |
96 |
+ back+=" )" |
97 |
+ shift |
98 |
+ done |
99 |
+ echo "${front}${1}${back}" |
100 |
+} |
101 |
+ |
102 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
103 |
+CDEPEND+=" |
104 |
+uuid? ( |
105 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
106 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
107 |
+)" |
108 |
+ |
109 |
+DEPEND="${CDEPEND} |
110 |
+!!<sys-apps/sandbox-2.0 |
111 |
+sys-devel/bison |
112 |
+sys-devel/flex |
113 |
+nls? ( sys-devel/gettext ) |
114 |
+xml? ( virtual/pkgconfig ) |
115 |
+" |
116 |
+ |
117 |
+RDEPEND="${CDEPEND} |
118 |
+!dev-db/postgresql-docs:${SLOT} |
119 |
+!dev-db/postgresql-base:${SLOT} |
120 |
+!dev-db/postgresql-server:${SLOT} |
121 |
+selinux? ( sec-policy/selinux-postgresql ) |
122 |
+" |
123 |
+ |
124 |
+pkg_setup() { |
125 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
126 |
+ |
127 |
+ enewgroup postgres 70 |
128 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
129 |
+ |
130 |
+ use python && python-single-r1_pkg_setup |
131 |
+} |
132 |
+ |
133 |
+src_prepare() { |
134 |
+ # Set proper run directory |
135 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
136 |
+ -i src/include/pg_config_manual.h || die |
137 |
+ |
138 |
+ # Rely on $PATH being in the proper order so that the correct |
139 |
+ # install program is used for modules utilizing PGXS in both |
140 |
+ # hardened and non-hardened environments. (Bug #528786) |
141 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
142 |
+ |
143 |
+ use server || eapply "${FILESDIR}/${PN}-11_beta1-no-server.patch" |
144 |
+ |
145 |
+ if use pam ; then |
146 |
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
147 |
+ -i src/backend/libpq/auth.c || \ |
148 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
149 |
+ fi |
150 |
+ |
151 |
+ eapply_user |
152 |
+} |
153 |
+ |
154 |
+src_configure() { |
155 |
+ case ${CHOST} in |
156 |
+ *-darwin*|*-solaris*) |
157 |
+ use nls && append-libs intl |
158 |
+ ;; |
159 |
+ esac |
160 |
+ |
161 |
+ export LDFLAGS_SL="${LDFLAGS}" |
162 |
+ export LDFLAGS_EX="${LDFLAGS}" |
163 |
+ |
164 |
+ local PO="${EPREFIX%/}" |
165 |
+ |
166 |
+ local i uuid_config="" |
167 |
+ if use uuid; then |
168 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
169 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
170 |
+ done |
171 |
+ for i in ${BSD_LIBC[@]}; do |
172 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
173 |
+ done |
174 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
175 |
+ fi |
176 |
+ |
177 |
+ econf \ |
178 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
179 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
180 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
181 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
182 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
183 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
184 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
185 |
+ $(use_enable !alpha spinlocks) \ |
186 |
+ $(use_enable threads thread-safety) \ |
187 |
+ $(use_with kerberos gssapi) \ |
188 |
+ $(use_with ldap) \ |
189 |
+ $(use_with pam) \ |
190 |
+ $(use_with perl) \ |
191 |
+ $(use_with python) \ |
192 |
+ $(use_with readline) \ |
193 |
+ $(use_with ssl openssl) \ |
194 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
195 |
+ $(use_with tcl) \ |
196 |
+ ${uuid_config} \ |
197 |
+ $(use_with xml libxml) \ |
198 |
+ $(use_with xml libxslt) \ |
199 |
+ $(use_with zlib) \ |
200 |
+ $(use_enable nls nls "'$(l10n_get_locales)'") |
201 |
+} |
202 |
+ |
203 |
+src_compile() { |
204 |
+ emake |
205 |
+ emake -C contrib |
206 |
+} |
207 |
+ |
208 |
+src_install() { |
209 |
+ emake DESTDIR="${D}" install |
210 |
+ emake DESTDIR="${D}" install -C contrib |
211 |
+ |
212 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
213 |
+ |
214 |
+ # man pages are already built, but if we have the target make them, |
215 |
+ # they'll be generated from source before being installed so we |
216 |
+ # manually install man pages. |
217 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
218 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
219 |
+ doins -r doc/src/sgml/man{1,3,7} |
220 |
+ if ! use server; then |
221 |
+ # Remove man pages for non-existent binaries |
222 |
+ serverman=( |
223 |
+ initdb |
224 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
225 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
226 |
+ post{gres,master} |
227 |
+ ) |
228 |
+ for m in ${serverman[@]} ; do |
229 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
230 |
+ done |
231 |
+ fi |
232 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
233 |
+ |
234 |
+ # Create slot specific man pages |
235 |
+ local bn f mansec slotted_name |
236 |
+ for mansec in 1 3 7 ; do |
237 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
238 |
+ |
239 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
240 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
241 |
+ |
242 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
243 |
+ bn=$(basename "${f}") |
244 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
245 |
+ case ${bn} in |
246 |
+ TABLE.7|WITH.7) |
247 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
248 |
+ ;; |
249 |
+ *) |
250 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
251 |
+ ;; |
252 |
+ esac |
253 |
+ done |
254 |
+ |
255 |
+ popd > /dev/null |
256 |
+ done |
257 |
+ |
258 |
+ insinto /etc/postgresql-${SLOT} |
259 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
260 |
+ |
261 |
+ use static-libs || find "${ED}" -name '*.a' -delete |
262 |
+ |
263 |
+ local f bn |
264 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
265 |
+ -mindepth 1 -maxdepth 1) |
266 |
+ do |
267 |
+ bn=$(basename "${f}") |
268 |
+ # Temporarily tack on tmp to workaround a file collision |
269 |
+ # issue. This is only necessary for 9.7 and earlier. 10 never |
270 |
+ # had this issue. |
271 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
272 |
+ "/usr/bin/${bn}${SLOT/.}" |
273 |
+ done |
274 |
+ |
275 |
+ if use doc ; then |
276 |
+ docinto html |
277 |
+ dodoc doc/src/sgml/html/* |
278 |
+ fi |
279 |
+ |
280 |
+ if use server; then |
281 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
282 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
283 |
+ |
284 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
285 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
286 |
+ |
287 |
+ if use systemd; then |
288 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
289 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
290 |
+ systemd_newunit - ${PN}-${SLOT}.service |
291 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
292 |
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
293 |
+ fi |
294 |
+ |
295 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
296 |
+ |
297 |
+ if use prefix ; then |
298 |
+ keepdir /run/postgresql |
299 |
+ fperms 1775 /run/postgresql |
300 |
+ fi |
301 |
+ fi |
302 |
+} |
303 |
+ |
304 |
+pkg_postinst() { |
305 |
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
306 |
+ postgresql-config update |
307 |
+ |
308 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
309 |
+ elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
310 |
+ |
311 |
+ if use server ; then |
312 |
+ elog |
313 |
+ elog "Gentoo specific documentation:" |
314 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
315 |
+ elog |
316 |
+ elog "Official documentation:" |
317 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
318 |
+ elog |
319 |
+ elog "The default location of the Unix-domain socket is:" |
320 |
+ elog " ${EROOT%/}/run/postgresql/" |
321 |
+ elog |
322 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
323 |
+ elog "so that it contains your preferred locale in:" |
324 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
325 |
+ elog |
326 |
+ elog "Then, execute the following command to setup the initial database" |
327 |
+ elog "environment:" |
328 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
329 |
+ fi |
330 |
+} |
331 |
+ |
332 |
+pkg_prerm() { |
333 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
334 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
335 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
336 |
+ |
337 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
338 |
+ sleep 10 |
339 |
+ eend 0 |
340 |
+ fi |
341 |
+} |
342 |
+ |
343 |
+pkg_postrm() { |
344 |
+ postgresql-config update |
345 |
+} |
346 |
+ |
347 |
+pkg_config() { |
348 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
349 |
+ |
350 |
+ [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
351 |
+ && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
352 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
353 |
+ [[ -z "${DATA_DIR}" ]] \ |
354 |
+ && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
355 |
+ |
356 |
+ # environment.bz2 may not contain the same locale as the current system |
357 |
+ # locale. Unset and source from the current system locale. |
358 |
+ if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
359 |
+ unset LANG |
360 |
+ unset LC_CTYPE |
361 |
+ unset LC_NUMERIC |
362 |
+ unset LC_TIME |
363 |
+ unset LC_COLLATE |
364 |
+ unset LC_MONETARY |
365 |
+ unset LC_MESSAGES |
366 |
+ unset LC_ALL |
367 |
+ source "${EROOT%/}/etc/env.d/02locale" |
368 |
+ [ -n "${LANG}" ] && export LANG |
369 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
370 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
371 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
372 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
373 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
374 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
375 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
376 |
+ fi |
377 |
+ |
378 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
379 |
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
380 |
+ einfo |
381 |
+ einfo "Information on options that can be passed to initdb are found at:" |
382 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
383 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
384 |
+ einfo |
385 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
386 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
387 |
+ einfo " (none)" |
388 |
+ else |
389 |
+ einfo " ${PG_INITDB_OPTS}" |
390 |
+ fi |
391 |
+ einfo |
392 |
+ einfo "Configuration files will be installed to:" |
393 |
+ einfo " ${PGDATA}" |
394 |
+ einfo |
395 |
+ einfo "The database cluster will be created in:" |
396 |
+ einfo " ${DATA_DIR}" |
397 |
+ einfo |
398 |
+ |
399 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
400 |
+ sleep 5 |
401 |
+ eend 0 |
402 |
+ |
403 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
404 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
405 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
406 |
+ die "${DATA_DIR} is not empty." |
407 |
+ fi |
408 |
+ |
409 |
+ einfo "Creating the data directory ..." |
410 |
+ if [[ ${EUID} == 0 ]] ; then |
411 |
+ mkdir -p "${DATA_DIR}" |
412 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
413 |
+ chmod 0700 "${DATA_DIR}" |
414 |
+ fi |
415 |
+ |
416 |
+ einfo "Initializing the database ..." |
417 |
+ |
418 |
+ if [[ ${EUID} == 0 ]] ; then |
419 |
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
420 |
+ else |
421 |
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
422 |
+ fi |
423 |
+ |
424 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
425 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
426 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
427 |
+ fi |
428 |
+ |
429 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
430 |
+ # overridden in the initscript |
431 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
432 |
+ |
433 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
434 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
435 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
436 |
+ # characters in PL/Perl |
437 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
438 |
+ EOF |
439 |
+ |
440 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
441 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
442 |
+ einfo "by default. You can disable it in the cluster's:" |
443 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
444 |
+ einfo |
445 |
+ if ! use systemd; then |
446 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
447 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
448 |
+ einfo |
449 |
+ fi |
450 |
+ if use prefix ; then |
451 |
+ einfo "The location of the configuration files have moved to:" |
452 |
+ einfo " ${PGDATA}" |
453 |
+ einfo "To start the server:" |
454 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
455 |
+ einfo "To stop:" |
456 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
457 |
+ einfo |
458 |
+ einfo "Or move the configuration files back:" |
459 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
460 |
+ elif use systemd; then |
461 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
462 |
+ einfo "instead of 'pg_ctl'." |
463 |
+ else |
464 |
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
465 |
+ einfo "instead of 'pg_ctl'." |
466 |
+ fi |
467 |
+} |
468 |
+ |
469 |
+src_test() { |
470 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
471 |
+ emake check |
472 |
+ |
473 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
474 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
475 |
+ else |
476 |
+ use server || \ |
477 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
478 |
+ [[ ${UID} -eq 0 ]] || \ |
479 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
480 |
+ |
481 |
+ ewarn 'Skipping.' |
482 |
+ fi |
483 |
+} |