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