1 |
commit: 76eaa4306b70f507fbc5bf4ea4fa74f1f3100f93 |
2 |
Author: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu May 19 16:22:01 2022 +0000 |
4 |
Commit: 罗百科 <patrick <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu May 19 16:22:11 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76eaa430 |
7 |
|
8 |
dev-db/postgresql: Add 15_beta1 unkeyworded |
9 |
|
10 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
11 |
Signed-off-by: Patrick Lauer <patrick <AT> gentoo.org> |
12 |
|
13 |
dev-db/postgresql/Manifest | 1 + |
14 |
dev-db/postgresql/postgresql-15_beta1.ebuild | 462 +++++++++++++++++++++++++++ |
15 |
2 files changed, 463 insertions(+) |
16 |
|
17 |
diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest |
18 |
index 866ae18c66f8..b82618fdf883 100644 |
19 |
--- a/dev-db/postgresql/Manifest |
20 |
+++ b/dev-db/postgresql/Manifest |
21 |
@@ -13,4 +13,5 @@ DIST postgresql-13.7.tar.bz2 21364433 BLAKE2B 2d8a505f6de4eb31cae415529eeac750a6 |
22 |
DIST postgresql-14.1.tar.bz2 21887101 BLAKE2B a496dfd513c52339d1b3cb72773f9611721fd7c5d2a702d6fd71f650a1d41c3d7bf6574eba23671c7f9f11718e007f51f9547949bdc3d7fe1ea2248ebfb8d70b SHA512 4a0bec157d5464bb9e5f5c0eb0efdede55526e03f6f4d660b87d161a47705eb152fa0878960b1581bce42a5ed28a1f457825ea54e8d22e34b5b8eb36473ceefd |
23 |
DIST postgresql-14.2.tar.bz2 21964841 BLAKE2B 6460533a40064404f18642147b949cf7c85d036c45ede478fb9af8919895ee7b09dc78b89ed08a292226911f07cfc9e46d7f2d42e0aaea546c5e97a291d599b9 SHA512 19aeb6528605dbcf5df84048b2eed8f54b202576134d3fe3900bb8f073179c4258d2581acd745887e7e6fa86ebdb5f7b159ffaa0a645d601efee7c5f7730456b |
24 |
DIST postgresql-14.3.tar.bz2 22092190 BLAKE2B 8c9124cb758618d770a1084553f9e8f9a3fcb4e17e1aa4a1649e04f4c057f33ce1e5890bba3288bed2257236a4569735a77b3e5ddf989c2a2a4ef60ed494b3cc SHA512 70e6f67b5729a23f80b92b04e3fad2e09596b939660e3ddebf499d06af946459a45a019279e05413673e7b65d09a28a0440ed3c2ae565068466ed37e2d4f6f17 |
25 |
+DIST postgresql-15beta1.tar.bz2 23518203 BLAKE2B 54398d2f6972e7640cbb1211b86c642b205b33ca879d6db7a93ef8a39e294e69a7d8bb0bc7ec5df3455e5a01a5aac63815506ad55b78bf5698d2a77e943031bf SHA512 ced71f4dca02803788890c71a192b0516a41b5bc5b8113623e52183eb143905185affa93b5399b27113e112b9669dbca20cb5783f96e31ff1f5ccd2f8ddc55d3 |
26 |
DIST postgresql-9.6.24.tar.bz2 19047518 BLAKE2B 63b53cfb2c9381fe09ed76ef3cad1ec5014bcd3b4dea388cda5b4ad8b8084abc15a38dcd62e0c3fe0bcc922749e7a4bef4ec39287c4b1ea952b8245bbc72bc2e SHA512 c17ef8e7149bd136f6058e20b28f9a7307625614e37ff837feb7a6fa37b6932dfab6379285120c9bb0198961eb446c9979d5ee1f3e8583b09f981f52bee33505 |
27 |
|
28 |
diff --git a/dev-db/postgresql/postgresql-15_beta1.ebuild b/dev-db/postgresql/postgresql-15_beta1.ebuild |
29 |
new file mode 100644 |
30 |
index 000000000000..2d34467c1c25 |
31 |
--- /dev/null |
32 |
+++ b/dev-db/postgresql/postgresql-15_beta1.ebuild |
33 |
@@ -0,0 +1,462 @@ |
34 |
+# Copyright 1999-2022 Gentoo Authors |
35 |
+# Distributed under the terms of the GNU General Public License v2 |
36 |
+ |
37 |
+EAPI=7 |
38 |
+ |
39 |
+PYTHON_COMPAT=( python3_{8,9,10} ) |
40 |
+ |
41 |
+inherit flag-o-matic linux-info multilib pam prefix python-single-r1 systemd tmpfiles |
42 |
+ |
43 |
+KEYWORDS="" |
44 |
+ |
45 |
+SLOT=$(ver_cut 1) |
46 |
+ |
47 |
+MY_PV=${PV/_/} |
48 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
49 |
+ |
50 |
+SRC_URI="https://ftp.postgresql.org/pub/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
51 |
+ |
52 |
+LICENSE="POSTGRESQL GPL-2" |
53 |
+DESCRIPTION="PostgreSQL RDBMS" |
54 |
+HOMEPAGE="https://www.postgresql.org/" |
55 |
+ |
56 |
+IUSE="debug doc icu kerberos ldap llvm lz4 nls pam |
57 |
+ perl python +readline selinux +server systemd ssl static-libs tcl |
58 |
+ threads uuid xml zlib" |
59 |
+ |
60 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
61 |
+ |
62 |
+CDEPEND=" |
63 |
+>=app-eselect/eselect-postgresql-2.0 |
64 |
+acct-group/postgres |
65 |
+acct-user/postgres |
66 |
+sys-apps/less |
67 |
+virtual/libintl |
68 |
+icu? ( dev-libs/icu:= ) |
69 |
+kerberos? ( virtual/krb5 ) |
70 |
+ldap? ( net-nds/openldap:= ) |
71 |
+llvm? ( |
72 |
+ sys-devel/llvm:= |
73 |
+ sys-devel/clang:= |
74 |
+) |
75 |
+lz4? ( app-arch/lz4 ) |
76 |
+pam? ( sys-libs/pam ) |
77 |
+perl? ( >=dev-lang/perl-5.8:= ) |
78 |
+python? ( ${PYTHON_DEPS} ) |
79 |
+readline? ( sys-libs/readline:0= ) |
80 |
+server? ( systemd? ( sys-apps/systemd ) ) |
81 |
+ssl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
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,musl} ) |
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 |
+CDEPEND+=" |
103 |
+uuid? ( |
104 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
105 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} dev-libs/ossp-uuid) |
106 |
+)" |
107 |
+ |
108 |
+DEPEND="${CDEPEND} |
109 |
+sys-devel/bison |
110 |
+sys-devel/flex |
111 |
+nls? ( sys-devel/gettext ) |
112 |
+xml? ( virtual/pkgconfig ) |
113 |
+" |
114 |
+ |
115 |
+RDEPEND="${CDEPEND} |
116 |
+selinux? ( sec-policy/selinux-postgresql ) |
117 |
+" |
118 |
+ |
119 |
+pkg_setup() { |
120 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
121 |
+ |
122 |
+ use python && python-single-r1_pkg_setup |
123 |
+} |
124 |
+ |
125 |
+src_prepare() { |
126 |
+ # Set proper run directory |
127 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
128 |
+ -i src/include/pg_config_manual.h || die |
129 |
+ |
130 |
+ # Rely on $PATH being in the proper order so that the correct |
131 |
+ # install program is used for modules utilizing PGXS in both |
132 |
+ # hardened and non-hardened environments. (Bug #528786) |
133 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
134 |
+ |
135 |
+ use server || eapply "${FILESDIR}/${PN}-14_rc1-no-server.patch" |
136 |
+ |
137 |
+ if use pam ; then |
138 |
+ sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
139 |
+ -i src/backend/libpq/auth.c || \ |
140 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
141 |
+ fi |
142 |
+ |
143 |
+ eapply_user |
144 |
+} |
145 |
+ |
146 |
+src_configure() { |
147 |
+ case ${CHOST} in |
148 |
+ *-darwin*|*-solaris*) |
149 |
+ use nls && append-libs intl |
150 |
+ ;; |
151 |
+ esac |
152 |
+ |
153 |
+ export LDFLAGS_SL="${LDFLAGS}" |
154 |
+ export LDFLAGS_EX="${LDFLAGS}" |
155 |
+ |
156 |
+ local PO="${EPREFIX}" |
157 |
+ |
158 |
+ local i uuid_config="" |
159 |
+ if use uuid; then |
160 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
161 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
162 |
+ done |
163 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
164 |
+ fi |
165 |
+ |
166 |
+ local myconf="\ |
167 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
168 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
169 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
170 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
171 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
172 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
173 |
+ $(use_enable debug) \ |
174 |
+ $(use_enable threads thread-safety) \ |
175 |
+ $(use_with icu) \ |
176 |
+ $(use_with kerberos gssapi) \ |
177 |
+ $(use_with ldap) \ |
178 |
+ $(use_with llvm) \ |
179 |
+ $(use_with lz4) \ |
180 |
+ $(use_with pam) \ |
181 |
+ $(use_with perl) \ |
182 |
+ $(use_with python) \ |
183 |
+ $(use_with readline) \ |
184 |
+ $(use_with ssl openssl) \ |
185 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
186 |
+ $(use_with tcl) \ |
187 |
+ ${uuid_config} \ |
188 |
+ $(use_with xml libxml) \ |
189 |
+ $(use_with xml libxslt) \ |
190 |
+ $(use_with zlib) \ |
191 |
+ $(use_enable nls)" |
192 |
+ if use alpha; then |
193 |
+ myconf+=" --disable-spinlocks" |
194 |
+ else |
195 |
+ # Should be the default but just in case |
196 |
+ myconf+=" --enable-spinlocks" |
197 |
+ fi |
198 |
+ econf ${myconf} |
199 |
+} |
200 |
+ |
201 |
+src_compile() { |
202 |
+ emake |
203 |
+ emake -C contrib |
204 |
+} |
205 |
+ |
206 |
+src_install() { |
207 |
+ emake DESTDIR="${D}" install |
208 |
+ emake DESTDIR="${D}" install -C contrib |
209 |
+ |
210 |
+ dodoc README HISTORY |
211 |
+ |
212 |
+ # man pages are already built, but if we have the target make them, |
213 |
+ # they'll be generated from source before being installed so we |
214 |
+ # manually install man pages. |
215 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
216 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
217 |
+ doins -r doc/src/sgml/man{1,3,7} |
218 |
+ if ! use server; then |
219 |
+ # Remove man pages for non-existent binaries |
220 |
+ serverman=( |
221 |
+ initdb |
222 |
+ pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
223 |
+ pg_{test_{fsync,timing},upgrade,waldump} |
224 |
+ post{gres,master} |
225 |
+ ) |
226 |
+ for m in ${serverman[@]} ; do |
227 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
228 |
+ done |
229 |
+ fi |
230 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
231 |
+ |
232 |
+ # Create slot specific man pages |
233 |
+ local bn f mansec slotted_name |
234 |
+ for mansec in 1 3 7 ; do |
235 |
+ local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
236 |
+ |
237 |
+ mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
238 |
+ pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
239 |
+ |
240 |
+ for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
241 |
+ bn=$(basename "${f}") |
242 |
+ slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
243 |
+ case ${bn} in |
244 |
+ TABLE.7|WITH.7) |
245 |
+ echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
246 |
+ ;; |
247 |
+ *) |
248 |
+ echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
249 |
+ ;; |
250 |
+ esac |
251 |
+ done |
252 |
+ |
253 |
+ popd > /dev/null |
254 |
+ done |
255 |
+ |
256 |
+ insinto /etc/postgresql-${SLOT} |
257 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
258 |
+ |
259 |
+ # Don't delete libpg{port,common}.a (Bug #571046). They're always |
260 |
+ # needed by extensions utilizing PGXS. |
261 |
+ use static-libs || \ |
262 |
+ find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
263 |
+ -delete |
264 |
+ |
265 |
+ # Make slot specific links to programs |
266 |
+ local f bn |
267 |
+ for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
268 |
+ -mindepth 1 -maxdepth 1) |
269 |
+ do |
270 |
+ bn=$(basename "${f}") |
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 |
+ newtmpfiles "${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 && tmpfiles_process ${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 "https://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 |
+ |
330 |
+ if [[ -n ${REPLACING_VERSIONS} ]] ; then |
331 |
+ ewarn "If your system is using 'pg_stat_statements' and you are running a" |
332 |
+ ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
333 |
+ ewarn "the following command after upgrading:" |
334 |
+ ewarn |
335 |
+ ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
336 |
+ fi |
337 |
+ fi |
338 |
+} |
339 |
+ |
340 |
+pkg_prerm() { |
341 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
342 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
343 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
344 |
+ |
345 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
346 |
+ sleep 10 |
347 |
+ eend 0 |
348 |
+ fi |
349 |
+} |
350 |
+ |
351 |
+pkg_postrm() { |
352 |
+ postgresql-config update |
353 |
+} |
354 |
+ |
355 |
+pkg_config() { |
356 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
357 |
+ |
358 |
+ [[ -f "${EROOT}/etc/conf.d/postgresql-${SLOT}" ]] \ |
359 |
+ && source "${EROOT}/etc/conf.d/postgresql-${SLOT}" |
360 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT}/etc/postgresql-${SLOT}/" |
361 |
+ [[ -z "${DATA_DIR}" ]] \ |
362 |
+ && DATA_DIR="${EROOT}/var/lib/postgresql/${SLOT}/data" |
363 |
+ |
364 |
+ # environment.bz2 may not contain the same locale as the current system |
365 |
+ # locale. Unset and source from the current system locale. |
366 |
+ if [ -f "${EROOT}/etc/env.d/02locale" ]; then |
367 |
+ unset LANG |
368 |
+ unset LC_CTYPE |
369 |
+ unset LC_NUMERIC |
370 |
+ unset LC_TIME |
371 |
+ unset LC_COLLATE |
372 |
+ unset LC_MONETARY |
373 |
+ unset LC_MESSAGES |
374 |
+ unset LC_ALL |
375 |
+ source "${EROOT}/etc/env.d/02locale" |
376 |
+ [ -n "${LANG}" ] && export LANG |
377 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
378 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
379 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
380 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
381 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
382 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
383 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
384 |
+ fi |
385 |
+ |
386 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
387 |
+ einfo " ${EROOT}/etc/conf.d/postgresql-${SLOT}" |
388 |
+ einfo |
389 |
+ einfo "Information on options that can be passed to initdb are found at:" |
390 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
391 |
+ einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
392 |
+ einfo |
393 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
394 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
395 |
+ einfo " (none)" |
396 |
+ else |
397 |
+ einfo " ${PG_INITDB_OPTS}" |
398 |
+ fi |
399 |
+ einfo |
400 |
+ einfo "Configuration files will be installed to:" |
401 |
+ einfo " ${PGDATA}" |
402 |
+ einfo |
403 |
+ einfo "The database cluster will be created in:" |
404 |
+ einfo " ${DATA_DIR}" |
405 |
+ einfo |
406 |
+ |
407 |
+ ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
408 |
+ sleep 5 |
409 |
+ eend 0 |
410 |
+ |
411 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
412 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
413 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
414 |
+ die "${DATA_DIR} is not empty." |
415 |
+ fi |
416 |
+ |
417 |
+ einfo "Creating the data directory ..." |
418 |
+ if [[ ${EUID} == 0 ]] ; then |
419 |
+ mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs" |
420 |
+ mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR" |
421 |
+ chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown" |
422 |
+ fi |
423 |
+ |
424 |
+ einfo "Initializing the database ..." |
425 |
+ |
426 |
+ if [[ ${EUID} == 0 ]] ; then |
427 |
+ su - postgres -c "${EROOT}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
428 |
+ else |
429 |
+ "${EROOT}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
430 |
+ fi |
431 |
+ |
432 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
433 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
434 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
435 |
+ fi |
436 |
+ |
437 |
+ # unix_socket_directory has no effect in postgresql.conf as it's |
438 |
+ # overridden in the initscript |
439 |
+ sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
440 |
+ |
441 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
442 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
443 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
444 |
+ # characters in PL/Perl |
445 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
446 |
+ EOF |
447 |
+ |
448 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
449 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
450 |
+ einfo "by default. You can disable it in the cluster's:" |
451 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
452 |
+ einfo |
453 |
+ if ! use systemd; then |
454 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
455 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
456 |
+ einfo |
457 |
+ fi |
458 |
+ if use prefix ; then |
459 |
+ einfo "The location of the configuration files have moved to:" |
460 |
+ einfo " ${PGDATA}" |
461 |
+ einfo "To start the server:" |
462 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
463 |
+ einfo "To stop:" |
464 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
465 |
+ einfo |
466 |
+ einfo "Or move the configuration files back:" |
467 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
468 |
+ elif use systemd; then |
469 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
470 |
+ einfo "instead of 'pg_ctl'." |
471 |
+ else |
472 |
+ einfo "You should use the '${EROOT}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
473 |
+ einfo "instead of 'pg_ctl'." |
474 |
+ fi |
475 |
+} |
476 |
+ |
477 |
+src_test() { |
478 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
479 |
+ # Some ICU tests fail if LC_CTYPE and LC_COLLATE aren't the same. We set |
480 |
+ # LC_CTYPE to be equal to LC_COLLATE since LC_COLLATE is set by Portage. |
481 |
+ local old_ctype=${LC_CTYPE} |
482 |
+ export LC_CTYPE=${LC_COLLATE} |
483 |
+ emake check |
484 |
+ export LC_CTYPE=${old_ctype} |
485 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
486 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
487 |
+ else |
488 |
+ use server || \ |
489 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
490 |
+ [[ ${UID} -eq 0 ]] || \ |
491 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
492 |
+ |
493 |
+ ewarn 'Skipping.' |
494 |
+ fi |
495 |
+} |