1 |
commit: 92472321d2bf525eb10916e9f5f7835644f4fbac |
2 |
Author: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 21 15:06:56 2020 +0000 |
4 |
Commit: 罗百科 <patrick <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 21 15:09:06 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92472321 |
7 |
|
8 |
dev-db/postgresql: Bump to 13_beta1 |
9 |
|
10 |
Package-Manager: Portage-2.3.99, Repoman-2.3.22 |
11 |
Signed-off-by: Patrick Lauer <patrick <AT> gentoo.org> |
12 |
|
13 |
dev-db/postgresql/Manifest | 1 + |
14 |
dev-db/postgresql/postgresql-13_beta1.ebuild | 458 +++++++++++++++++++++++++++ |
15 |
2 files changed, 459 insertions(+) |
16 |
|
17 |
diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest |
18 |
index 5ff74d98e19..423b260d4c1 100644 |
19 |
--- a/dev-db/postgresql/Manifest |
20 |
+++ b/dev-db/postgresql/Manifest |
21 |
@@ -4,6 +4,7 @@ DIST postgresql-11.7.tar.bz2 19890063 BLAKE2B 461c372567ff0b4ff4da52889be5d2822b |
22 |
DIST postgresql-11.8.tar.bz2 19922770 BLAKE2B a646b585bbafc95957fa60c7d119c02b69b727759d2189588508f8a690dc97a0ed1429a3379bc6fd48fb22ee92f3d811dedbf8aa43271361f9b7ac2c8d42a31b SHA512 fc3d0ebd224de60bda3fa71b6832958698238e9088cf46a80c376b8996cc3b2d017fde5dce1c1da1e5e6e23b78054aafad7ee1caa744bfb12c52317ccc8a1922 |
23 |
DIST postgresql-12.2.tar.bz2 20363545 BLAKE2B 7b0cfe841d46b117ff5dd793be5537e916f92255eb0d000681ed62c497eef34c5d1261126be408f2b7f95274485e2787869cd4063461ab248b650c168b62548d SHA512 0e0ce8e21856e8f43e58b840c10c4e3ffae6d5207e0d778e9176e36f8e20e34633cbb06f0030a7c963c3491bb7e941456d91b55444c561cfc6f283fba76f33ee |
24 |
DIST postgresql-12.3.tar.bz2 20439892 BLAKE2B f7a44725f235c55a2849acd444de3a9c932314e2ae8c68d7f8e827439263b052bdf0fd5b6cdaa8197c4ce9ad1d4fbb02b5ec1af030365363993a36d8d95a4231 SHA512 68e2d244ae2a9f2138d7569bcadc1cf6f62a410fa56ad1d4ac53206f2adefabb5ae136110b41ca9246df0f8b8cb039918997e0f8a81fc7e6efb7ad10b3a59ba1 |
25 |
+DIST postgresql-13beta1.tar.bz2 21361108 BLAKE2B be5e41d49159ec5932ce958aab3b015b33ce02ef56abf47930754219e220672770785f6eed7966cd57fa9f3fd0d4527f5cb2813a4221443b56d70b7db7178b31 SHA512 8d8c13d7abf2127b0b0c04f080303906e8b0829d390530b308cbfa26e07cd2443a32281ef218a147499de5abe1fde8ab8818f581c68bf550cae1fbd235f46b80 |
26 |
DIST postgresql-9.4.26.tar.bz2 16871195 BLAKE2B f26fd335293669a815a51ceb994b66e154c66f96f91e4c68d7df3490ad25f4b0366ebf7bfe2b209ff34965ea27a08562ace050f40d49cec94eb576d7a1becd1c SHA512 7d379d139c7b2bdac1df38743cbb46a1790a8d5174e8cf1141b7b4febcbc8f612e347bf4d355684eef24dfc73bb2796f85fc532908f26ba7195c685f198cbb72 |
27 |
DIST postgresql-9.5.21.tar.bz2 17640928 BLAKE2B 8ffcf0befc331317a32d63d3cdfe44f7743f72f18b4bc46bee5ee80f8c489b4b1ef26abc8219f277acc922657fc21e3dc31f3fc9838621f44d95cc9405fca43b SHA512 8527356ee3b4f151c832aef50a8b96e923e0a6c77e5fe6ad597f50527f9d084a8feab7bede8fdbe29aab44383577d3f86e5286fb34e2d2b696cde34bd922e69d |
28 |
DIST postgresql-9.5.22.tar.bz2 17667386 BLAKE2B 6fe8ccf638af466e57f239c9d7f1a19bb6c33f6019955824f54f2fe63870675d841811318fb28707cc85ab8a9db550e6655773db0d89d801e26459c9d0d01a43 SHA512 489321fa49e17308d3a78353edf73a16295c1377ad429a94636df069d2bf55f538ba6570e3d2991dd28bcca45fee77c6c41fa9bade35ea7f9e581abff4c9a401 |
29 |
|
30 |
diff --git a/dev-db/postgresql/postgresql-13_beta1.ebuild b/dev-db/postgresql/postgresql-13_beta1.ebuild |
31 |
new file mode 100644 |
32 |
index 00000000000..888813e90a4 |
33 |
--- /dev/null |
34 |
+++ b/dev-db/postgresql/postgresql-13_beta1.ebuild |
35 |
@@ -0,0 +1,458 @@ |
36 |
+# Copyright 1999-2020 Gentoo Authors |
37 |
+# Distributed under the terms of the GNU General Public License v2 |
38 |
+ |
39 |
+EAPI=7 |
40 |
+ |
41 |
+PYTHON_COMPAT=( python3_{6,7} ) |
42 |
+ |
43 |
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd |
44 |
+ |
45 |
+KEYWORDS="" |
46 |
+ |
47 |
+SLOT=$(ver_cut 1) |
48 |
+ |
49 |
+MY_PV=${PV/_/} |
50 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
51 |
+ |
52 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
53 |
+ |
54 |
+LICENSE="POSTGRESQL GPL-2" |
55 |
+DESCRIPTION="PostgreSQL RDBMS" |
56 |
+HOMEPAGE="http://www.postgresql.org/" |
57 |
+ |
58 |
+IUSE="debug doc icu kerberos kernel_linux ldap libressl llvm nls pam |
59 |
+ perl python +readline selinux +server systemd ssl static-libs tcl |
60 |
+ threads uuid xml zlib" |
61 |
+ |
62 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
63 |
+ |
64 |
+CDEPEND=" |
65 |
+>=app-eselect/eselect-postgresql-2.0 |
66 |
+acct-group/postgres |
67 |
+acct-user/postgres |
68 |
+sys-apps/less |
69 |
+virtual/libintl |
70 |
+icu? ( dev-libs/icu:= ) |
71 |
+kerberos? ( virtual/krb5 ) |
72 |
+ldap? ( net-nds/openldap ) |
73 |
+llvm? ( |
74 |
+ sys-devel/llvm:= |
75 |
+ sys-devel/clang:= |
76 |
+) |
77 |
+pam? ( sys-libs/pam ) |
78 |
+perl? ( >=dev-lang/perl-5.8:= ) |
79 |
+python? ( ${PYTHON_DEPS} ) |
80 |
+readline? ( sys-libs/readline:0= ) |
81 |
+server? ( systemd? ( sys-apps/systemd ) ) |
82 |
+ssl? ( |
83 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
84 |
+ libressl? ( dev-libs/libressl:= ) |
85 |
+) |
86 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
87 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
88 |
+zlib? ( sys-libs/zlib ) |
89 |
+" |
90 |
+ |
91 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
92 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
93 |
+# the libc includes UUID functions. |
94 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
95 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
96 |
+ |
97 |
+nest_usedep() { |
98 |
+ local front back |
99 |
+ while [[ ${#} -gt 1 ]]; do |
100 |
+ front+="${1}? ( " |
101 |
+ back+=" )" |
102 |
+ shift |
103 |
+ done |
104 |
+ echo "${front}${1}${back}" |
105 |
+} |
106 |
+ |
107 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
108 |
+CDEPEND+=" |
109 |
+uuid? ( |
110 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
111 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
112 |
+)" |
113 |
+ |
114 |
+DEPEND="${CDEPEND} |
115 |
+sys-devel/bison |
116 |
+sys-devel/flex |
117 |
+nls? ( sys-devel/gettext ) |
118 |
+xml? ( virtual/pkgconfig ) |
119 |
+" |
120 |
+ |
121 |
+RDEPEND="${CDEPEND} |
122 |
+selinux? ( sec-policy/selinux-postgresql ) |
123 |
+" |
124 |
+ |
125 |
+pkg_setup() { |
126 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
127 |
+ |
128 |
+ use python && python-single-r1_pkg_setup |
129 |
+} |
130 |
+ |
131 |
+src_prepare() { |
132 |
+ # Set proper run directory |
133 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
134 |
+ -i src/include/pg_config_manual.h || die |
135 |
+ |
136 |
+ # Rely on $PATH being in the proper order so that the correct |
137 |
+ # install program is used for modules utilizing PGXS in both |
138 |
+ # hardened and non-hardened environments. (Bug #528786) |
139 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
140 |
+ |
141 |
+ use server || eapply "${FILESDIR}/${PN}-12.1-no-server.patch" |
142 |
+ |
143 |
+ if use pam ; then |
144 |
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
145 |
+ -i src/backend/libpq/auth.c || \ |
146 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
147 |
+ fi |
148 |
+ |
149 |
+ eapply_user |
150 |
+} |
151 |
+ |
152 |
+src_configure() { |
153 |
+ case ${CHOST} in |
154 |
+ *-darwin*|*-solaris*) |
155 |
+ use nls && append-libs intl |
156 |
+ ;; |
157 |
+ esac |
158 |
+ |
159 |
+ export LDFLAGS_SL="${LDFLAGS}" |
160 |
+ export LDFLAGS_EX="${LDFLAGS}" |
161 |
+ |
162 |
+ local PO="${EPREFIX}" |
163 |
+ |
164 |
+ local i uuid_config="" |
165 |
+ if use uuid; then |
166 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
167 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
168 |
+ done |
169 |
+ for i in ${BSD_LIBC[@]}; do |
170 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
171 |
+ done |
172 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
173 |
+ fi |
174 |
+ |
175 |
+ econf \ |
176 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
177 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
178 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
179 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
180 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
181 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
182 |
+ $(use_enable !alpha spinlocks) \ |
183 |
+ $(use_enable debug) \ |
184 |
+ $(use_enable threads thread-safety) \ |
185 |
+ $(use_with icu) \ |
186 |
+ $(use_with kerberos gssapi) \ |
187 |
+ $(use_with ldap) \ |
188 |
+ $(use_with llvm) \ |
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) |
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 |
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 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
262 |
+ # needed by extensions utilizing PGXS. |
263 |
+ use static-libs || \ |
264 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
265 |
+ -delete |
266 |
+ |
267 |
+ # Make slot specific links to programs |
268 |
+ local f bn |
269 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
270 |
+ -mindepth 1 -maxdepth 1) |
271 |
+ do |
272 |
+ bn=$(basename "${f}") |
273 |
+ dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
274 |
+ "/usr/bin/${bn}${SLOT/.}" |
275 |
+ done |
276 |
+ |
277 |
+ if use doc ; then |
278 |
+ docinto html |
279 |
+ dodoc doc/src/sgml/html/* |
280 |
+ fi |
281 |
+ |
282 |
+ if use server; then |
283 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
284 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
285 |
+ |
286 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
287 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
288 |
+ |
289 |
+ if use systemd; then |
290 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
291 |
+ "${FILESDIR}/${PN}.service-9.6-r1" | \ |
292 |
+ systemd_newunit - ${PN}-${SLOT}.service |
293 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
294 |
+ systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
295 |
+ fi |
296 |
+ |
297 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
298 |
+ |
299 |
+ if use prefix ; then |
300 |
+ keepdir /run/postgresql |
301 |
+ fperms 1775 /run/postgresql |
302 |
+ fi |
303 |
+ fi |
304 |
+} |
305 |
+ |
306 |
+pkg_postinst() { |
307 |
+ use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
308 |
+ postgresql-config update |
309 |
+ |
310 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
311 |
+ elog " ${EROOT}/etc/postgresql-${SLOT}/" |
312 |
+ |
313 |
+ if use server ; then |
314 |
+ elog |
315 |
+ elog "Gentoo specific documentation:" |
316 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
317 |
+ elog |
318 |
+ elog "Official documentation:" |
319 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
320 |
+ elog |
321 |
+ elog "The default location of the Unix-domain socket is:" |
322 |
+ elog " ${EROOT}/run/postgresql/" |
323 |
+ elog |
324 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
325 |
+ elog "so that it contains your preferred locale in:" |
326 |
+ elog " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
327 |
+ elog |
328 |
+ elog "Then, execute the following command to setup the initial database" |
329 |
+ elog "environment:" |
330 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
331 |
+ |
332 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
333 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
334 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
335 |
+ ewarn "the following command after upgrading:" |
336 |
+ ewarn |
337 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
338 |
+ fi |
339 |
+ fi |
340 |
+} |
341 |
+ |
342 |
+pkg_prerm() { |
343 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
344 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
345 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
346 |
+ |
347 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
348 |
+ sleep 10 |
349 |
+ eend 0 |
350 |
+ fi |
351 |
+} |
352 |
+ |
353 |
+pkg_postrm() { |
354 |
+ postgresql-config update |
355 |
+} |
356 |
+ |
357 |
+pkg_config() { |
358 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
359 |
+ |
360 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
361 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
362 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
363 |
+ [[ -z "${DATA_DIR}" ]] \ |
364 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
365 |
+ |
366 |
+ # environment.bz2 may not contain the same locale as the current system |
367 |
+ # locale. Unset and source from the current system locale. |
368 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
369 |
+ unset LANG |
370 |
+ unset LC_CTYPE |
371 |
+ unset LC_NUMERIC |
372 |
+ unset LC_TIME |
373 |
+ unset LC_COLLATE |
374 |
+ unset LC_MONETARY |
375 |
+ unset LC_MESSAGES |
376 |
+ unset LC_ALL |
377 |
+ source "${EROOT}/etc/env.d/02locale" |
378 |
+ [ -n "${LANG}" ] && export LANG |
379 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
380 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
381 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
382 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
383 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
384 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
385 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
386 |
+ fi |
387 |
+ |
388 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
389 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
390 |
+ einfo |
391 |
+ einfo "Information on options that can be passed to initdb are found at:" |
392 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
393 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
394 |
+ einfo |
395 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
396 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
397 |
+ einfo " (none)" |
398 |
+ else |
399 |
+ einfo " ${PG_INITDB_OPTS}" |
400 |
+ fi |
401 |
+ einfo |
402 |
+ einfo "Configuration files will be installed to:" |
403 |
+ einfo " ${PGDATA}" |
404 |
+ einfo |
405 |
+ einfo "The database cluster will be created in:" |
406 |
+ einfo " ${DATA_DIR}" |
407 |
+ einfo |
408 |
+ |
409 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
410 |
+ sleep 5 |
411 |
+ eend 0 |
412 |
+ |
413 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
414 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
415 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
416 |
+ die "${DATA_DIR} is not empty." |
417 |
+ fi |
418 |
+ |
419 |
+ einfo "Creating the data directory ..." |
420 |
+ if [[ ${EUID} == 0 ]] ; then |
421 |
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs" |
422 |
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR" |
423 |
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown" |
424 |
+ fi |
425 |
+ |
426 |
+ einfo "Initializing the database ..." |
427 |
+ |
428 |
+ if [[ ${EUID} == 0 ]] ; then |
429 |
+ su postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
430 |
+ else |
431 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
432 |
+ fi |
433 |
+ |
434 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
435 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
436 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
437 |
+ fi |
438 |
+ |
439 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
440 |
+ # overridden in the initscript |
441 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
442 |
+ |
443 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
444 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
445 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
446 |
+ # characters in PL/Perl |
447 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
448 |
+ EOF |
449 |
+ |
450 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
451 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
452 |
+ einfo "by default. You can disable it in the cluster's:" |
453 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
454 |
+ einfo |
455 |
+ if ! use systemd; then |
456 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
457 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
458 |
+ einfo |
459 |
+ fi |
460 |
+ if use prefix ; then |
461 |
+ einfo "The location of the configuration files have moved to:" |
462 |
+ einfo " ${PGDATA}" |
463 |
+ einfo "To start the server:" |
464 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
465 |
+ einfo "To stop:" |
466 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
467 |
+ einfo |
468 |
+ einfo "Or move the configuration files back:" |
469 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
470 |
+ elif use systemd; then |
471 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
472 |
+ einfo "instead of 'pg_ctl'." |
473 |
+ else |
474 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
475 |
+ einfo "instead of 'pg_ctl'." |
476 |
+ fi |
477 |
+} |
478 |
+ |
479 |
+src_test() { |
480 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
481 |
+ emake check |
482 |
+ |
483 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
484 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
485 |
+ else |
486 |
+ use server || \ |
487 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
488 |
+ [[ ${UID} -eq 0 ]] || \ |
489 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
490 |
+ |
491 |
+ ewarn 'Skipping.' |
492 |
+ fi |
493 |
+} |