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