Gentoo Archives: gentoo-commits

From: Aaron Swenson <titanofold@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-db/postgresql/
Date: Fri, 21 Sep 2018 16:28:49
Message-Id: 1537547250.b5e36758fa019653c390058097c6b09bf54158bc.titanofold@gentoo
1 commit: b5e36758fa019653c390058097c6b09bf54158bc
2 Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org>
3 AuthorDate: Fri Sep 21 16:14:07 2018 +0000
4 Commit: Aaron Swenson <titanofold <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 21 16:27:30 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b5e36758
7
8 dev-db/postgresql: Cleanup old and insecure
9
10 Bug: https://bugs.gentoo.org/664332
11 Package-Manager: Portage-2.3.40, Repoman-2.3.9
12
13 dev-db/postgresql/Manifest | 11 -
14 dev-db/postgresql/postgresql-10.3.ebuild | 460 -------------------------
15 dev-db/postgresql/postgresql-10.4.ebuild | 460 -------------------------
16 dev-db/postgresql/postgresql-11_beta1.ebuild | 449 ------------------------
17 dev-db/postgresql/postgresql-9.3.22.ebuild | 450 ------------------------
18 dev-db/postgresql/postgresql-9.3.23.ebuild | 450 ------------------------
19 dev-db/postgresql/postgresql-9.4.17.ebuild | 482 --------------------------
20 dev-db/postgresql/postgresql-9.4.18.ebuild | 482 --------------------------
21 dev-db/postgresql/postgresql-9.5.12.ebuild | 488 --------------------------
22 dev-db/postgresql/postgresql-9.5.13.ebuild | 488 --------------------------
23 dev-db/postgresql/postgresql-9.6.8.ebuild | 493 ---------------------------
24 dev-db/postgresql/postgresql-9.6.9.ebuild | 493 ---------------------------
25 12 files changed, 5206 deletions(-)
26
27 diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest
28 index fa5d2dd8407..3546b8514d0 100644
29 --- a/dev-db/postgresql/Manifest
30 +++ b/dev-db/postgresql/Manifest
31 @@ -1,18 +1,7 @@
32 -DIST postgresql-10.3.tar.bz2 19959653 BLAKE2B ba3b05f53b0f879b18d6d0649bf819697c77a066b49d941a96d13a4741854b01aeb0c8b868d6550a08ad52572c9463c968660aa83c16cbaa5b4bf7a89387a524 SHA512 05cf82d3483bdf38734e6ff0fef6b80e7f8fd3cb5ea6792ffe222a599d97d1a29638970bf28ebf5bd1f877e8dcd9986d88f5c5e5379e74fe79ce83e20d2babba
33 -DIST postgresql-10.4.tar.bz2 20201838 BLAKE2B 6d1cdc44547740c8f9fbc2e989364640409c6d2a365568b75731277dd0fba473ce07e2ee27e8ebfad507a6ce0ab3d3a44156c0e3a069d96d320771d8a97ba82f SHA512 b7c0d2fdc724e2eb1cda9fc1eb01b47352bbe6ba6357b3e898b7f5990fd78499c8c68dcb3aa9bde7821d71b5882d8856131384e899f8055d89d51cdfdbc9e663
34 DIST postgresql-10.5.tar.bz2 20284578 BLAKE2B af2bc5bdc7e69682dac38785ce4a10c2c5c04202f2c3cd4acbb9200dbae7eec75d83813ac4df84b5a8064e77167f22a4dd54c6e84a68e564642cb5d75effd0ac SHA512 1bad30ae88beca66f7e8b99b82e7f02aac1e9230b328e6e5a762a704cdd9dc767d924f5a66c68c93586badfef91b7ff336120a567ce970eaa58bb44c662ad48c
35 -DIST postgresql-11beta1.tar.bz2 20945387 BLAKE2B a99aff17a656da2250309f2652237c8df3a3aeed088250be6114964c103dec40d0c4cc60b048b2ffa1e9733aed8e9df2597d57cab58482512c42f25139dc3499 SHA512 fa4e9cf8293fecf384d98d3a5bbed208eda2e4dd8bf05a9922a74355daba74dde4dbe0cd42bea1de155f4fea3cdcd0d7621d7e315c1d5f49ce5ee794b01b9f6d
36 DIST postgresql-11beta2.tar.bz2 21086270 BLAKE2B ecea671334cc8dcc59ef46e1e9dfc16c1f0c44623d5355a42ef07797c6794109f10532fb6bfd6b4165e92a83d42514547e402cbe1a3618a6e6894432b3e2945d SHA512 3f9120af5f39d10937d92344c45e19f6d4de097dc24a081cd1984b27df4ecb8b0c15c638c8b1f8830b0003f01808159bd91305f9744eb6ae6c3425b3bf677937
37 DIST postgresql-11beta3.tar.bz2 21375988 BLAKE2B cd83fcfc55504a028bf42f2c31de4d9e12ead1ad0f238a1f36397b9405ddf8f6d371062a25e2660f8c6754447a09ddc3a122f178101b8ab80237b16422c8cf4c SHA512 6ac6ecf2fff014b3673b11f6f106fdc93e6692a4a67a4669c4a7557f2b3229e41ddf5365c1e9328d88b6fde9141c15bd1a4640356559e727ee7f9f11641d4bf6
38 -DIST postgresql-9.3.22.tar.bz2 17022938 BLAKE2B 198705e438717d0d9e12c73e0c0e3eff0ba89ea50a1b183de70f065e13c153c164890fe56bc6ec13b0cb9617df4f66894c122eeddaf9303b9a02b8e08b19b085 SHA512 667ff496172626d2fe35c6795935fb07f4f7967a3b0631dd3b96278f8dc00b3d08794f091a5ab060a45d6f2a861e0f10f0e9660f9e343ab34eeabd693104c47f
39 -DIST postgresql-9.3.23.tar.bz2 17033683 BLAKE2B f02ad25f6b8755a9a57c3a6dcb63b78672e29473b061ad1616be2fb97fbfd83fe0dc9fc9fda66ac0231fb30fb13f9ef8975ba5a9701d83f33495bcf2c2651b4a SHA512 bb2d54312de728aa0379ea5bc6385036bbe69d3b7f85bbd78c210840eed19ace29840849caf38d0689e21130a0c94818a362b3927805d8eded53b68e240a52b0
40 DIST postgresql-9.3.24.tar.bz2 17042985 BLAKE2B 976debbc2a072cc307e22beac1d59352ecc214b9879284e635f30295d1f46ad2e0542ffc5f62639527be870afe46ea5daf5b8b2d3da9a069adf1701218def968 SHA512 3d457b6218eeb8da2d8dd134dabc7ec8000cad5863870079b85ce00d94218fa049146290a8389fec15e57d586b0edee9810cdad85f36cbabce49b6b4378ce1ee
41 -DIST postgresql-9.4.17.tar.bz2 17807762 BLAKE2B 7640c29a71c6aeff47d9b43dd1e4f52edac4295b646b34da3a0ed9c26a8a826061bfd892e9907b62f31b7f01ee3aaf437c88d79b84d1d786d608dcd088309ecf SHA512 9ac03d460e521dcd142ac463dd5bb0f3e3f47333367bf8d61499ec7e8d0129d338c6f111667d0006df0c8ced9ae8a337d4c1b40eb5f55e6bc8dd5a24dfd376f0
42 -DIST postgresql-9.4.18.tar.bz2 17828085 BLAKE2B 346584e7d74264a7d58b3793cfd6247ae3cad3bb946bedec8df8d97278ffe6f8e881d31ad50e9f5d622aa4ae9b9711b36258bb60d520bb9a1d458af63c343e9e SHA512 2e64c3130c3dfc5183a77d72f61714bea34bfe549f55720eee25046e00b913a7effec3d7e43a021766ac957c1fa3c8c5e6c26ccbd8be1b434ae618e1fe9daab6
43 DIST postgresql-9.4.19.tar.bz2 17879273 BLAKE2B 775a8748218c40440df91307107d46a35bcb3b2baf1c383014684c15d06c0026548770f88dccb1c26c3247813761e4a43003c50fe930041afc5701cddabfbde3 SHA512 38e2f1f25bd80fdfdec728cd4a3fee6696ca051e496f0629a0a554ea013bfb9bb83ef5659b00130666462a45036a648cf880a2f49693a8ef2edbde938e4dd830
44 -DIST postgresql-9.5.12.tar.bz2 18589538 BLAKE2B 4246eb2bf5fe2e3bb48bdc411ebd3c87015570f0be4d8b1ed2a0f2ed20a8374e3244fa0aa17f9145f4f951c88f5b0717a4dd2186bf1621ce3334789f5f8dd50f SHA512 ab81bc95fd587f76a1986db5616b63d861b84da0eb9e54478f5298248a81d7a608d1bb1a9e30662c8190d05630106ddb3bb6413c34b003de948417214d342654
45 -DIST postgresql-9.5.13.tar.bz2 18600185 BLAKE2B 7560f08648ec1417d304aa8c53c3220d7a4b2fdaf2cb4920a0196273466d1dbab4c12dbceb3dc9a136458c0089dd5f5dc595c95353584d49da0d2ab6e7903bba SHA512 807b22aabee38326934213de04b782a6b22cd8fe5c5bfd8b6cfa44281924527a715dcd78adbee276746446a7b05036b4714b00a16c650027543dcbafe1888082
46 DIST postgresql-9.5.14.tar.bz2 18687959 BLAKE2B ac377b5e279d9e8179a94eb91d0cf1a7e3f6443c860d68a4540357d80128fbc54ac1ffec198725b2a783a80448f8a625556f2e6018162304d65659982890d46f SHA512 9b5ebc8dc13bbdbd5b5bc02552e2b9b5029d899a80e82b653542c735868590ebe57d586951bf036c5abd28aae325c71cc69536f88321d50dd3d254f8ee0cfe35
47 DIST postgresql-9.6.10.tar.bz2 19991204 BLAKE2B 3d99296b5045a0b56b89257b2aa3f0c8be1108428acd77469b8db94200ad6b0b8d2fa84c73f652f79db56620c46928524d2f3a1a265ac332eb36c0625b800f76 SHA512 960a32c86466f9d5f5491ef163f5c4a99cb5de7312d13371e2223b1d156e31eb2a23ed478e6654bcbb7bd19db9470aaf63473ff661c11c60971b92af5e9daf82
48 -DIST postgresql-9.6.8.tar.bz2 19528927 BLAKE2B 6aab5dbe4b13e1624befc33c2fa5241804dff71879e2d60c166db19c2fe015cd19cfc35054e6aede82bfe6b83a7146b6d2eedaabb94111c163da732526ff1723 SHA512 6b7595c0046308c725d77360b156e979d6bc469b78ac6500f631112f19b2607ca2d816781f8c5fd3bd835c48e079e79ada7af687fbd306a8fec5e160f20dd211
49 -DIST postgresql-9.6.9.tar.bz2 19566222 BLAKE2B e92a5ffaa8f4400364a174fc21ab11bb18c96dce9be721e6073ff7ad21b828859c2ac5fe8da81cad6a3d2a63a62d8fcb067d4bb02a9d23903525ad1f78955470 SHA512 3ce2a8f3a017d9c0bd0f1b475a9ee02bcb6a4119b0d436757911f444f49f5024bb1a1be07ce16a79e71af77799de1bf952b32279b4566bae075f23a50b8545c6
50
51 diff --git a/dev-db/postgresql/postgresql-10.3.ebuild b/dev-db/postgresql/postgresql-10.3.ebuild
52 deleted file mode 100644
53 index 7170883aee5..00000000000
54 --- a/dev-db/postgresql/postgresql-10.3.ebuild
55 +++ /dev/null
56 @@ -1,460 +0,0 @@
57 -# Copyright 1999-2018 Gentoo Foundation
58 -# Distributed under the terms of the GNU General Public License v2
59 -
60 -EAPI="6"
61 -
62 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
63 -
64 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
65 - systemd user versionator
66 -
67 -KEYWORDS="alpha amd64 arm ~arm64 ~hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
68 -
69 -SLOT=$(get_major_version)
70 -
71 -MY_PV=${PV/_/}
72 -S="${WORKDIR}/${PN}-${MY_PV}"
73 -
74 -SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
75 -
76 -LICENSE="POSTGRESQL GPL-2"
77 -DESCRIPTION="PostgreSQL RDBMS"
78 -HOMEPAGE="https://www.postgresql.org/"
79 -
80 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl python +readline
81 - selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
82 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
83 -
84 -wanted_languages() {
85 - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru
86 - sk sl sv tr zh_CN zh_TW"
87 - local enable_langs lingua
88 -
89 - for lingua in ${linguas} ; do
90 - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
91 - done
92 -
93 - echo -n ${enable_langs}
94 -}
95 -
96 -CDEPEND="
97 ->=app-eselect/eselect-postgresql-2.0
98 -sys-apps/less
99 -virtual/libintl
100 -kerberos? ( virtual/krb5 )
101 -ldap? ( net-nds/openldap )
102 -pam? ( virtual/pam )
103 -perl? ( >=dev-lang/perl-5.8:= )
104 -python? ( ${PYTHON_DEPS} )
105 -readline? ( sys-libs/readline:0= )
106 -server? ( systemd? ( sys-apps/systemd ) )
107 -ssl? (
108 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
109 - libressl? ( dev-libs/libressl:= )
110 -)
111 -tcl? ( >=dev-lang/tcl-8:0= )
112 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
113 -zlib? ( sys-libs/zlib )
114 -"
115 -
116 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
117 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
118 -# the libc includes UUID functions.
119 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
120 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
121 -
122 -nest_usedep() {
123 - local front back
124 - while [[ ${#} -gt 1 ]]; do
125 - front+="${1}? ( "
126 - back+=" )"
127 - shift
128 - done
129 - echo "${front}${1}${back}"
130 -}
131 -
132 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
133 -CDEPEND+="
134 -uuid? (
135 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
136 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
137 -)"
138 -
139 -DEPEND="${CDEPEND}
140 -!!<sys-apps/sandbox-2.0
141 -sys-devel/bison
142 -sys-devel/flex
143 -nls? ( sys-devel/gettext )
144 -xml? ( virtual/pkgconfig )
145 -"
146 -
147 -RDEPEND="${CDEPEND}
148 -!dev-db/postgresql-docs:${SLOT}
149 -!dev-db/postgresql-base:${SLOT}
150 -!dev-db/postgresql-server:${SLOT}
151 -selinux? ( sec-policy/selinux-postgresql )
152 -"
153 -
154 -pkg_setup() {
155 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
156 -
157 - enewgroup postgres 70
158 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
159 -
160 - use python && python-single-r1_pkg_setup
161 -}
162 -
163 -src_prepare() {
164 - # Work around PPC{,64} compilation bug where bool is already defined
165 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
166 -
167 - # Set proper run directory
168 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
169 - -i src/include/pg_config_manual.h || die
170 -
171 - # Rely on $PATH being in the proper order so that the correct
172 - # install program is used for modules utilizing PGXS in both
173 - # hardened and non-hardened environments. (Bug #528786)
174 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
175 -
176 - use server || eapply "${FILESDIR}/${PN}-10.2-no-server.patch"
177 -
178 - if use pam ; then
179 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
180 - -i src/backend/libpq/auth.c || \
181 - die 'PGSQL_PAM_SERVICE rename failed.'
182 - fi
183 -
184 - eapply_user
185 -}
186 -
187 -src_configure() {
188 - case ${CHOST} in
189 - *-darwin*|*-solaris*)
190 - use nls && append-libs intl
191 - ;;
192 - esac
193 -
194 - export LDFLAGS_SL="${LDFLAGS}"
195 - export LDFLAGS_EX="${LDFLAGS}"
196 -
197 - local PO="${EPREFIX%/}"
198 -
199 - local i uuid_config=""
200 - if use uuid; then
201 - for i in ${UTIL_LINUX_LIBC[@]}; do
202 - use ${i} && uuid_config="--with-uuid=e2fs"
203 - done
204 - for i in ${BSD_LIBC[@]}; do
205 - use ${i} && uuid_config="--with-uuid=bsd"
206 - done
207 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
208 - fi
209 -
210 - econf \
211 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
212 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
213 - --docdir="${PO}/usr/share/doc/${PF}" \
214 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
215 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
216 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
217 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
218 - $(use_enable !alpha spinlocks) \
219 - $(use_enable threads thread-safety) \
220 - $(use_with kerberos gssapi) \
221 - $(use_with ldap) \
222 - $(use_with pam) \
223 - $(use_with perl) \
224 - $(use_with python) \
225 - $(use_with readline) \
226 - $(use_with ssl openssl) \
227 - $(usex server "$(use_with systemd)" '--without-systemd') \
228 - $(use_with tcl) \
229 - ${uuid_config} \
230 - $(use_with xml libxml) \
231 - $(use_with xml libxslt) \
232 - $(use_with zlib) \
233 - "$(use_enable nls nls "$(wanted_languages)")"
234 -}
235 -
236 -src_compile() {
237 - emake
238 - emake -C contrib
239 -}
240 -
241 -src_install() {
242 - emake DESTDIR="${D}" install
243 - emake DESTDIR="${D}" install -C contrib
244 -
245 - dodoc README HISTORY doc/{TODO,bug.template}
246 -
247 - # man pages are already built, but if we have the target make them,
248 - # they'll be generated from source before being installed so we
249 - # manually install man pages.
250 - # We use ${SLOT} instead of doman for postgresql.eselect
251 - insinto /usr/share/postgresql-${SLOT}/man/
252 - doins -r doc/src/sgml/man{1,3,7}
253 - if ! use server; then
254 - # Remove man pages for non-existent binaries
255 - serverman=(
256 - initdb
257 - pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby}
258 - pg_{test_{fsync,timing},upgrade,waldump}
259 - post{gres,master}
260 - )
261 - for m in ${serverman[@]} ; do
262 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
263 - done
264 - fi
265 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
266 -
267 - # Create slot specific man pages
268 - local bn f mansec slotted_name
269 - for mansec in 1 3 7 ; do
270 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
271 -
272 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
273 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
274 -
275 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
276 - bn=$(basename "${f}")
277 - slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
278 - case ${bn} in
279 - TABLE.7|WITH.7)
280 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
281 - ;;
282 - *)
283 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
284 - ;;
285 - esac
286 - done
287 -
288 - popd > /dev/null
289 - done
290 -
291 - insinto /etc/postgresql-${SLOT}
292 - newins src/bin/psql/psqlrc.sample psqlrc
293 -
294 - use static-libs || find "${ED}" -name '*.a' -delete
295 -
296 - local f bn
297 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
298 - -mindepth 1 -maxdepth 1)
299 - do
300 - bn=$(basename "${f}")
301 - # Temporarily tack on tmp to workaround a file collision
302 - # issue. This is only necessary for 9.7 and earlier. 10 never
303 - # had this issue.
304 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
305 - "/usr/bin/${bn}${SLOT/.}"
306 - done
307 -
308 - if use doc ; then
309 - docinto html
310 - dodoc doc/src/sgml/html/*
311 - fi
312 -
313 - if use server; then
314 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
315 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
316 -
317 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
318 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
319 -
320 - if use systemd; then
321 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
322 - "${FILESDIR}/${PN}.service-9.6-r1" | \
323 - systemd_newunit - ${PN}-${SLOT}.service
324 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
325 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
326 - fi
327 -
328 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
329 -
330 - if use prefix ; then
331 - keepdir /run/postgresql
332 - fperms 1775 /run/postgresql
333 - fi
334 - fi
335 -}
336 -
337 -pkg_postinst() {
338 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
339 - postgresql-config update
340 -
341 - elog "If you need a global psqlrc-file, you can place it in:"
342 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
343 -
344 - if use server ; then
345 - elog
346 - elog "Gentoo specific documentation:"
347 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
348 - elog
349 - elog "Official documentation:"
350 - elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
351 - elog
352 - elog "The default location of the Unix-domain socket is:"
353 - elog " ${EROOT%/}/run/postgresql/"
354 - elog
355 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
356 - elog "so that it contains your preferred locale in:"
357 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
358 - elog
359 - elog "Then, execute the following command to setup the initial database"
360 - elog "environment:"
361 - elog " emerge --config =${CATEGORY}/${PF}"
362 - fi
363 -}
364 -
365 -pkg_prerm() {
366 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
367 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
368 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
369 -
370 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
371 - sleep 10
372 - eend 0
373 - fi
374 -}
375 -
376 -pkg_postrm() {
377 - postgresql-config update
378 -}
379 -
380 -pkg_config() {
381 - use server || die "USE flag 'server' not enabled. Nothing to configure."
382 -
383 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
384 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
385 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
386 - [[ -z "${DATA_DIR}" ]] \
387 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
388 -
389 - # environment.bz2 may not contain the same locale as the current system
390 - # locale. Unset and source from the current system locale.
391 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
392 - unset LANG
393 - unset LC_CTYPE
394 - unset LC_NUMERIC
395 - unset LC_TIME
396 - unset LC_COLLATE
397 - unset LC_MONETARY
398 - unset LC_MESSAGES
399 - unset LC_ALL
400 - source "${EROOT%/}/etc/env.d/02locale"
401 - [ -n "${LANG}" ] && export LANG
402 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
403 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
404 - [ -n "${LC_TIME}" ] && export LC_TIME
405 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
406 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
407 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
408 - [ -n "${LC_ALL}" ] && export LC_ALL
409 - fi
410 -
411 - einfo "You can modify the paths and options passed to initdb by editing:"
412 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
413 - einfo
414 - einfo "Information on options that can be passed to initdb are found at:"
415 - einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
416 - einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
417 - einfo
418 - einfo "PG_INITDB_OPTS is currently set to:"
419 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
420 - einfo " (none)"
421 - else
422 - einfo " ${PG_INITDB_OPTS}"
423 - fi
424 - einfo
425 - einfo "Configuration files will be installed to:"
426 - einfo " ${PGDATA}"
427 - einfo
428 - einfo "The database cluster will be created in:"
429 - einfo " ${DATA_DIR}"
430 - einfo
431 -
432 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
433 - sleep 5
434 - eend 0
435 -
436 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
437 - eerror "The given directory, '${DATA_DIR}', is not empty."
438 - eerror "Modify DATA_DIR to point to an empty directory."
439 - die "${DATA_DIR} is not empty."
440 - fi
441 -
442 - einfo "Creating the data directory ..."
443 - if [[ ${EUID} == 0 ]] ; then
444 - mkdir -p "${DATA_DIR}"
445 - chown -Rf postgres:postgres "${DATA_DIR}"
446 - chmod 0700 "${DATA_DIR}"
447 - fi
448 -
449 - einfo "Initializing the database ..."
450 -
451 - if [[ ${EUID} == 0 ]] ; then
452 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
453 - else
454 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
455 - fi
456 -
457 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
458 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
459 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
460 - fi
461 -
462 - # unix_socket_directory has no effect in postgresql.conf as it's
463 - # overridden in the initscript
464 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
465 -
466 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
467 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
468 - # On the off-chance that you might need to work with UTF-8 encoded
469 - # characters in PL/Perl
470 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
471 - EOF
472 -
473 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
474 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
475 - einfo "by default. You can disable it in the cluster's:"
476 - einfo " ${PGDATA%/}/postgresql.conf"
477 - einfo
478 - if ! use systemd; then
479 - einfo "The PostgreSQL server, by default, will log events to:"
480 - einfo " ${DATA_DIR%/}/postmaster.log"
481 - einfo
482 - fi
483 - if use prefix ; then
484 - einfo "The location of the configuration files have moved to:"
485 - einfo " ${PGDATA}"
486 - einfo "To start the server:"
487 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
488 - einfo "To stop:"
489 - einfo " pg_ctl stop -D ${DATA_DIR}"
490 - einfo
491 - einfo "Or move the configuration files back:"
492 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
493 - elif use systemd; then
494 - einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
495 - einfo "instead of 'pg_ctl'."
496 - else
497 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
498 - einfo "instead of 'pg_ctl'."
499 - fi
500 -}
501 -
502 -src_test() {
503 - if use server && [[ ${UID} -ne 0 ]] ; then
504 - emake check
505 -
506 - einfo "If you think other tests besides the regression tests are necessary, please"
507 - einfo "submit a bug including a patch for this ebuild to enable them."
508 - else
509 - use server || \
510 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
511 - [[ ${UID} -eq 0 ]] || \
512 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
513 -
514 - ewarn 'Skipping.'
515 - fi
516 -}
517
518 diff --git a/dev-db/postgresql/postgresql-10.4.ebuild b/dev-db/postgresql/postgresql-10.4.ebuild
519 deleted file mode 100644
520 index 50f0472a566..00000000000
521 --- a/dev-db/postgresql/postgresql-10.4.ebuild
522 +++ /dev/null
523 @@ -1,460 +0,0 @@
524 -# Copyright 1999-2018 Gentoo Foundation
525 -# Distributed under the terms of the GNU General Public License v2
526 -
527 -EAPI="6"
528 -
529 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
530 -
531 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
532 - systemd user versionator
533 -
534 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
535 -
536 -SLOT=$(get_major_version)
537 -
538 -MY_PV=${PV/_/}
539 -S="${WORKDIR}/${PN}-${MY_PV}"
540 -
541 -SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
542 -
543 -LICENSE="POSTGRESQL GPL-2"
544 -DESCRIPTION="PostgreSQL RDBMS"
545 -HOMEPAGE="https://www.postgresql.org/"
546 -
547 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl python +readline
548 - selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
549 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
550 -
551 -wanted_languages() {
552 - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru
553 - sk sl sv tr zh_CN zh_TW"
554 - local enable_langs lingua
555 -
556 - for lingua in ${linguas} ; do
557 - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
558 - done
559 -
560 - echo -n ${enable_langs}
561 -}
562 -
563 -CDEPEND="
564 ->=app-eselect/eselect-postgresql-2.0
565 -sys-apps/less
566 -virtual/libintl
567 -kerberos? ( virtual/krb5 )
568 -ldap? ( net-nds/openldap )
569 -pam? ( virtual/pam )
570 -perl? ( >=dev-lang/perl-5.8:= )
571 -python? ( ${PYTHON_DEPS} )
572 -readline? ( sys-libs/readline:0= )
573 -server? ( systemd? ( sys-apps/systemd ) )
574 -ssl? (
575 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
576 - libressl? ( dev-libs/libressl:= )
577 -)
578 -tcl? ( >=dev-lang/tcl-8:0= )
579 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
580 -zlib? ( sys-libs/zlib )
581 -"
582 -
583 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
584 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
585 -# the libc includes UUID functions.
586 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
587 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
588 -
589 -nest_usedep() {
590 - local front back
591 - while [[ ${#} -gt 1 ]]; do
592 - front+="${1}? ( "
593 - back+=" )"
594 - shift
595 - done
596 - echo "${front}${1}${back}"
597 -}
598 -
599 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
600 -CDEPEND+="
601 -uuid? (
602 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
603 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
604 -)"
605 -
606 -DEPEND="${CDEPEND}
607 -!!<sys-apps/sandbox-2.0
608 -sys-devel/bison
609 -sys-devel/flex
610 -nls? ( sys-devel/gettext )
611 -xml? ( virtual/pkgconfig )
612 -"
613 -
614 -RDEPEND="${CDEPEND}
615 -!dev-db/postgresql-docs:${SLOT}
616 -!dev-db/postgresql-base:${SLOT}
617 -!dev-db/postgresql-server:${SLOT}
618 -selinux? ( sec-policy/selinux-postgresql )
619 -"
620 -
621 -pkg_setup() {
622 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
623 -
624 - enewgroup postgres 70
625 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
626 -
627 - use python && python-single-r1_pkg_setup
628 -}
629 -
630 -src_prepare() {
631 - # Work around PPC{,64} compilation bug where bool is already defined
632 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
633 -
634 - # Set proper run directory
635 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
636 - -i src/include/pg_config_manual.h || die
637 -
638 - # Rely on $PATH being in the proper order so that the correct
639 - # install program is used for modules utilizing PGXS in both
640 - # hardened and non-hardened environments. (Bug #528786)
641 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
642 -
643 - use server || eapply "${FILESDIR}/${PN}-10.2-no-server.patch"
644 -
645 - if use pam ; then
646 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
647 - -i src/backend/libpq/auth.c || \
648 - die 'PGSQL_PAM_SERVICE rename failed.'
649 - fi
650 -
651 - eapply_user
652 -}
653 -
654 -src_configure() {
655 - case ${CHOST} in
656 - *-darwin*|*-solaris*)
657 - use nls && append-libs intl
658 - ;;
659 - esac
660 -
661 - export LDFLAGS_SL="${LDFLAGS}"
662 - export LDFLAGS_EX="${LDFLAGS}"
663 -
664 - local PO="${EPREFIX%/}"
665 -
666 - local i uuid_config=""
667 - if use uuid; then
668 - for i in ${UTIL_LINUX_LIBC[@]}; do
669 - use ${i} && uuid_config="--with-uuid=e2fs"
670 - done
671 - for i in ${BSD_LIBC[@]}; do
672 - use ${i} && uuid_config="--with-uuid=bsd"
673 - done
674 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
675 - fi
676 -
677 - econf \
678 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
679 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
680 - --docdir="${PO}/usr/share/doc/${PF}" \
681 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
682 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
683 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
684 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
685 - $(use_enable !alpha spinlocks) \
686 - $(use_enable threads thread-safety) \
687 - $(use_with kerberos gssapi) \
688 - $(use_with ldap) \
689 - $(use_with pam) \
690 - $(use_with perl) \
691 - $(use_with python) \
692 - $(use_with readline) \
693 - $(use_with ssl openssl) \
694 - $(usex server "$(use_with systemd)" '--without-systemd') \
695 - $(use_with tcl) \
696 - ${uuid_config} \
697 - $(use_with xml libxml) \
698 - $(use_with xml libxslt) \
699 - $(use_with zlib) \
700 - "$(use_enable nls nls "$(wanted_languages)")"
701 -}
702 -
703 -src_compile() {
704 - emake
705 - emake -C contrib
706 -}
707 -
708 -src_install() {
709 - emake DESTDIR="${D}" install
710 - emake DESTDIR="${D}" install -C contrib
711 -
712 - dodoc README HISTORY doc/{TODO,bug.template}
713 -
714 - # man pages are already built, but if we have the target make them,
715 - # they'll be generated from source before being installed so we
716 - # manually install man pages.
717 - # We use ${SLOT} instead of doman for postgresql.eselect
718 - insinto /usr/share/postgresql-${SLOT}/man/
719 - doins -r doc/src/sgml/man{1,3,7}
720 - if ! use server; then
721 - # Remove man pages for non-existent binaries
722 - serverman=(
723 - initdb
724 - pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby}
725 - pg_{test_{fsync,timing},upgrade,waldump}
726 - post{gres,master}
727 - )
728 - for m in ${serverman[@]} ; do
729 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
730 - done
731 - fi
732 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
733 -
734 - # Create slot specific man pages
735 - local bn f mansec slotted_name
736 - for mansec in 1 3 7 ; do
737 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
738 -
739 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
740 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
741 -
742 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
743 - bn=$(basename "${f}")
744 - slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
745 - case ${bn} in
746 - TABLE.7|WITH.7)
747 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
748 - ;;
749 - *)
750 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
751 - ;;
752 - esac
753 - done
754 -
755 - popd > /dev/null
756 - done
757 -
758 - insinto /etc/postgresql-${SLOT}
759 - newins src/bin/psql/psqlrc.sample psqlrc
760 -
761 - use static-libs || find "${ED}" -name '*.a' -delete
762 -
763 - local f bn
764 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
765 - -mindepth 1 -maxdepth 1)
766 - do
767 - bn=$(basename "${f}")
768 - # Temporarily tack on tmp to workaround a file collision
769 - # issue. This is only necessary for 9.7 and earlier. 10 never
770 - # had this issue.
771 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
772 - "/usr/bin/${bn}${SLOT/.}"
773 - done
774 -
775 - if use doc ; then
776 - docinto html
777 - dodoc doc/src/sgml/html/*
778 - fi
779 -
780 - if use server; then
781 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
782 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
783 -
784 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
785 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
786 -
787 - if use systemd; then
788 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
789 - "${FILESDIR}/${PN}.service-9.6-r1" | \
790 - systemd_newunit - ${PN}-${SLOT}.service
791 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
792 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
793 - fi
794 -
795 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
796 -
797 - if use prefix ; then
798 - keepdir /run/postgresql
799 - fperms 1775 /run/postgresql
800 - fi
801 - fi
802 -}
803 -
804 -pkg_postinst() {
805 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
806 - postgresql-config update
807 -
808 - elog "If you need a global psqlrc-file, you can place it in:"
809 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
810 -
811 - if use server ; then
812 - elog
813 - elog "Gentoo specific documentation:"
814 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
815 - elog
816 - elog "Official documentation:"
817 - elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
818 - elog
819 - elog "The default location of the Unix-domain socket is:"
820 - elog " ${EROOT%/}/run/postgresql/"
821 - elog
822 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
823 - elog "so that it contains your preferred locale in:"
824 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
825 - elog
826 - elog "Then, execute the following command to setup the initial database"
827 - elog "environment:"
828 - elog " emerge --config =${CATEGORY}/${PF}"
829 - fi
830 -}
831 -
832 -pkg_prerm() {
833 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
834 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
835 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
836 -
837 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
838 - sleep 10
839 - eend 0
840 - fi
841 -}
842 -
843 -pkg_postrm() {
844 - postgresql-config update
845 -}
846 -
847 -pkg_config() {
848 - use server || die "USE flag 'server' not enabled. Nothing to configure."
849 -
850 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
851 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
852 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
853 - [[ -z "${DATA_DIR}" ]] \
854 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
855 -
856 - # environment.bz2 may not contain the same locale as the current system
857 - # locale. Unset and source from the current system locale.
858 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
859 - unset LANG
860 - unset LC_CTYPE
861 - unset LC_NUMERIC
862 - unset LC_TIME
863 - unset LC_COLLATE
864 - unset LC_MONETARY
865 - unset LC_MESSAGES
866 - unset LC_ALL
867 - source "${EROOT%/}/etc/env.d/02locale"
868 - [ -n "${LANG}" ] && export LANG
869 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
870 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
871 - [ -n "${LC_TIME}" ] && export LC_TIME
872 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
873 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
874 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
875 - [ -n "${LC_ALL}" ] && export LC_ALL
876 - fi
877 -
878 - einfo "You can modify the paths and options passed to initdb by editing:"
879 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
880 - einfo
881 - einfo "Information on options that can be passed to initdb are found at:"
882 - einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
883 - einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
884 - einfo
885 - einfo "PG_INITDB_OPTS is currently set to:"
886 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
887 - einfo " (none)"
888 - else
889 - einfo " ${PG_INITDB_OPTS}"
890 - fi
891 - einfo
892 - einfo "Configuration files will be installed to:"
893 - einfo " ${PGDATA}"
894 - einfo
895 - einfo "The database cluster will be created in:"
896 - einfo " ${DATA_DIR}"
897 - einfo
898 -
899 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
900 - sleep 5
901 - eend 0
902 -
903 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
904 - eerror "The given directory, '${DATA_DIR}', is not empty."
905 - eerror "Modify DATA_DIR to point to an empty directory."
906 - die "${DATA_DIR} is not empty."
907 - fi
908 -
909 - einfo "Creating the data directory ..."
910 - if [[ ${EUID} == 0 ]] ; then
911 - mkdir -p "${DATA_DIR}"
912 - chown -Rf postgres:postgres "${DATA_DIR}"
913 - chmod 0700 "${DATA_DIR}"
914 - fi
915 -
916 - einfo "Initializing the database ..."
917 -
918 - if [[ ${EUID} == 0 ]] ; then
919 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
920 - else
921 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
922 - fi
923 -
924 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
925 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
926 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
927 - fi
928 -
929 - # unix_socket_directory has no effect in postgresql.conf as it's
930 - # overridden in the initscript
931 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
932 -
933 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
934 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
935 - # On the off-chance that you might need to work with UTF-8 encoded
936 - # characters in PL/Perl
937 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
938 - EOF
939 -
940 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
941 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
942 - einfo "by default. You can disable it in the cluster's:"
943 - einfo " ${PGDATA%/}/postgresql.conf"
944 - einfo
945 - if ! use systemd; then
946 - einfo "The PostgreSQL server, by default, will log events to:"
947 - einfo " ${DATA_DIR%/}/postmaster.log"
948 - einfo
949 - fi
950 - if use prefix ; then
951 - einfo "The location of the configuration files have moved to:"
952 - einfo " ${PGDATA}"
953 - einfo "To start the server:"
954 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
955 - einfo "To stop:"
956 - einfo " pg_ctl stop -D ${DATA_DIR}"
957 - einfo
958 - einfo "Or move the configuration files back:"
959 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
960 - elif use systemd; then
961 - einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
962 - einfo "instead of 'pg_ctl'."
963 - else
964 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
965 - einfo "instead of 'pg_ctl'."
966 - fi
967 -}
968 -
969 -src_test() {
970 - if use server && [[ ${UID} -ne 0 ]] ; then
971 - emake check
972 -
973 - einfo "If you think other tests besides the regression tests are necessary, please"
974 - einfo "submit a bug including a patch for this ebuild to enable them."
975 - else
976 - use server || \
977 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
978 - [[ ${UID} -eq 0 ]] || \
979 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
980 -
981 - ewarn 'Skipping.'
982 - fi
983 -}
984
985 diff --git a/dev-db/postgresql/postgresql-11_beta1.ebuild b/dev-db/postgresql/postgresql-11_beta1.ebuild
986 deleted file mode 100644
987 index 8c9760a046d..00000000000
988 --- a/dev-db/postgresql/postgresql-11_beta1.ebuild
989 +++ /dev/null
990 @@ -1,449 +0,0 @@
991 -# Copyright 1999-2018 Gentoo Foundation
992 -# Distributed under the terms of the GNU General Public License v2
993 -
994 -EAPI="6"
995 -
996 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
997 -
998 -PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN
999 - zh_TW"
1000 -
1001 -inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \
1002 - systemd user versionator
1003 -
1004 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
1005 -
1006 -SLOT=$(get_major_version)
1007 -
1008 -MY_PV=${PV/_/}
1009 -S="${WORKDIR}/${PN}-${MY_PV}"
1010 -
1011 -SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
1012 -
1013 -LICENSE="POSTGRESQL GPL-2"
1014 -DESCRIPTION="PostgreSQL RDBMS"
1015 -HOMEPAGE="http://www.postgresql.org/"
1016 -
1017 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl python +readline
1018 - selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
1019 -
1020 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
1021 -
1022 -CDEPEND="
1023 ->=app-eselect/eselect-postgresql-2.0
1024 -sys-apps/less
1025 -virtual/libintl
1026 -kerberos? ( virtual/krb5 )
1027 -ldap? ( net-nds/openldap )
1028 -pam? ( virtual/pam )
1029 -perl? ( >=dev-lang/perl-5.8:= )
1030 -python? ( ${PYTHON_DEPS} )
1031 -readline? ( sys-libs/readline:0= )
1032 -server? ( systemd? ( sys-apps/systemd ) )
1033 -ssl? (
1034 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1035 - libressl? ( dev-libs/libressl:= )
1036 -)
1037 -tcl? ( >=dev-lang/tcl-8:0= )
1038 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
1039 -zlib? ( sys-libs/zlib )
1040 -"
1041 -
1042 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
1043 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
1044 -# the libc includes UUID functions.
1045 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
1046 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
1047 -
1048 -nest_usedep() {
1049 - local front back
1050 - while [[ ${#} -gt 1 ]]; do
1051 - front+="${1}? ( "
1052 - back+=" )"
1053 - shift
1054 - done
1055 - echo "${front}${1}${back}"
1056 -}
1057 -
1058 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
1059 -CDEPEND+="
1060 -uuid? (
1061 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
1062 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
1063 -)"
1064 -
1065 -DEPEND="${CDEPEND}
1066 -!!<sys-apps/sandbox-2.0
1067 -sys-devel/bison
1068 -sys-devel/flex
1069 -nls? ( sys-devel/gettext )
1070 -xml? ( virtual/pkgconfig )
1071 -"
1072 -
1073 -RDEPEND="${CDEPEND}
1074 -!dev-db/postgresql-docs:${SLOT}
1075 -!dev-db/postgresql-base:${SLOT}
1076 -!dev-db/postgresql-server:${SLOT}
1077 -selinux? ( sec-policy/selinux-postgresql )
1078 -"
1079 -
1080 -pkg_setup() {
1081 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
1082 -
1083 - enewgroup postgres 70
1084 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
1085 -
1086 - use python && python-single-r1_pkg_setup
1087 -}
1088 -
1089 -src_prepare() {
1090 - # Set proper run directory
1091 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1092 - -i src/include/pg_config_manual.h || die
1093 -
1094 - # Rely on $PATH being in the proper order so that the correct
1095 - # install program is used for modules utilizing PGXS in both
1096 - # hardened and non-hardened environments. (Bug #528786)
1097 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
1098 -
1099 - use server || eapply "${FILESDIR}/${PN}-11_beta1-no-server.patch"
1100 -
1101 - if use pam ; then
1102 - sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
1103 - -i src/backend/libpq/auth.c || \
1104 - die 'PGSQL_PAM_SERVICE rename failed.'
1105 - fi
1106 -
1107 - eapply_user
1108 -}
1109 -
1110 -src_configure() {
1111 - case ${CHOST} in
1112 - *-darwin*|*-solaris*)
1113 - use nls && append-libs intl
1114 - ;;
1115 - esac
1116 -
1117 - export LDFLAGS_SL="${LDFLAGS}"
1118 - export LDFLAGS_EX="${LDFLAGS}"
1119 -
1120 - local PO="${EPREFIX%/}"
1121 -
1122 - local i uuid_config=""
1123 - if use uuid; then
1124 - for i in ${UTIL_LINUX_LIBC[@]}; do
1125 - use ${i} && uuid_config="--with-uuid=e2fs"
1126 - done
1127 - for i in ${BSD_LIBC[@]}; do
1128 - use ${i} && uuid_config="--with-uuid=bsd"
1129 - done
1130 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
1131 - fi
1132 -
1133 - econf \
1134 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
1135 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
1136 - --docdir="${PO}/usr/share/doc/${PF}" \
1137 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
1138 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
1139 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
1140 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
1141 - $(use_enable !alpha spinlocks) \
1142 - $(use_enable threads thread-safety) \
1143 - $(use_with kerberos gssapi) \
1144 - $(use_with ldap) \
1145 - $(use_with pam) \
1146 - $(use_with perl) \
1147 - $(use_with python) \
1148 - $(use_with readline) \
1149 - $(use_with ssl openssl) \
1150 - $(usex server "$(use_with systemd)" '--without-systemd') \
1151 - $(use_with tcl) \
1152 - ${uuid_config} \
1153 - $(use_with xml libxml) \
1154 - $(use_with xml libxslt) \
1155 - $(use_with zlib) \
1156 - $(use_enable nls nls "'$(l10n_get_locales)'")
1157 -}
1158 -
1159 -src_compile() {
1160 - emake
1161 - emake -C contrib
1162 -}
1163 -
1164 -src_install() {
1165 - emake DESTDIR="${D}" install
1166 - emake DESTDIR="${D}" install -C contrib
1167 -
1168 - dodoc README HISTORY doc/{TODO,bug.template}
1169 -
1170 - # man pages are already built, but if we have the target make them,
1171 - # they'll be generated from source before being installed so we
1172 - # manually install man pages.
1173 - # We use ${SLOT} instead of doman for postgresql.eselect
1174 - insinto /usr/share/postgresql-${SLOT}/man/
1175 - doins -r doc/src/sgml/man{1,3,7}
1176 - if ! use server; then
1177 - # Remove man pages for non-existent binaries
1178 - serverman=(
1179 - initdb
1180 - pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby}
1181 - pg_{test_{fsync,timing},upgrade,waldump}
1182 - post{gres,master}
1183 - )
1184 - for m in ${serverman[@]} ; do
1185 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
1186 - done
1187 - fi
1188 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1189 -
1190 - # Create slot specific man pages
1191 - local bn f mansec slotted_name
1192 - for mansec in 1 3 7 ; do
1193 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
1194 -
1195 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
1196 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
1197 -
1198 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
1199 - bn=$(basename "${f}")
1200 - slotted_name=${bn%.${mansec}}${SLOT}.${mansec}
1201 - case ${bn} in
1202 - TABLE.7|WITH.7)
1203 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
1204 - ;;
1205 - *)
1206 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
1207 - ;;
1208 - esac
1209 - done
1210 -
1211 - popd > /dev/null
1212 - done
1213 -
1214 - insinto /etc/postgresql-${SLOT}
1215 - newins src/bin/psql/psqlrc.sample psqlrc
1216 -
1217 - use static-libs || find "${ED}" -name '*.a' -delete
1218 -
1219 - local f bn
1220 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
1221 - -mindepth 1 -maxdepth 1)
1222 - do
1223 - bn=$(basename "${f}")
1224 - # Temporarily tack on tmp to workaround a file collision
1225 - # issue. This is only necessary for 9.7 and earlier. 10 never
1226 - # had this issue.
1227 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
1228 - "/usr/bin/${bn}${SLOT/.}"
1229 - done
1230 -
1231 - if use doc ; then
1232 - docinto html
1233 - dodoc doc/src/sgml/html/*
1234 - fi
1235 -
1236 - if use server; then
1237 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1238 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
1239 -
1240 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1241 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
1242 -
1243 - if use systemd; then
1244 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1245 - "${FILESDIR}/${PN}.service-9.6-r1" | \
1246 - systemd_newunit - ${PN}-${SLOT}.service
1247 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1248 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
1249 - fi
1250 -
1251 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1252 -
1253 - if use prefix ; then
1254 - keepdir /run/postgresql
1255 - fperms 1775 /run/postgresql
1256 - fi
1257 - fi
1258 -}
1259 -
1260 -pkg_postinst() {
1261 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
1262 - postgresql-config update
1263 -
1264 - elog "If you need a global psqlrc-file, you can place it in:"
1265 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1266 -
1267 - if use server ; then
1268 - elog
1269 - elog "Gentoo specific documentation:"
1270 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1271 - elog
1272 - elog "Official documentation:"
1273 - elog "http://www.postgresql.org/docs/${SLOT}/static/index.html"
1274 - elog
1275 - elog "The default location of the Unix-domain socket is:"
1276 - elog " ${EROOT%/}/run/postgresql/"
1277 - elog
1278 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1279 - elog "so that it contains your preferred locale in:"
1280 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1281 - elog
1282 - elog "Then, execute the following command to setup the initial database"
1283 - elog "environment:"
1284 - elog " emerge --config =${CATEGORY}/${PF}"
1285 - fi
1286 -}
1287 -
1288 -pkg_prerm() {
1289 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1290 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1291 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
1292 -
1293 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
1294 - sleep 10
1295 - eend 0
1296 - fi
1297 -}
1298 -
1299 -pkg_postrm() {
1300 - postgresql-config update
1301 -}
1302 -
1303 -pkg_config() {
1304 - use server || die "USE flag 'server' not enabled. Nothing to configure."
1305 -
1306 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
1307 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1308 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1309 - [[ -z "${DATA_DIR}" ]] \
1310 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
1311 -
1312 - # environment.bz2 may not contain the same locale as the current system
1313 - # locale. Unset and source from the current system locale.
1314 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
1315 - unset LANG
1316 - unset LC_CTYPE
1317 - unset LC_NUMERIC
1318 - unset LC_TIME
1319 - unset LC_COLLATE
1320 - unset LC_MONETARY
1321 - unset LC_MESSAGES
1322 - unset LC_ALL
1323 - source "${EROOT%/}/etc/env.d/02locale"
1324 - [ -n "${LANG}" ] && export LANG
1325 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1326 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1327 - [ -n "${LC_TIME}" ] && export LC_TIME
1328 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1329 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1330 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1331 - [ -n "${LC_ALL}" ] && export LC_ALL
1332 - fi
1333 -
1334 - einfo "You can modify the paths and options passed to initdb by editing:"
1335 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1336 - einfo
1337 - einfo "Information on options that can be passed to initdb are found at:"
1338 - einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1339 - einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1340 - einfo
1341 - einfo "PG_INITDB_OPTS is currently set to:"
1342 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
1343 - einfo " (none)"
1344 - else
1345 - einfo " ${PG_INITDB_OPTS}"
1346 - fi
1347 - einfo
1348 - einfo "Configuration files will be installed to:"
1349 - einfo " ${PGDATA}"
1350 - einfo
1351 - einfo "The database cluster will be created in:"
1352 - einfo " ${DATA_DIR}"
1353 - einfo
1354 -
1355 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
1356 - sleep 5
1357 - eend 0
1358 -
1359 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
1360 - eerror "The given directory, '${DATA_DIR}', is not empty."
1361 - eerror "Modify DATA_DIR to point to an empty directory."
1362 - die "${DATA_DIR} is not empty."
1363 - fi
1364 -
1365 - einfo "Creating the data directory ..."
1366 - if [[ ${EUID} == 0 ]] ; then
1367 - mkdir -p "${DATA_DIR}"
1368 - chown -Rf postgres:postgres "${DATA_DIR}"
1369 - chmod 0700 "${DATA_DIR}"
1370 - fi
1371 -
1372 - einfo "Initializing the database ..."
1373 -
1374 - if [[ ${EUID} == 0 ]] ; then
1375 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
1376 - else
1377 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
1378 - fi
1379 -
1380 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
1381 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
1382 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
1383 - fi
1384 -
1385 - # unix_socket_directory has no effect in postgresql.conf as it's
1386 - # overridden in the initscript
1387 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
1388 -
1389 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
1390 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
1391 - # On the off-chance that you might need to work with UTF-8 encoded
1392 - # characters in PL/Perl
1393 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
1394 - EOF
1395 -
1396 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
1397 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
1398 - einfo "by default. You can disable it in the cluster's:"
1399 - einfo " ${PGDATA%/}/postgresql.conf"
1400 - einfo
1401 - if ! use systemd; then
1402 - einfo "The PostgreSQL server, by default, will log events to:"
1403 - einfo " ${DATA_DIR%/}/postmaster.log"
1404 - einfo
1405 - fi
1406 - if use prefix ; then
1407 - einfo "The location of the configuration files have moved to:"
1408 - einfo " ${PGDATA}"
1409 - einfo "To start the server:"
1410 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
1411 - einfo "To stop:"
1412 - einfo " pg_ctl stop -D ${DATA_DIR}"
1413 - einfo
1414 - einfo "Or move the configuration files back:"
1415 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
1416 - elif use systemd; then
1417 - einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
1418 - einfo "instead of 'pg_ctl'."
1419 - else
1420 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1421 - einfo "instead of 'pg_ctl'."
1422 - fi
1423 -}
1424 -
1425 -src_test() {
1426 - if use server && [[ ${UID} -ne 0 ]] ; then
1427 - emake check
1428 -
1429 - einfo "If you think other tests besides the regression tests are necessary, please"
1430 - einfo "submit a bug including a patch for this ebuild to enable them."
1431 - else
1432 - use server || \
1433 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
1434 - [[ ${UID} -eq 0 ]] || \
1435 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
1436 -
1437 - ewarn 'Skipping.'
1438 - fi
1439 -}
1440
1441 diff --git a/dev-db/postgresql/postgresql-9.3.22.ebuild b/dev-db/postgresql/postgresql-9.3.22.ebuild
1442 deleted file mode 100644
1443 index e1ed1641a5f..00000000000
1444 --- a/dev-db/postgresql/postgresql-9.3.22.ebuild
1445 +++ /dev/null
1446 @@ -1,450 +0,0 @@
1447 -# Copyright 1999-2018 Gentoo Foundation
1448 -# Distributed under the terms of the GNU General Public License v2
1449 -
1450 -EAPI="6"
1451 -
1452 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
1453 -
1454 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
1455 - systemd user versionator
1456 -
1457 -KEYWORDS="alpha amd64 arm ~hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
1458 -
1459 -SLOT="$(get_version_component_range 1-2)"
1460 -
1461 -SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
1462 -
1463 -LICENSE="POSTGRESQL GPL-2"
1464 -DESCRIPTION="PostgreSQL RDBMS"
1465 -HOMEPAGE="https://www.postgresql.org/"
1466 -
1467 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
1468 - +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
1469 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
1470 -
1471 -wanted_languages() {
1472 - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru
1473 - sk sl sv tr zh_CN zh_TW"
1474 - local enable_langs lingua
1475 -
1476 - for lingua in ${linguas} ; do
1477 - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
1478 - done
1479 -
1480 - echo -n ${enable_langs}
1481 -}
1482 -
1483 -CDEPEND="
1484 ->=app-eselect/eselect-postgresql-2.0
1485 -sys-apps/less
1486 -virtual/libintl
1487 -kerberos? ( virtual/krb5 )
1488 -ldap? ( net-nds/openldap )
1489 -pam? ( virtual/pam )
1490 -perl? ( >=dev-lang/perl-5.8:= )
1491 -python? ( ${PYTHON_DEPS} )
1492 -readline? ( sys-libs/readline:0= )
1493 -ssl? (
1494 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1495 - libressl? ( dev-libs/libressl:= )
1496 -)
1497 -tcl? ( >=dev-lang/tcl-8:0= )
1498 -uuid? ( dev-libs/ossp-uuid )
1499 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
1500 -zlib? ( sys-libs/zlib )
1501 -"
1502 -
1503 -DEPEND="${CDEPEND}
1504 -!!<sys-apps/sandbox-2.0
1505 -sys-devel/bison
1506 -sys-devel/flex
1507 -nls? ( sys-devel/gettext )
1508 -xml? ( virtual/pkgconfig )
1509 -"
1510 -
1511 -RDEPEND="${CDEPEND}
1512 -!dev-db/postgresql-docs:${SLOT}
1513 -!dev-db/postgresql-base:${SLOT}
1514 -!dev-db/postgresql-server:${SLOT}
1515 -selinux? ( sec-policy/selinux-postgresql )
1516 -"
1517 -
1518 -pkg_setup() {
1519 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
1520 -
1521 - enewgroup postgres 70
1522 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
1523 -
1524 - use python && python-single-r1_pkg_setup
1525 -}
1526 -
1527 -src_prepare() {
1528 - # Work around PPC{,64} compilation bug where bool is already defined
1529 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
1530 -
1531 - # Set proper run directory
1532 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1533 - -i src/include/pg_config_manual.h || die
1534 -
1535 - # Rely on $PATH being in the proper order so that the correct
1536 - # install program is used for modules utilizing PGXS in both
1537 - # hardened and non-hardened environments. (Bug #528786)
1538 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
1539 -
1540 - use server || eapply "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
1541 -
1542 - if use pam ; then
1543 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
1544 - -i src/backend/libpq/auth.c || \
1545 - die 'PGSQL_PAM_SERVICE rename failed.'
1546 - fi
1547 -
1548 - eapply_user
1549 -}
1550 -
1551 -src_configure() {
1552 - case ${CHOST} in
1553 - *-darwin*|*-solaris*)
1554 - use nls && append-libs intl
1555 - ;;
1556 - esac
1557 -
1558 - export LDFLAGS_SL="${LDFLAGS}"
1559 - export LDFLAGS_EX="${LDFLAGS}"
1560 -
1561 - local PO="${EPREFIX%/}"
1562 -
1563 - econf \
1564 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
1565 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
1566 - --docdir="${PO}/usr/share/doc/${PF}" \
1567 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
1568 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
1569 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
1570 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
1571 - $(use_enable !pg_legacytimestamp integer-datetimes) \
1572 - $(use_enable threads thread-safety) \
1573 - $(use_with kerberos gssapi) \
1574 - $(use_with kerberos krb5) \
1575 - $(use_with ldap) \
1576 - $(use_with pam) \
1577 - $(use_with perl) \
1578 - $(use_with python) \
1579 - $(use_with readline) \
1580 - $(use_with ssl openssl) \
1581 - $(use_with tcl) \
1582 - $(use_with uuid ossp-uuid) \
1583 - $(use_with xml libxml) \
1584 - $(use_with xml libxslt) \
1585 - $(use_with zlib) \
1586 - "$(use_enable nls nls "$(wanted_languages)")"
1587 -}
1588 -
1589 -src_compile() {
1590 - emake
1591 - emake -C contrib
1592 -}
1593 -
1594 -src_install() {
1595 - emake DESTDIR="${D}" install
1596 - emake DESTDIR="${D}" install -C contrib
1597 -
1598 - dodoc README HISTORY doc/{TODO,bug.template}
1599 -
1600 - # man pages are already built, but if we have the target make them,
1601 - # they'll be generated from source before being installed so we
1602 - # manually install man pages.
1603 - # We use ${SLOT} instead of doman for postgresql.eselect
1604 - insinto /usr/share/postgresql-${SLOT}/man/
1605 - doins -r doc/src/sgml/man{1,3,7}
1606 - if ! use server; then
1607 - # Remove man pages for non-existent binaries
1608 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
1609 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
1610 - done
1611 - fi
1612 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
1613 -
1614 - # Create slot specific man pages
1615 - local bn f mansec slotted_name
1616 - for mansec in 1 3 7 ; do
1617 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
1618 -
1619 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
1620 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
1621 -
1622 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
1623 - bn=$(basename "${f}")
1624 - slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
1625 - case ${bn} in
1626 - TABLE.7|WITH.7)
1627 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
1628 - ;;
1629 - *)
1630 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
1631 - ;;
1632 - esac
1633 - done
1634 -
1635 - popd > /dev/null
1636 - done
1637 -
1638 - insinto /etc/postgresql-${SLOT}
1639 - newins src/bin/psql/psqlrc.sample psqlrc
1640 -
1641 - use static-libs || find "${ED}" -name '*.a' -delete
1642 -
1643 - local f bn
1644 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
1645 - -mindepth 1 -maxdepth 1)
1646 - do
1647 - bn=$(basename "${f}")
1648 - # Temporarily tack on tmp to workaround a file collision
1649 - # issue. This is only necessary for 9.7 and earlier. 10 never
1650 - # had this issue.
1651 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
1652 - "/usr/bin/${bn}${SLOT/.}tmp"
1653 - done
1654 -
1655 - if use doc ; then
1656 - docinto html
1657 - dodoc doc/src/sgml/html/*
1658 -
1659 - docinto sgml
1660 - dodoc doc/src/sgml/*.{sgml,dsl}
1661 - fi
1662 -
1663 - if use server; then
1664 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1665 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
1666 -
1667 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1668 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
1669 -
1670 - if use systemd; then
1671 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
1672 - "${FILESDIR}/${PN}.service-9.2" | \
1673 - systemd_newunit - ${PN}-${SLOT}.service
1674 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
1675 - fi
1676 -
1677 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
1678 -
1679 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
1680 -
1681 - if use prefix ; then
1682 - keepdir /run/postgresql
1683 - fperms 1775 /run/postgresql
1684 - fi
1685 - fi
1686 -}
1687 -
1688 -pkg_preinst() {
1689 - # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
1690 - # /usr/bin/psql96). They may have been created by the
1691 - # postgresql.eselect module, but they're handled within this ebuild
1692 - # now. It's alright if we momentarily delete /usr/bin/psql as it
1693 - # will be recreated by the eselect module in pkg_ppostinst(). This
1694 - # is only necessary for 9.7 and earlier. 10 and later were never
1695 - # handled in this manner.
1696 - local canonicalise
1697 - if type -p realpath > /dev/null; then
1698 - canonicalise=realpath
1699 - elif type -p readlink > /dev/null; then
1700 - canonicalise='readlink -f'
1701 - else
1702 - # can't die, subshell
1703 - die "No readlink nor realpath found, cannot canonicalise"
1704 - fi
1705 -
1706 - local l
1707 - # First remove any symlinks in /usr/bin that may have been created
1708 - # by the old eselect
1709 - for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
1710 - if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
1711 - rm "${l}" || ewarn "Couldn't remove ${l}"
1712 - fi
1713 - done
1714 -
1715 - # Then move the symlinks created by the ebuild to their proper place.
1716 - for l in "${ED}"/usr/bin/*tmp ; do
1717 - mv "${l}" "${l%tmp}" \
1718 - || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
1719 - done
1720 -}
1721 -
1722 -pkg_postinst() {
1723 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
1724 - postgresql-config update
1725 -
1726 - elog "If you need a global psqlrc-file, you can place it in:"
1727 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
1728 -
1729 - if use server ; then
1730 - elog
1731 - elog "Gentoo specific documentation:"
1732 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
1733 - elog
1734 - elog "Official documentation:"
1735 - elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
1736 - elog
1737 - elog "The default location of the Unix-domain socket is:"
1738 - elog " ${EROOT%/}/run/postgresql/"
1739 - elog
1740 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
1741 - elog "so that it contains your preferred locale in:"
1742 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1743 - elog
1744 - elog "Then, execute the following command to setup the initial database"
1745 - elog "environment:"
1746 - elog " emerge --config =${CATEGORY}/${PF}"
1747 - fi
1748 -}
1749 -
1750 -pkg_prerm() {
1751 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
1752 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
1753 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
1754 -
1755 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
1756 - sleep 10
1757 - eend 0
1758 - fi
1759 -}
1760 -
1761 -pkg_postrm() {
1762 - postgresql-config update
1763 -}
1764 -
1765 -pkg_config() {
1766 - use server || die "USE flag 'server' not enabled. Nothing to configure."
1767 -
1768 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
1769 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1770 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
1771 - [[ -z "${DATA_DIR}" ]] \
1772 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
1773 -
1774 - # environment.bz2 may not contain the same locale as the current system
1775 - # locale. Unset and source from the current system locale.
1776 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
1777 - unset LANG
1778 - unset LC_CTYPE
1779 - unset LC_NUMERIC
1780 - unset LC_TIME
1781 - unset LC_COLLATE
1782 - unset LC_MONETARY
1783 - unset LC_MESSAGES
1784 - unset LC_ALL
1785 - source "${EROOT%/}/etc/env.d/02locale"
1786 - [ -n "${LANG}" ] && export LANG
1787 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
1788 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
1789 - [ -n "${LC_TIME}" ] && export LC_TIME
1790 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
1791 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
1792 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
1793 - [ -n "${LC_ALL}" ] && export LC_ALL
1794 - fi
1795 -
1796 - einfo "You can modify the paths and options passed to initdb by editing:"
1797 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
1798 - einfo
1799 - einfo "Information on options that can be passed to initdb are found at:"
1800 - einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
1801 - einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
1802 - einfo
1803 - einfo "PG_INITDB_OPTS is currently set to:"
1804 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
1805 - einfo " (none)"
1806 - else
1807 - einfo " ${PG_INITDB_OPTS}"
1808 - fi
1809 - einfo
1810 - einfo "Configuration files will be installed to:"
1811 - einfo " ${PGDATA}"
1812 - einfo
1813 - einfo "The database cluster will be created in:"
1814 - einfo " ${DATA_DIR}"
1815 - einfo
1816 -
1817 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
1818 - sleep 5
1819 - eend 0
1820 -
1821 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
1822 - eerror "The given directory, '${DATA_DIR}', is not empty."
1823 - eerror "Modify DATA_DIR to point to an empty directory."
1824 - die "${DATA_DIR} is not empty."
1825 - fi
1826 -
1827 - einfo "Creating the data directory ..."
1828 - if [[ ${EUID} == 0 ]] ; then
1829 - mkdir -p "${DATA_DIR}"
1830 - chown -Rf postgres:postgres "${DATA_DIR}"
1831 - chmod 0700 "${DATA_DIR}"
1832 - fi
1833 -
1834 - einfo "Initializing the database ..."
1835 -
1836 - if [[ ${EUID} == 0 ]] ; then
1837 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
1838 - else
1839 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
1840 - fi
1841 -
1842 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
1843 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
1844 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
1845 - fi
1846 -
1847 - # unix_socket_directory has no effect in postgresql.conf as it's
1848 - # overridden in the initscript
1849 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
1850 -
1851 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
1852 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
1853 - # On the off-chance that you might need to work with UTF-8 encoded
1854 - # characters in PL/Perl
1855 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
1856 - EOF
1857 -
1858 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
1859 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
1860 - einfo "by default. You can disable it in the cluster's:"
1861 - einfo " ${PGDATA%/}/postgresql.conf"
1862 - einfo
1863 - einfo "The PostgreSQL server, by default, will log events to:"
1864 - einfo " ${DATA_DIR%/}/postmaster.log"
1865 - einfo
1866 - if use prefix ; then
1867 - einfo "The location of the configuration files have moved to:"
1868 - einfo " ${PGDATA}"
1869 - einfo "To start the server:"
1870 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
1871 - einfo "To stop:"
1872 - einfo " pg_ctl stop -D ${DATA_DIR}"
1873 - einfo
1874 - einfo "Or move the configuration files back:"
1875 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
1876 - else
1877 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
1878 - einfo "instead of 'pg_ctl'."
1879 - fi
1880 -}
1881 -
1882 -src_test() {
1883 - if use server && [[ ${UID} -ne 0 ]] ; then
1884 - emake check
1885 -
1886 - einfo "If you think other tests besides the regression tests are necessary, please"
1887 - einfo "submit a bug including a patch for this ebuild to enable them."
1888 - else
1889 - use server || \
1890 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
1891 - [[ ${UID} -eq 0 ]] || \
1892 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
1893 -
1894 - ewarn 'Skipping.'
1895 - fi
1896 -}
1897
1898 diff --git a/dev-db/postgresql/postgresql-9.3.23.ebuild b/dev-db/postgresql/postgresql-9.3.23.ebuild
1899 deleted file mode 100644
1900 index b102a6c5fab..00000000000
1901 --- a/dev-db/postgresql/postgresql-9.3.23.ebuild
1902 +++ /dev/null
1903 @@ -1,450 +0,0 @@
1904 -# Copyright 1999-2018 Gentoo Foundation
1905 -# Distributed under the terms of the GNU General Public License v2
1906 -
1907 -EAPI="6"
1908 -
1909 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
1910 -
1911 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
1912 - systemd user versionator
1913 -
1914 -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
1915 -
1916 -SLOT="$(get_version_component_range 1-2)"
1917 -
1918 -SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
1919 -
1920 -LICENSE="POSTGRESQL GPL-2"
1921 -DESCRIPTION="PostgreSQL RDBMS"
1922 -HOMEPAGE="https://www.postgresql.org/"
1923 -
1924 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
1925 - +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
1926 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
1927 -
1928 -wanted_languages() {
1929 - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru
1930 - sk sl sv tr zh_CN zh_TW"
1931 - local enable_langs lingua
1932 -
1933 - for lingua in ${linguas} ; do
1934 - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
1935 - done
1936 -
1937 - echo -n ${enable_langs}
1938 -}
1939 -
1940 -CDEPEND="
1941 ->=app-eselect/eselect-postgresql-2.0
1942 -sys-apps/less
1943 -virtual/libintl
1944 -kerberos? ( virtual/krb5 )
1945 -ldap? ( net-nds/openldap )
1946 -pam? ( virtual/pam )
1947 -perl? ( >=dev-lang/perl-5.8:= )
1948 -python? ( ${PYTHON_DEPS} )
1949 -readline? ( sys-libs/readline:0= )
1950 -ssl? (
1951 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
1952 - libressl? ( dev-libs/libressl:= )
1953 -)
1954 -tcl? ( >=dev-lang/tcl-8:0= )
1955 -uuid? ( dev-libs/ossp-uuid )
1956 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
1957 -zlib? ( sys-libs/zlib )
1958 -"
1959 -
1960 -DEPEND="${CDEPEND}
1961 -!!<sys-apps/sandbox-2.0
1962 -sys-devel/bison
1963 -sys-devel/flex
1964 -nls? ( sys-devel/gettext )
1965 -xml? ( virtual/pkgconfig )
1966 -"
1967 -
1968 -RDEPEND="${CDEPEND}
1969 -!dev-db/postgresql-docs:${SLOT}
1970 -!dev-db/postgresql-base:${SLOT}
1971 -!dev-db/postgresql-server:${SLOT}
1972 -selinux? ( sec-policy/selinux-postgresql )
1973 -"
1974 -
1975 -pkg_setup() {
1976 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
1977 -
1978 - enewgroup postgres 70
1979 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
1980 -
1981 - use python && python-single-r1_pkg_setup
1982 -}
1983 -
1984 -src_prepare() {
1985 - # Work around PPC{,64} compilation bug where bool is already defined
1986 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
1987 -
1988 - # Set proper run directory
1989 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
1990 - -i src/include/pg_config_manual.h || die
1991 -
1992 - # Rely on $PATH being in the proper order so that the correct
1993 - # install program is used for modules utilizing PGXS in both
1994 - # hardened and non-hardened environments. (Bug #528786)
1995 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
1996 -
1997 - use server || eapply "${FILESDIR}/${PN}-${SLOT}-no-server.patch"
1998 -
1999 - if use pam ; then
2000 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
2001 - -i src/backend/libpq/auth.c || \
2002 - die 'PGSQL_PAM_SERVICE rename failed.'
2003 - fi
2004 -
2005 - eapply_user
2006 -}
2007 -
2008 -src_configure() {
2009 - case ${CHOST} in
2010 - *-darwin*|*-solaris*)
2011 - use nls && append-libs intl
2012 - ;;
2013 - esac
2014 -
2015 - export LDFLAGS_SL="${LDFLAGS}"
2016 - export LDFLAGS_EX="${LDFLAGS}"
2017 -
2018 - local PO="${EPREFIX%/}"
2019 -
2020 - econf \
2021 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
2022 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
2023 - --docdir="${PO}/usr/share/doc/${PF}" \
2024 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
2025 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
2026 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
2027 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
2028 - $(use_enable !pg_legacytimestamp integer-datetimes) \
2029 - $(use_enable threads thread-safety) \
2030 - $(use_with kerberos gssapi) \
2031 - $(use_with kerberos krb5) \
2032 - $(use_with ldap) \
2033 - $(use_with pam) \
2034 - $(use_with perl) \
2035 - $(use_with python) \
2036 - $(use_with readline) \
2037 - $(use_with ssl openssl) \
2038 - $(use_with tcl) \
2039 - $(use_with uuid ossp-uuid) \
2040 - $(use_with xml libxml) \
2041 - $(use_with xml libxslt) \
2042 - $(use_with zlib) \
2043 - "$(use_enable nls nls "$(wanted_languages)")"
2044 -}
2045 -
2046 -src_compile() {
2047 - emake
2048 - emake -C contrib
2049 -}
2050 -
2051 -src_install() {
2052 - emake DESTDIR="${D}" install
2053 - emake DESTDIR="${D}" install -C contrib
2054 -
2055 - dodoc README HISTORY doc/{TODO,bug.template}
2056 -
2057 - # man pages are already built, but if we have the target make them,
2058 - # they'll be generated from source before being installed so we
2059 - # manually install man pages.
2060 - # We use ${SLOT} instead of doman for postgresql.eselect
2061 - insinto /usr/share/postgresql-${SLOT}/man/
2062 - doins -r doc/src/sgml/man{1,3,7}
2063 - if ! use server; then
2064 - # Remove man pages for non-existent binaries
2065 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
2066 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
2067 - done
2068 - fi
2069 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
2070 -
2071 - # Create slot specific man pages
2072 - local bn f mansec slotted_name
2073 - for mansec in 1 3 7 ; do
2074 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
2075 -
2076 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
2077 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
2078 -
2079 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
2080 - bn=$(basename "${f}")
2081 - slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
2082 - case ${bn} in
2083 - TABLE.7|WITH.7)
2084 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
2085 - ;;
2086 - *)
2087 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
2088 - ;;
2089 - esac
2090 - done
2091 -
2092 - popd > /dev/null
2093 - done
2094 -
2095 - insinto /etc/postgresql-${SLOT}
2096 - newins src/bin/psql/psqlrc.sample psqlrc
2097 -
2098 - use static-libs || find "${ED}" -name '*.a' -delete
2099 -
2100 - local f bn
2101 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
2102 - -mindepth 1 -maxdepth 1)
2103 - do
2104 - bn=$(basename "${f}")
2105 - # Temporarily tack on tmp to workaround a file collision
2106 - # issue. This is only necessary for 9.7 and earlier. 10 never
2107 - # had this issue.
2108 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
2109 - "/usr/bin/${bn}${SLOT/.}tmp"
2110 - done
2111 -
2112 - if use doc ; then
2113 - docinto html
2114 - dodoc doc/src/sgml/html/*
2115 -
2116 - docinto sgml
2117 - dodoc doc/src/sgml/*.{sgml,dsl}
2118 - fi
2119 -
2120 - if use server; then
2121 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2122 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
2123 -
2124 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2125 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
2126 -
2127 - if use systemd; then
2128 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2129 - "${FILESDIR}/${PN}.service-9.2" | \
2130 - systemd_newunit - ${PN}-${SLOT}.service
2131 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
2132 - fi
2133 -
2134 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
2135 -
2136 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
2137 -
2138 - if use prefix ; then
2139 - keepdir /run/postgresql
2140 - fperms 1775 /run/postgresql
2141 - fi
2142 - fi
2143 -}
2144 -
2145 -pkg_preinst() {
2146 - # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
2147 - # /usr/bin/psql96). They may have been created by the
2148 - # postgresql.eselect module, but they're handled within this ebuild
2149 - # now. It's alright if we momentarily delete /usr/bin/psql as it
2150 - # will be recreated by the eselect module in pkg_ppostinst(). This
2151 - # is only necessary for 9.7 and earlier. 10 and later were never
2152 - # handled in this manner.
2153 - local canonicalise
2154 - if type -p realpath > /dev/null; then
2155 - canonicalise=realpath
2156 - elif type -p readlink > /dev/null; then
2157 - canonicalise='readlink -f'
2158 - else
2159 - # can't die, subshell
2160 - die "No readlink nor realpath found, cannot canonicalise"
2161 - fi
2162 -
2163 - local l
2164 - # First remove any symlinks in /usr/bin that may have been created
2165 - # by the old eselect
2166 - for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
2167 - if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
2168 - rm "${l}" || ewarn "Couldn't remove ${l}"
2169 - fi
2170 - done
2171 -
2172 - # Then move the symlinks created by the ebuild to their proper place.
2173 - for l in "${ED}"/usr/bin/*tmp ; do
2174 - mv "${l}" "${l%tmp}" \
2175 - || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
2176 - done
2177 -}
2178 -
2179 -pkg_postinst() {
2180 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
2181 - postgresql-config update
2182 -
2183 - elog "If you need a global psqlrc-file, you can place it in:"
2184 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
2185 -
2186 - if use server ; then
2187 - elog
2188 - elog "Gentoo specific documentation:"
2189 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
2190 - elog
2191 - elog "Official documentation:"
2192 - elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
2193 - elog
2194 - elog "The default location of the Unix-domain socket is:"
2195 - elog " ${EROOT%/}/run/postgresql/"
2196 - elog
2197 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
2198 - elog "so that it contains your preferred locale in:"
2199 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2200 - elog
2201 - elog "Then, execute the following command to setup the initial database"
2202 - elog "environment:"
2203 - elog " emerge --config =${CATEGORY}/${PF}"
2204 - fi
2205 -}
2206 -
2207 -pkg_prerm() {
2208 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
2209 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
2210 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
2211 -
2212 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
2213 - sleep 10
2214 - eend 0
2215 - fi
2216 -}
2217 -
2218 -pkg_postrm() {
2219 - postgresql-config update
2220 -}
2221 -
2222 -pkg_config() {
2223 - use server || die "USE flag 'server' not enabled. Nothing to configure."
2224 -
2225 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
2226 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2227 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
2228 - [[ -z "${DATA_DIR}" ]] \
2229 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
2230 -
2231 - # environment.bz2 may not contain the same locale as the current system
2232 - # locale. Unset and source from the current system locale.
2233 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
2234 - unset LANG
2235 - unset LC_CTYPE
2236 - unset LC_NUMERIC
2237 - unset LC_TIME
2238 - unset LC_COLLATE
2239 - unset LC_MONETARY
2240 - unset LC_MESSAGES
2241 - unset LC_ALL
2242 - source "${EROOT%/}/etc/env.d/02locale"
2243 - [ -n "${LANG}" ] && export LANG
2244 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
2245 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
2246 - [ -n "${LC_TIME}" ] && export LC_TIME
2247 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
2248 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
2249 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
2250 - [ -n "${LC_ALL}" ] && export LC_ALL
2251 - fi
2252 -
2253 - einfo "You can modify the paths and options passed to initdb by editing:"
2254 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2255 - einfo
2256 - einfo "Information on options that can be passed to initdb are found at:"
2257 - einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
2258 - einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
2259 - einfo
2260 - einfo "PG_INITDB_OPTS is currently set to:"
2261 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
2262 - einfo " (none)"
2263 - else
2264 - einfo " ${PG_INITDB_OPTS}"
2265 - fi
2266 - einfo
2267 - einfo "Configuration files will be installed to:"
2268 - einfo " ${PGDATA}"
2269 - einfo
2270 - einfo "The database cluster will be created in:"
2271 - einfo " ${DATA_DIR}"
2272 - einfo
2273 -
2274 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
2275 - sleep 5
2276 - eend 0
2277 -
2278 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
2279 - eerror "The given directory, '${DATA_DIR}', is not empty."
2280 - eerror "Modify DATA_DIR to point to an empty directory."
2281 - die "${DATA_DIR} is not empty."
2282 - fi
2283 -
2284 - einfo "Creating the data directory ..."
2285 - if [[ ${EUID} == 0 ]] ; then
2286 - mkdir -p "${DATA_DIR}"
2287 - chown -Rf postgres:postgres "${DATA_DIR}"
2288 - chmod 0700 "${DATA_DIR}"
2289 - fi
2290 -
2291 - einfo "Initializing the database ..."
2292 -
2293 - if [[ ${EUID} == 0 ]] ; then
2294 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
2295 - else
2296 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
2297 - fi
2298 -
2299 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
2300 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
2301 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
2302 - fi
2303 -
2304 - # unix_socket_directory has no effect in postgresql.conf as it's
2305 - # overridden in the initscript
2306 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
2307 -
2308 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
2309 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
2310 - # On the off-chance that you might need to work with UTF-8 encoded
2311 - # characters in PL/Perl
2312 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
2313 - EOF
2314 -
2315 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
2316 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
2317 - einfo "by default. You can disable it in the cluster's:"
2318 - einfo " ${PGDATA%/}/postgresql.conf"
2319 - einfo
2320 - einfo "The PostgreSQL server, by default, will log events to:"
2321 - einfo " ${DATA_DIR%/}/postmaster.log"
2322 - einfo
2323 - if use prefix ; then
2324 - einfo "The location of the configuration files have moved to:"
2325 - einfo " ${PGDATA}"
2326 - einfo "To start the server:"
2327 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
2328 - einfo "To stop:"
2329 - einfo " pg_ctl stop -D ${DATA_DIR}"
2330 - einfo
2331 - einfo "Or move the configuration files back:"
2332 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
2333 - else
2334 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
2335 - einfo "instead of 'pg_ctl'."
2336 - fi
2337 -}
2338 -
2339 -src_test() {
2340 - if use server && [[ ${UID} -ne 0 ]] ; then
2341 - emake check
2342 -
2343 - einfo "If you think other tests besides the regression tests are necessary, please"
2344 - einfo "submit a bug including a patch for this ebuild to enable them."
2345 - else
2346 - use server || \
2347 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
2348 - [[ ${UID} -eq 0 ]] || \
2349 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
2350 -
2351 - ewarn 'Skipping.'
2352 - fi
2353 -}
2354
2355 diff --git a/dev-db/postgresql/postgresql-9.4.17.ebuild b/dev-db/postgresql/postgresql-9.4.17.ebuild
2356 deleted file mode 100644
2357 index 6e9dd5d11fe..00000000000
2358 --- a/dev-db/postgresql/postgresql-9.4.17.ebuild
2359 +++ /dev/null
2360 @@ -1,482 +0,0 @@
2361 -# Copyright 1999-2018 Gentoo Foundation
2362 -# Distributed under the terms of the GNU General Public License v2
2363 -
2364 -EAPI="6"
2365 -
2366 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
2367 -
2368 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
2369 - systemd user versionator
2370 -
2371 -KEYWORDS="alpha amd64 arm ~hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
2372 -
2373 -SLOT="$(get_version_component_range 1-2)"
2374 -
2375 -SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
2376 -
2377 -LICENSE="POSTGRESQL GPL-2"
2378 -DESCRIPTION="PostgreSQL RDBMS"
2379 -HOMEPAGE="https://www.postgresql.org/"
2380 -
2381 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
2382 - +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
2383 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
2384 -
2385 -wanted_languages() {
2386 - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru
2387 - sk sl sv tr zh_CN zh_TW"
2388 - local enable_langs lingua
2389 -
2390 - for lingua in ${linguas} ; do
2391 - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
2392 - done
2393 -
2394 - echo -n ${enable_langs}
2395 -}
2396 -
2397 -CDEPEND="
2398 ->=app-eselect/eselect-postgresql-2.0
2399 -sys-apps/less
2400 -virtual/libintl
2401 -kerberos? ( virtual/krb5 )
2402 -ldap? ( net-nds/openldap )
2403 -pam? ( virtual/pam )
2404 -perl? ( >=dev-lang/perl-5.8:= )
2405 -python? ( ${PYTHON_DEPS} )
2406 -readline? ( sys-libs/readline:0= )
2407 -ssl? (
2408 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
2409 - libressl? ( dev-libs/libressl:= )
2410 -)
2411 -tcl? ( >=dev-lang/tcl-8:0= )
2412 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
2413 -zlib? ( sys-libs/zlib )
2414 -"
2415 -
2416 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
2417 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
2418 -# the libc includes UUID functions.
2419 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
2420 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
2421 -
2422 -nest_usedep() {
2423 - local front back
2424 - while [[ ${#} -gt 1 ]]; do
2425 - front+="${1}? ( "
2426 - back+=" )"
2427 - shift
2428 - done
2429 - echo "${front}${1}${back}"
2430 -}
2431 -
2432 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
2433 -CDEPEND+="
2434 -uuid? (
2435 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
2436 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
2437 -)"
2438 -
2439 -DEPEND="${CDEPEND}
2440 -!!<sys-apps/sandbox-2.0
2441 -sys-devel/bison
2442 -sys-devel/flex
2443 -nls? ( sys-devel/gettext )
2444 -xml? ( virtual/pkgconfig )
2445 -"
2446 -
2447 -RDEPEND="${CDEPEND}
2448 -!dev-db/postgresql-docs:${SLOT}
2449 -!dev-db/postgresql-base:${SLOT}
2450 -!dev-db/postgresql-server:${SLOT}
2451 -selinux? ( sec-policy/selinux-postgresql )
2452 -"
2453 -
2454 -pkg_setup() {
2455 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
2456 -
2457 - enewgroup postgres 70
2458 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
2459 -
2460 - use python && python-single-r1_pkg_setup
2461 -}
2462 -
2463 -src_prepare() {
2464 - # Work around PPC{,64} compilation bug where bool is already defined
2465 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
2466 -
2467 - # Set proper run directory
2468 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
2469 - -i src/include/pg_config_manual.h || die
2470 -
2471 - # Rely on $PATH being in the proper order so that the correct
2472 - # install program is used for modules utilizing PGXS in both
2473 - # hardened and non-hardened environments. (Bug #528786)
2474 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
2475 -
2476 - use server || eapply "${FILESDIR}/${PN}-9.4.10-no-server.patch"
2477 -
2478 - if use pam ; then
2479 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
2480 - -i src/backend/libpq/auth.c || \
2481 - die 'PGSQL_PAM_SERVICE rename failed.'
2482 - fi
2483 -
2484 - eapply_user
2485 -}
2486 -
2487 -src_configure() {
2488 - case ${CHOST} in
2489 - *-darwin*|*-solaris*)
2490 - use nls && append-libs intl
2491 - ;;
2492 - esac
2493 -
2494 - export LDFLAGS_SL="${LDFLAGS}"
2495 - export LDFLAGS_EX="${LDFLAGS}"
2496 -
2497 - local PO="${EPREFIX%/}"
2498 -
2499 - local i uuid_config=""
2500 - if use uuid; then
2501 - for i in ${UTIL_LINUX_LIBC[@]}; do
2502 - use ${i} && uuid_config="--with-uuid=e2fs"
2503 - done
2504 - for i in ${BSD_LIBC[@]}; do
2505 - use ${i} && uuid_config="--with-uuid=bsd"
2506 - done
2507 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
2508 - fi
2509 -
2510 - econf \
2511 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
2512 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
2513 - --docdir="${PO}/usr/share/doc/${PF}" \
2514 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
2515 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
2516 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
2517 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
2518 - $(use_enable !pg_legacytimestamp integer-datetimes) \
2519 - $(use_enable threads thread-safety) \
2520 - $(use_with kerberos gssapi) \
2521 - $(use_with ldap) \
2522 - $(use_with pam) \
2523 - $(use_with perl) \
2524 - $(use_with python) \
2525 - $(use_with readline) \
2526 - $(use_with ssl openssl) \
2527 - $(use_with tcl) \
2528 - ${uuid_config} \
2529 - $(use_with xml libxml) \
2530 - $(use_with xml libxslt) \
2531 - $(use_with zlib) \
2532 - "$(use_enable nls nls "$(wanted_languages)")"
2533 -}
2534 -
2535 -src_compile() {
2536 - emake
2537 - emake -C contrib
2538 -}
2539 -
2540 -src_install() {
2541 - emake DESTDIR="${D}" install
2542 - emake DESTDIR="${D}" install -C contrib
2543 -
2544 - dodoc README HISTORY doc/{TODO,bug.template}
2545 -
2546 - # man pages are already built, but if we have the target make them,
2547 - # they'll be generated from source before being installed so we
2548 - # manually install man pages.
2549 - # We use ${SLOT} instead of doman for postgresql.eselect
2550 - insinto /usr/share/postgresql-${SLOT}/man/
2551 - doins -r doc/src/sgml/man{1,3,7}
2552 - if ! use server; then
2553 - # Remove man pages for non-existent binaries
2554 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
2555 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
2556 - done
2557 - fi
2558 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
2559 -
2560 - # Create slot specific man pages
2561 - local bn f mansec slotted_name
2562 - for mansec in 1 3 7 ; do
2563 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
2564 -
2565 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
2566 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
2567 -
2568 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
2569 - bn=$(basename "${f}")
2570 - slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
2571 - case ${bn} in
2572 - TABLE.7|WITH.7)
2573 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
2574 - ;;
2575 - *)
2576 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
2577 - ;;
2578 - esac
2579 - done
2580 -
2581 - popd > /dev/null
2582 - done
2583 -
2584 - insinto /etc/postgresql-${SLOT}
2585 - newins src/bin/psql/psqlrc.sample psqlrc
2586 -
2587 - use static-libs || find "${ED}" -name '*.a' -delete
2588 -
2589 - local f bn
2590 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
2591 - -mindepth 1 -maxdepth 1)
2592 - do
2593 - bn=$(basename "${f}")
2594 - # Temporarily tack on tmp to workaround a file collision
2595 - # issue. This is only necessary for 9.7 and earlier. 10 never
2596 - # had this issue.
2597 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
2598 - "/usr/bin/${bn}${SLOT/.}tmp"
2599 - done
2600 -
2601 - if use doc ; then
2602 - docinto html
2603 - dodoc doc/src/sgml/html/*
2604 -
2605 - docinto sgml
2606 - dodoc doc/src/sgml/*.{sgml,dsl}
2607 - fi
2608 -
2609 - if use server; then
2610 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2611 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
2612 -
2613 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2614 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
2615 -
2616 - if use systemd; then
2617 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
2618 - "${FILESDIR}/${PN}.service-9.2" | \
2619 - systemd_newunit - ${PN}-${SLOT}.service
2620 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
2621 - fi
2622 -
2623 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
2624 -
2625 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
2626 -
2627 - if use prefix ; then
2628 - keepdir /run/postgresql
2629 - fperms 1775 /run/postgresql
2630 - fi
2631 - fi
2632 -}
2633 -
2634 -pkg_preinst() {
2635 - # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
2636 - # /usr/bin/psql96). They may have been created by the
2637 - # postgresql.eselect module, but they're handled within this ebuild
2638 - # now. It's alright if we momentarily delete /usr/bin/psql as it
2639 - # will be recreated by the eselect module in pkg_ppostinst(). This
2640 - # is only necessary for 9.7 and earlier. 10 and later were never
2641 - # handled in this manner.
2642 - local canonicalise
2643 - if type -p realpath > /dev/null; then
2644 - canonicalise=realpath
2645 - elif type -p readlink > /dev/null; then
2646 - canonicalise='readlink -f'
2647 - else
2648 - # can't die, subshell
2649 - die "No readlink nor realpath found, cannot canonicalise"
2650 - fi
2651 -
2652 - local l
2653 - # First remove any symlinks in /usr/bin that may have been created
2654 - # by the old eselect
2655 - for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
2656 - if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
2657 - rm "${l}" || ewarn "Couldn't remove ${l}"
2658 - fi
2659 - done
2660 -
2661 - # Then move the symlinks created by the ebuild to their proper place.
2662 - for l in "${ED}"/usr/bin/*tmp ; do
2663 - mv "${l}" "${l%tmp}" \
2664 - || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
2665 - done
2666 -}
2667 -
2668 -pkg_postinst() {
2669 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
2670 - postgresql-config update
2671 -
2672 - elog "If you need a global psqlrc-file, you can place it in:"
2673 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
2674 -
2675 - if use server ; then
2676 - elog
2677 - elog "Gentoo specific documentation:"
2678 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
2679 - elog
2680 - elog "Official documentation:"
2681 - elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
2682 - elog
2683 - elog "The default location of the Unix-domain socket is:"
2684 - elog " ${EROOT%/}/run/postgresql/"
2685 - elog
2686 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
2687 - elog "so that it contains your preferred locale in:"
2688 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2689 - elog
2690 - elog "Then, execute the following command to setup the initial database"
2691 - elog "environment:"
2692 - elog " emerge --config =${CATEGORY}/${PF}"
2693 - fi
2694 -}
2695 -
2696 -pkg_prerm() {
2697 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
2698 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
2699 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
2700 -
2701 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
2702 - sleep 10
2703 - eend 0
2704 - fi
2705 -}
2706 -
2707 -pkg_postrm() {
2708 - postgresql-config update
2709 -}
2710 -
2711 -pkg_config() {
2712 - use server || die "USE flag 'server' not enabled. Nothing to configure."
2713 -
2714 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
2715 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2716 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
2717 - [[ -z "${DATA_DIR}" ]] \
2718 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
2719 -
2720 - # environment.bz2 may not contain the same locale as the current system
2721 - # locale. Unset and source from the current system locale.
2722 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
2723 - unset LANG
2724 - unset LC_CTYPE
2725 - unset LC_NUMERIC
2726 - unset LC_TIME
2727 - unset LC_COLLATE
2728 - unset LC_MONETARY
2729 - unset LC_MESSAGES
2730 - unset LC_ALL
2731 - source "${EROOT%/}/etc/env.d/02locale"
2732 - [ -n "${LANG}" ] && export LANG
2733 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
2734 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
2735 - [ -n "${LC_TIME}" ] && export LC_TIME
2736 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
2737 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
2738 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
2739 - [ -n "${LC_ALL}" ] && export LC_ALL
2740 - fi
2741 -
2742 - einfo "You can modify the paths and options passed to initdb by editing:"
2743 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
2744 - einfo
2745 - einfo "Information on options that can be passed to initdb are found at:"
2746 - einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
2747 - einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
2748 - einfo
2749 - einfo "PG_INITDB_OPTS is currently set to:"
2750 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
2751 - einfo " (none)"
2752 - else
2753 - einfo " ${PG_INITDB_OPTS}"
2754 - fi
2755 - einfo
2756 - einfo "Configuration files will be installed to:"
2757 - einfo " ${PGDATA}"
2758 - einfo
2759 - einfo "The database cluster will be created in:"
2760 - einfo " ${DATA_DIR}"
2761 - einfo
2762 -
2763 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
2764 - sleep 5
2765 - eend 0
2766 -
2767 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
2768 - eerror "The given directory, '${DATA_DIR}', is not empty."
2769 - eerror "Modify DATA_DIR to point to an empty directory."
2770 - die "${DATA_DIR} is not empty."
2771 - fi
2772 -
2773 - einfo "Creating the data directory ..."
2774 - if [[ ${EUID} == 0 ]] ; then
2775 - mkdir -p "${DATA_DIR}"
2776 - chown -Rf postgres:postgres "${DATA_DIR}"
2777 - chmod 0700 "${DATA_DIR}"
2778 - fi
2779 -
2780 - einfo "Initializing the database ..."
2781 -
2782 - if [[ ${EUID} == 0 ]] ; then
2783 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
2784 - else
2785 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
2786 - fi
2787 -
2788 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
2789 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
2790 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
2791 - fi
2792 -
2793 - # unix_socket_directory has no effect in postgresql.conf as it's
2794 - # overridden in the initscript
2795 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
2796 -
2797 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
2798 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
2799 - # On the off-chance that you might need to work with UTF-8 encoded
2800 - # characters in PL/Perl
2801 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
2802 - EOF
2803 -
2804 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
2805 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
2806 - einfo "by default. You can disable it in the cluster's:"
2807 - einfo " ${PGDATA%/}/postgresql.conf"
2808 - einfo
2809 - einfo "The PostgreSQL server, by default, will log events to:"
2810 - einfo " ${DATA_DIR%/}/postmaster.log"
2811 - einfo
2812 - if use prefix ; then
2813 - einfo "The location of the configuration files have moved to:"
2814 - einfo " ${PGDATA}"
2815 - einfo "To start the server:"
2816 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
2817 - einfo "To stop:"
2818 - einfo " pg_ctl stop -D ${DATA_DIR}"
2819 - einfo
2820 - einfo "Or move the configuration files back:"
2821 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
2822 - else
2823 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
2824 - einfo "instead of 'pg_ctl'."
2825 - fi
2826 -}
2827 -
2828 -src_test() {
2829 - if use server && [[ ${UID} -ne 0 ]] ; then
2830 - emake check
2831 -
2832 - einfo "If you think other tests besides the regression tests are necessary, please"
2833 - einfo "submit a bug including a patch for this ebuild to enable them."
2834 - else
2835 - use server || \
2836 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
2837 - [[ ${UID} -eq 0 ]] || \
2838 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
2839 -
2840 - ewarn 'Skipping.'
2841 - fi
2842 -}
2843
2844 diff --git a/dev-db/postgresql/postgresql-9.4.18.ebuild b/dev-db/postgresql/postgresql-9.4.18.ebuild
2845 deleted file mode 100644
2846 index 7243cdb0dd4..00000000000
2847 --- a/dev-db/postgresql/postgresql-9.4.18.ebuild
2848 +++ /dev/null
2849 @@ -1,482 +0,0 @@
2850 -# Copyright 1999-2018 Gentoo Foundation
2851 -# Distributed under the terms of the GNU General Public License v2
2852 -
2853 -EAPI="6"
2854 -
2855 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
2856 -
2857 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
2858 - systemd user versionator
2859 -
2860 -KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
2861 -
2862 -SLOT="$(get_version_component_range 1-2)"
2863 -
2864 -SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
2865 -
2866 -LICENSE="POSTGRESQL GPL-2"
2867 -DESCRIPTION="PostgreSQL RDBMS"
2868 -HOMEPAGE="https://www.postgresql.org/"
2869 -
2870 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
2871 - +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
2872 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
2873 -
2874 -wanted_languages() {
2875 - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru
2876 - sk sl sv tr zh_CN zh_TW"
2877 - local enable_langs lingua
2878 -
2879 - for lingua in ${linguas} ; do
2880 - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
2881 - done
2882 -
2883 - echo -n ${enable_langs}
2884 -}
2885 -
2886 -CDEPEND="
2887 ->=app-eselect/eselect-postgresql-2.0
2888 -sys-apps/less
2889 -virtual/libintl
2890 -kerberos? ( virtual/krb5 )
2891 -ldap? ( net-nds/openldap )
2892 -pam? ( virtual/pam )
2893 -perl? ( >=dev-lang/perl-5.8:= )
2894 -python? ( ${PYTHON_DEPS} )
2895 -readline? ( sys-libs/readline:0= )
2896 -ssl? (
2897 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
2898 - libressl? ( dev-libs/libressl:= )
2899 -)
2900 -tcl? ( >=dev-lang/tcl-8:0= )
2901 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
2902 -zlib? ( sys-libs/zlib )
2903 -"
2904 -
2905 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
2906 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
2907 -# the libc includes UUID functions.
2908 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
2909 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
2910 -
2911 -nest_usedep() {
2912 - local front back
2913 - while [[ ${#} -gt 1 ]]; do
2914 - front+="${1}? ( "
2915 - back+=" )"
2916 - shift
2917 - done
2918 - echo "${front}${1}${back}"
2919 -}
2920 -
2921 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
2922 -CDEPEND+="
2923 -uuid? (
2924 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
2925 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
2926 -)"
2927 -
2928 -DEPEND="${CDEPEND}
2929 -!!<sys-apps/sandbox-2.0
2930 -sys-devel/bison
2931 -sys-devel/flex
2932 -nls? ( sys-devel/gettext )
2933 -xml? ( virtual/pkgconfig )
2934 -"
2935 -
2936 -RDEPEND="${CDEPEND}
2937 -!dev-db/postgresql-docs:${SLOT}
2938 -!dev-db/postgresql-base:${SLOT}
2939 -!dev-db/postgresql-server:${SLOT}
2940 -selinux? ( sec-policy/selinux-postgresql )
2941 -"
2942 -
2943 -pkg_setup() {
2944 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
2945 -
2946 - enewgroup postgres 70
2947 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
2948 -
2949 - use python && python-single-r1_pkg_setup
2950 -}
2951 -
2952 -src_prepare() {
2953 - # Work around PPC{,64} compilation bug where bool is already defined
2954 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
2955 -
2956 - # Set proper run directory
2957 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
2958 - -i src/include/pg_config_manual.h || die
2959 -
2960 - # Rely on $PATH being in the proper order so that the correct
2961 - # install program is used for modules utilizing PGXS in both
2962 - # hardened and non-hardened environments. (Bug #528786)
2963 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
2964 -
2965 - use server || eapply "${FILESDIR}/${PN}-9.4.10-no-server.patch"
2966 -
2967 - if use pam ; then
2968 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
2969 - -i src/backend/libpq/auth.c || \
2970 - die 'PGSQL_PAM_SERVICE rename failed.'
2971 - fi
2972 -
2973 - eapply_user
2974 -}
2975 -
2976 -src_configure() {
2977 - case ${CHOST} in
2978 - *-darwin*|*-solaris*)
2979 - use nls && append-libs intl
2980 - ;;
2981 - esac
2982 -
2983 - export LDFLAGS_SL="${LDFLAGS}"
2984 - export LDFLAGS_EX="${LDFLAGS}"
2985 -
2986 - local PO="${EPREFIX%/}"
2987 -
2988 - local i uuid_config=""
2989 - if use uuid; then
2990 - for i in ${UTIL_LINUX_LIBC[@]}; do
2991 - use ${i} && uuid_config="--with-uuid=e2fs"
2992 - done
2993 - for i in ${BSD_LIBC[@]}; do
2994 - use ${i} && uuid_config="--with-uuid=bsd"
2995 - done
2996 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
2997 - fi
2998 -
2999 - econf \
3000 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
3001 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
3002 - --docdir="${PO}/usr/share/doc/${PF}" \
3003 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
3004 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
3005 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
3006 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
3007 - $(use_enable !pg_legacytimestamp integer-datetimes) \
3008 - $(use_enable threads thread-safety) \
3009 - $(use_with kerberos gssapi) \
3010 - $(use_with ldap) \
3011 - $(use_with pam) \
3012 - $(use_with perl) \
3013 - $(use_with python) \
3014 - $(use_with readline) \
3015 - $(use_with ssl openssl) \
3016 - $(use_with tcl) \
3017 - ${uuid_config} \
3018 - $(use_with xml libxml) \
3019 - $(use_with xml libxslt) \
3020 - $(use_with zlib) \
3021 - "$(use_enable nls nls "$(wanted_languages)")"
3022 -}
3023 -
3024 -src_compile() {
3025 - emake
3026 - emake -C contrib
3027 -}
3028 -
3029 -src_install() {
3030 - emake DESTDIR="${D}" install
3031 - emake DESTDIR="${D}" install -C contrib
3032 -
3033 - dodoc README HISTORY doc/{TODO,bug.template}
3034 -
3035 - # man pages are already built, but if we have the target make them,
3036 - # they'll be generated from source before being installed so we
3037 - # manually install man pages.
3038 - # We use ${SLOT} instead of doman for postgresql.eselect
3039 - insinto /usr/share/postgresql-${SLOT}/man/
3040 - doins -r doc/src/sgml/man{1,3,7}
3041 - if ! use server; then
3042 - # Remove man pages for non-existent binaries
3043 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
3044 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
3045 - done
3046 - fi
3047 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
3048 -
3049 - # Create slot specific man pages
3050 - local bn f mansec slotted_name
3051 - for mansec in 1 3 7 ; do
3052 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
3053 -
3054 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
3055 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
3056 -
3057 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
3058 - bn=$(basename "${f}")
3059 - slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
3060 - case ${bn} in
3061 - TABLE.7|WITH.7)
3062 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
3063 - ;;
3064 - *)
3065 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
3066 - ;;
3067 - esac
3068 - done
3069 -
3070 - popd > /dev/null
3071 - done
3072 -
3073 - insinto /etc/postgresql-${SLOT}
3074 - newins src/bin/psql/psqlrc.sample psqlrc
3075 -
3076 - use static-libs || find "${ED}" -name '*.a' -delete
3077 -
3078 - local f bn
3079 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
3080 - -mindepth 1 -maxdepth 1)
3081 - do
3082 - bn=$(basename "${f}")
3083 - # Temporarily tack on tmp to workaround a file collision
3084 - # issue. This is only necessary for 9.7 and earlier. 10 never
3085 - # had this issue.
3086 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
3087 - "/usr/bin/${bn}${SLOT/.}tmp"
3088 - done
3089 -
3090 - if use doc ; then
3091 - docinto html
3092 - dodoc doc/src/sgml/html/*
3093 -
3094 - docinto sgml
3095 - dodoc doc/src/sgml/*.{sgml,dsl}
3096 - fi
3097 -
3098 - if use server; then
3099 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
3100 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
3101 -
3102 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
3103 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
3104 -
3105 - if use systemd; then
3106 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
3107 - "${FILESDIR}/${PN}.service-9.2" | \
3108 - systemd_newunit - ${PN}-${SLOT}.service
3109 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
3110 - fi
3111 -
3112 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
3113 -
3114 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
3115 -
3116 - if use prefix ; then
3117 - keepdir /run/postgresql
3118 - fperms 1775 /run/postgresql
3119 - fi
3120 - fi
3121 -}
3122 -
3123 -pkg_preinst() {
3124 - # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
3125 - # /usr/bin/psql96). They may have been created by the
3126 - # postgresql.eselect module, but they're handled within this ebuild
3127 - # now. It's alright if we momentarily delete /usr/bin/psql as it
3128 - # will be recreated by the eselect module in pkg_ppostinst(). This
3129 - # is only necessary for 9.7 and earlier. 10 and later were never
3130 - # handled in this manner.
3131 - local canonicalise
3132 - if type -p realpath > /dev/null; then
3133 - canonicalise=realpath
3134 - elif type -p readlink > /dev/null; then
3135 - canonicalise='readlink -f'
3136 - else
3137 - # can't die, subshell
3138 - die "No readlink nor realpath found, cannot canonicalise"
3139 - fi
3140 -
3141 - local l
3142 - # First remove any symlinks in /usr/bin that may have been created
3143 - # by the old eselect
3144 - for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
3145 - if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
3146 - rm "${l}" || ewarn "Couldn't remove ${l}"
3147 - fi
3148 - done
3149 -
3150 - # Then move the symlinks created by the ebuild to their proper place.
3151 - for l in "${ED}"/usr/bin/*tmp ; do
3152 - mv "${l}" "${l%tmp}" \
3153 - || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
3154 - done
3155 -}
3156 -
3157 -pkg_postinst() {
3158 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
3159 - postgresql-config update
3160 -
3161 - elog "If you need a global psqlrc-file, you can place it in:"
3162 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
3163 -
3164 - if use server ; then
3165 - elog
3166 - elog "Gentoo specific documentation:"
3167 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
3168 - elog
3169 - elog "Official documentation:"
3170 - elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
3171 - elog
3172 - elog "The default location of the Unix-domain socket is:"
3173 - elog " ${EROOT%/}/run/postgresql/"
3174 - elog
3175 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
3176 - elog "so that it contains your preferred locale in:"
3177 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
3178 - elog
3179 - elog "Then, execute the following command to setup the initial database"
3180 - elog "environment:"
3181 - elog " emerge --config =${CATEGORY}/${PF}"
3182 - fi
3183 -}
3184 -
3185 -pkg_prerm() {
3186 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
3187 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
3188 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
3189 -
3190 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
3191 - sleep 10
3192 - eend 0
3193 - fi
3194 -}
3195 -
3196 -pkg_postrm() {
3197 - postgresql-config update
3198 -}
3199 -
3200 -pkg_config() {
3201 - use server || die "USE flag 'server' not enabled. Nothing to configure."
3202 -
3203 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
3204 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
3205 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
3206 - [[ -z "${DATA_DIR}" ]] \
3207 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
3208 -
3209 - # environment.bz2 may not contain the same locale as the current system
3210 - # locale. Unset and source from the current system locale.
3211 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
3212 - unset LANG
3213 - unset LC_CTYPE
3214 - unset LC_NUMERIC
3215 - unset LC_TIME
3216 - unset LC_COLLATE
3217 - unset LC_MONETARY
3218 - unset LC_MESSAGES
3219 - unset LC_ALL
3220 - source "${EROOT%/}/etc/env.d/02locale"
3221 - [ -n "${LANG}" ] && export LANG
3222 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
3223 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
3224 - [ -n "${LC_TIME}" ] && export LC_TIME
3225 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
3226 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
3227 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
3228 - [ -n "${LC_ALL}" ] && export LC_ALL
3229 - fi
3230 -
3231 - einfo "You can modify the paths and options passed to initdb by editing:"
3232 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
3233 - einfo
3234 - einfo "Information on options that can be passed to initdb are found at:"
3235 - einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
3236 - einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
3237 - einfo
3238 - einfo "PG_INITDB_OPTS is currently set to:"
3239 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
3240 - einfo " (none)"
3241 - else
3242 - einfo " ${PG_INITDB_OPTS}"
3243 - fi
3244 - einfo
3245 - einfo "Configuration files will be installed to:"
3246 - einfo " ${PGDATA}"
3247 - einfo
3248 - einfo "The database cluster will be created in:"
3249 - einfo " ${DATA_DIR}"
3250 - einfo
3251 -
3252 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
3253 - sleep 5
3254 - eend 0
3255 -
3256 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
3257 - eerror "The given directory, '${DATA_DIR}', is not empty."
3258 - eerror "Modify DATA_DIR to point to an empty directory."
3259 - die "${DATA_DIR} is not empty."
3260 - fi
3261 -
3262 - einfo "Creating the data directory ..."
3263 - if [[ ${EUID} == 0 ]] ; then
3264 - mkdir -p "${DATA_DIR}"
3265 - chown -Rf postgres:postgres "${DATA_DIR}"
3266 - chmod 0700 "${DATA_DIR}"
3267 - fi
3268 -
3269 - einfo "Initializing the database ..."
3270 -
3271 - if [[ ${EUID} == 0 ]] ; then
3272 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
3273 - else
3274 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
3275 - fi
3276 -
3277 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
3278 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
3279 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
3280 - fi
3281 -
3282 - # unix_socket_directory has no effect in postgresql.conf as it's
3283 - # overridden in the initscript
3284 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
3285 -
3286 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
3287 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
3288 - # On the off-chance that you might need to work with UTF-8 encoded
3289 - # characters in PL/Perl
3290 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
3291 - EOF
3292 -
3293 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
3294 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
3295 - einfo "by default. You can disable it in the cluster's:"
3296 - einfo " ${PGDATA%/}/postgresql.conf"
3297 - einfo
3298 - einfo "The PostgreSQL server, by default, will log events to:"
3299 - einfo " ${DATA_DIR%/}/postmaster.log"
3300 - einfo
3301 - if use prefix ; then
3302 - einfo "The location of the configuration files have moved to:"
3303 - einfo " ${PGDATA}"
3304 - einfo "To start the server:"
3305 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
3306 - einfo "To stop:"
3307 - einfo " pg_ctl stop -D ${DATA_DIR}"
3308 - einfo
3309 - einfo "Or move the configuration files back:"
3310 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
3311 - else
3312 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
3313 - einfo "instead of 'pg_ctl'."
3314 - fi
3315 -}
3316 -
3317 -src_test() {
3318 - if use server && [[ ${UID} -ne 0 ]] ; then
3319 - emake check
3320 -
3321 - einfo "If you think other tests besides the regression tests are necessary, please"
3322 - einfo "submit a bug including a patch for this ebuild to enable them."
3323 - else
3324 - use server || \
3325 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
3326 - [[ ${UID} -eq 0 ]] || \
3327 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
3328 -
3329 - ewarn 'Skipping.'
3330 - fi
3331 -}
3332
3333 diff --git a/dev-db/postgresql/postgresql-9.5.12.ebuild b/dev-db/postgresql/postgresql-9.5.12.ebuild
3334 deleted file mode 100644
3335 index 003f5398f4e..00000000000
3336 --- a/dev-db/postgresql/postgresql-9.5.12.ebuild
3337 +++ /dev/null
3338 @@ -1,488 +0,0 @@
3339 -# Copyright 1999-2018 Gentoo Foundation
3340 -# Distributed under the terms of the GNU General Public License v2
3341 -
3342 -EAPI="6"
3343 -
3344 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
3345 -
3346 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
3347 - systemd user versionator
3348 -
3349 -KEYWORDS="alpha amd64 arm ~arm64 ~hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
3350 -
3351 -SLOT="$(get_version_component_range 1-2)"
3352 -
3353 -SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
3354 -
3355 -LICENSE="POSTGRESQL GPL-2"
3356 -DESCRIPTION="PostgreSQL RDBMS"
3357 -HOMEPAGE="https://www.postgresql.org/"
3358 -
3359 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
3360 - +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
3361 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
3362 -
3363 -wanted_languages() {
3364 - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru
3365 - sk sl sv tr zh_CN zh_TW"
3366 - local enable_langs lingua
3367 -
3368 - for lingua in ${linguas} ; do
3369 - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
3370 - done
3371 -
3372 - echo -n ${enable_langs}
3373 -}
3374 -
3375 -CDEPEND="
3376 ->=app-eselect/eselect-postgresql-2.0
3377 -sys-apps/less
3378 -virtual/libintl
3379 -kerberos? ( virtual/krb5 )
3380 -ldap? ( net-nds/openldap )
3381 -pam? ( virtual/pam )
3382 -perl? ( >=dev-lang/perl-5.8:= )
3383 -python? ( ${PYTHON_DEPS} )
3384 -readline? ( sys-libs/readline:0= )
3385 -ssl? (
3386 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
3387 - libressl? ( dev-libs/libressl:= )
3388 -)
3389 -tcl? ( >=dev-lang/tcl-8:0= )
3390 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
3391 -zlib? ( sys-libs/zlib )
3392 -"
3393 -
3394 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
3395 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
3396 -# the libc includes UUID functions.
3397 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
3398 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
3399 -
3400 -nest_usedep() {
3401 - local front back
3402 - while [[ ${#} -gt 1 ]]; do
3403 - front+="${1}? ( "
3404 - back+=" )"
3405 - shift
3406 - done
3407 - echo "${front}${1}${back}"
3408 -}
3409 -
3410 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
3411 -CDEPEND+="
3412 -uuid? (
3413 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
3414 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
3415 -)"
3416 -
3417 -DEPEND="${CDEPEND}
3418 -!!<sys-apps/sandbox-2.0
3419 -sys-devel/bison
3420 -sys-devel/flex
3421 -nls? ( sys-devel/gettext )
3422 -xml? ( virtual/pkgconfig )
3423 -"
3424 -
3425 -RDEPEND="${CDEPEND}
3426 -!dev-db/postgresql-docs:${SLOT}
3427 -!dev-db/postgresql-base:${SLOT}
3428 -!dev-db/postgresql-server:${SLOT}
3429 -selinux? ( sec-policy/selinux-postgresql )
3430 -"
3431 -
3432 -pkg_setup() {
3433 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
3434 -
3435 - enewgroup postgres 70
3436 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
3437 -
3438 - use python && python-single-r1_pkg_setup
3439 -}
3440 -
3441 -src_prepare() {
3442 - # Work around PPC{,64} compilation bug where bool is already defined
3443 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
3444 -
3445 - # Set proper run directory
3446 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
3447 - -i src/include/pg_config_manual.h || die
3448 -
3449 - # Rely on $PATH being in the proper order so that the correct
3450 - # install program is used for modules utilizing PGXS in both
3451 - # hardened and non-hardened environments. (Bug #528786)
3452 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
3453 -
3454 - use server || eapply "${FILESDIR}/${PN}-9.5.5-no-server.patch"
3455 -
3456 - if use pam ; then
3457 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
3458 - -i src/backend/libpq/auth.c || \
3459 - die 'PGSQL_PAM_SERVICE rename failed.'
3460 - fi
3461 -
3462 - eapply_user
3463 -}
3464 -
3465 -src_configure() {
3466 - case ${CHOST} in
3467 - *-darwin*|*-solaris*)
3468 - use nls && append-libs intl
3469 - ;;
3470 - esac
3471 -
3472 - export LDFLAGS_SL="${LDFLAGS}"
3473 - export LDFLAGS_EX="${LDFLAGS}"
3474 -
3475 - local PO="${EPREFIX%/}"
3476 -
3477 - local i uuid_config=""
3478 - if use uuid; then
3479 - for i in ${UTIL_LINUX_LIBC[@]}; do
3480 - use ${i} && uuid_config="--with-uuid=e2fs"
3481 - done
3482 - for i in ${BSD_LIBC[@]}; do
3483 - use ${i} && uuid_config="--with-uuid=bsd"
3484 - done
3485 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
3486 - fi
3487 -
3488 - econf \
3489 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
3490 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
3491 - --docdir="${PO}/usr/share/doc/${PF}" \
3492 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
3493 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
3494 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
3495 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
3496 - $(use_enable !alpha spinlocks) \
3497 - $(use_enable !pg_legacytimestamp integer-datetimes) \
3498 - $(use_enable threads thread-safety) \
3499 - $(use_with kerberos gssapi) \
3500 - $(use_with ldap) \
3501 - $(use_with pam) \
3502 - $(use_with perl) \
3503 - $(use_with python) \
3504 - $(use_with readline) \
3505 - $(use_with ssl openssl) \
3506 - $(use_with tcl) \
3507 - ${uuid_config} \
3508 - $(use_with xml libxml) \
3509 - $(use_with xml libxslt) \
3510 - $(use_with zlib) \
3511 - "$(use_enable nls nls "$(wanted_languages)")"
3512 -}
3513 -
3514 -src_compile() {
3515 - emake
3516 - emake -C contrib
3517 -}
3518 -
3519 -src_install() {
3520 - emake DESTDIR="${D}" install
3521 - emake DESTDIR="${D}" install -C contrib
3522 -
3523 - dodoc README HISTORY doc/{TODO,bug.template}
3524 -
3525 - # man pages are already built, but if we have the target make them,
3526 - # they'll be generated from source before being installed so we
3527 - # manually install man pages.
3528 - # We use ${SLOT} instead of doman for postgresql.eselect
3529 - insinto /usr/share/postgresql-${SLOT}/man/
3530 - doins -r doc/src/sgml/man{1,3,7}
3531 - if ! use server; then
3532 - # Remove man pages for non-existent binaries
3533 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
3534 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
3535 - done
3536 - fi
3537 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
3538 -
3539 - # Create slot specific man pages
3540 - local bn f mansec slotted_name
3541 - for mansec in 1 3 7 ; do
3542 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
3543 -
3544 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
3545 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
3546 -
3547 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
3548 - bn=$(basename "${f}")
3549 - slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
3550 - case ${bn} in
3551 - TABLE.7|WITH.7)
3552 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
3553 - ;;
3554 - *)
3555 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
3556 - ;;
3557 - esac
3558 - done
3559 -
3560 - popd > /dev/null
3561 - done
3562 -
3563 - insinto /etc/postgresql-${SLOT}
3564 - newins src/bin/psql/psqlrc.sample psqlrc
3565 -
3566 - use static-libs || find "${ED}" -name '*.a' -delete
3567 -
3568 - local f bn
3569 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
3570 - -mindepth 1 -maxdepth 1)
3571 - do
3572 - bn=$(basename "${f}")
3573 - # Temporarily tack on tmp to workaround a file collision
3574 - # issue. This is only necessary for 9.7 and earlier. 10 never
3575 - # had this issue.
3576 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
3577 - "/usr/bin/${bn}${SLOT/.}tmp"
3578 - done
3579 -
3580 - if use doc ; then
3581 - docinto html
3582 - dodoc doc/src/sgml/html/*
3583 -
3584 - docinto sgml
3585 - dodoc doc/src/sgml/*.{sgml,dsl}
3586 - fi
3587 -
3588 - if use server; then
3589 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
3590 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
3591 -
3592 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
3593 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
3594 -
3595 - if use systemd; then
3596 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
3597 - "${FILESDIR}/${PN}.service-9.2" | \
3598 - systemd_newunit - ${PN}-${SLOT}.service
3599 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
3600 - fi
3601 -
3602 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
3603 -
3604 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
3605 -
3606 - if use prefix ; then
3607 - keepdir /run/postgresql
3608 - fperms 1775 /run/postgresql
3609 - fi
3610 - fi
3611 -}
3612 -
3613 -pkg_preinst() {
3614 - # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
3615 - # /usr/bin/psql96). They may have been created by the
3616 - # postgresql.eselect module, but they're handled within this ebuild
3617 - # now. It's alright if we momentarily delete /usr/bin/psql as it
3618 - # will be recreated by the eselect module in pkg_ppostinst(). This
3619 - # is only necessary for 9.7 and earlier. 10 and later were never
3620 - # handled in this manner.
3621 - local canonicalise
3622 - if type -p realpath > /dev/null; then
3623 - canonicalise=realpath
3624 - elif type -p readlink > /dev/null; then
3625 - canonicalise='readlink -f'
3626 - else
3627 - # can't die, subshell
3628 - die "No readlink nor realpath found, cannot canonicalise"
3629 - fi
3630 -
3631 - local l
3632 - # First remove any symlinks in /usr/bin that may have been created
3633 - # by the old eselect
3634 - for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
3635 - if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
3636 - rm "${l}" || ewarn "Couldn't remove ${l}"
3637 - fi
3638 - done
3639 -
3640 - # Then move the symlinks created by the ebuild to their proper place.
3641 - for l in "${ED}"/usr/bin/*tmp ; do
3642 - mv "${l}" "${l%tmp}" \
3643 - || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
3644 - done
3645 -}
3646 -
3647 -pkg_postinst() {
3648 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
3649 - postgresql-config update
3650 -
3651 - if use alpha && use server ; then
3652 - ewarn "PostgreSQL 9.5+ no longer has native spinlock support on Alpha platforms."
3653 - ewarn "As a result, performance will be extremely degraded."
3654 - fi
3655 -
3656 - elog "If you need a global psqlrc-file, you can place it in:"
3657 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
3658 -
3659 - if use server ; then
3660 - elog
3661 - elog "Gentoo specific documentation:"
3662 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
3663 - elog
3664 - elog "Official documentation:"
3665 - elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
3666 - elog
3667 - elog "The default location of the Unix-domain socket is:"
3668 - elog " ${EROOT%/}/run/postgresql/"
3669 - elog
3670 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
3671 - elog "so that it contains your preferred locale in:"
3672 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
3673 - elog
3674 - elog "Then, execute the following command to setup the initial database"
3675 - elog "environment:"
3676 - elog " emerge --config =${CATEGORY}/${PF}"
3677 - fi
3678 -}
3679 -
3680 -pkg_prerm() {
3681 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
3682 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
3683 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
3684 -
3685 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
3686 - sleep 10
3687 - eend 0
3688 - fi
3689 -}
3690 -
3691 -pkg_postrm() {
3692 - postgresql-config update
3693 -}
3694 -
3695 -pkg_config() {
3696 - use server || die "USE flag 'server' not enabled. Nothing to configure."
3697 -
3698 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
3699 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
3700 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
3701 - [[ -z "${DATA_DIR}" ]] \
3702 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
3703 -
3704 - # environment.bz2 may not contain the same locale as the current system
3705 - # locale. Unset and source from the current system locale.
3706 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
3707 - unset LANG
3708 - unset LC_CTYPE
3709 - unset LC_NUMERIC
3710 - unset LC_TIME
3711 - unset LC_COLLATE
3712 - unset LC_MONETARY
3713 - unset LC_MESSAGES
3714 - unset LC_ALL
3715 - source "${EROOT%/}/etc/env.d/02locale"
3716 - [ -n "${LANG}" ] && export LANG
3717 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
3718 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
3719 - [ -n "${LC_TIME}" ] && export LC_TIME
3720 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
3721 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
3722 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
3723 - [ -n "${LC_ALL}" ] && export LC_ALL
3724 - fi
3725 -
3726 - einfo "You can modify the paths and options passed to initdb by editing:"
3727 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
3728 - einfo
3729 - einfo "Information on options that can be passed to initdb are found at:"
3730 - einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
3731 - einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
3732 - einfo
3733 - einfo "PG_INITDB_OPTS is currently set to:"
3734 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
3735 - einfo " (none)"
3736 - else
3737 - einfo " ${PG_INITDB_OPTS}"
3738 - fi
3739 - einfo
3740 - einfo "Configuration files will be installed to:"
3741 - einfo " ${PGDATA}"
3742 - einfo
3743 - einfo "The database cluster will be created in:"
3744 - einfo " ${DATA_DIR}"
3745 - einfo
3746 -
3747 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
3748 - sleep 5
3749 - eend 0
3750 -
3751 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
3752 - eerror "The given directory, '${DATA_DIR}', is not empty."
3753 - eerror "Modify DATA_DIR to point to an empty directory."
3754 - die "${DATA_DIR} is not empty."
3755 - fi
3756 -
3757 - einfo "Creating the data directory ..."
3758 - if [[ ${EUID} == 0 ]] ; then
3759 - mkdir -p "${DATA_DIR}"
3760 - chown -Rf postgres:postgres "${DATA_DIR}"
3761 - chmod 0700 "${DATA_DIR}"
3762 - fi
3763 -
3764 - einfo "Initializing the database ..."
3765 -
3766 - if [[ ${EUID} == 0 ]] ; then
3767 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
3768 - else
3769 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
3770 - fi
3771 -
3772 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
3773 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
3774 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
3775 - fi
3776 -
3777 - # unix_socket_directory has no effect in postgresql.conf as it's
3778 - # overridden in the initscript
3779 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
3780 -
3781 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
3782 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
3783 - # On the off-chance that you might need to work with UTF-8 encoded
3784 - # characters in PL/Perl
3785 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
3786 - EOF
3787 -
3788 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
3789 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
3790 - einfo "by default. You can disable it in the cluster's:"
3791 - einfo " ${PGDATA%/}/postgresql.conf"
3792 - einfo
3793 - einfo "The PostgreSQL server, by default, will log events to:"
3794 - einfo " ${DATA_DIR%/}/postmaster.log"
3795 - einfo
3796 - if use prefix ; then
3797 - einfo "The location of the configuration files have moved to:"
3798 - einfo " ${PGDATA}"
3799 - einfo "To start the server:"
3800 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
3801 - einfo "To stop:"
3802 - einfo " pg_ctl stop -D ${DATA_DIR}"
3803 - einfo
3804 - einfo "Or move the configuration files back:"
3805 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
3806 - else
3807 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
3808 - einfo "instead of 'pg_ctl'."
3809 - fi
3810 -}
3811 -
3812 -src_test() {
3813 - if use server && [[ ${UID} -ne 0 ]] ; then
3814 - emake check
3815 -
3816 - einfo "If you think other tests besides the regression tests are necessary, please"
3817 - einfo "submit a bug including a patch for this ebuild to enable them."
3818 - else
3819 - use server || \
3820 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
3821 - [[ ${UID} -eq 0 ]] || \
3822 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
3823 -
3824 - ewarn 'Skipping.'
3825 - fi
3826 -}
3827
3828 diff --git a/dev-db/postgresql/postgresql-9.5.13.ebuild b/dev-db/postgresql/postgresql-9.5.13.ebuild
3829 deleted file mode 100644
3830 index fd41b7ff330..00000000000
3831 --- a/dev-db/postgresql/postgresql-9.5.13.ebuild
3832 +++ /dev/null
3833 @@ -1,488 +0,0 @@
3834 -# Copyright 1999-2018 Gentoo Foundation
3835 -# Distributed under the terms of the GNU General Public License v2
3836 -
3837 -EAPI="6"
3838 -
3839 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
3840 -
3841 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
3842 - systemd user versionator
3843 -
3844 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
3845 -
3846 -SLOT="$(get_version_component_range 1-2)"
3847 -
3848 -SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2"
3849 -
3850 -LICENSE="POSTGRESQL GPL-2"
3851 -DESCRIPTION="PostgreSQL RDBMS"
3852 -HOMEPAGE="https://www.postgresql.org/"
3853 -
3854 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
3855 - +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
3856 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
3857 -
3858 -wanted_languages() {
3859 - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru
3860 - sk sl sv tr zh_CN zh_TW"
3861 - local enable_langs lingua
3862 -
3863 - for lingua in ${linguas} ; do
3864 - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
3865 - done
3866 -
3867 - echo -n ${enable_langs}
3868 -}
3869 -
3870 -CDEPEND="
3871 ->=app-eselect/eselect-postgresql-2.0
3872 -sys-apps/less
3873 -virtual/libintl
3874 -kerberos? ( virtual/krb5 )
3875 -ldap? ( net-nds/openldap )
3876 -pam? ( virtual/pam )
3877 -perl? ( >=dev-lang/perl-5.8:= )
3878 -python? ( ${PYTHON_DEPS} )
3879 -readline? ( sys-libs/readline:0= )
3880 -ssl? (
3881 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
3882 - libressl? ( dev-libs/libressl:= )
3883 -)
3884 -tcl? ( >=dev-lang/tcl-8:0= )
3885 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
3886 -zlib? ( sys-libs/zlib )
3887 -"
3888 -
3889 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
3890 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
3891 -# the libc includes UUID functions.
3892 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
3893 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
3894 -
3895 -nest_usedep() {
3896 - local front back
3897 - while [[ ${#} -gt 1 ]]; do
3898 - front+="${1}? ( "
3899 - back+=" )"
3900 - shift
3901 - done
3902 - echo "${front}${1}${back}"
3903 -}
3904 -
3905 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
3906 -CDEPEND+="
3907 -uuid? (
3908 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
3909 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
3910 -)"
3911 -
3912 -DEPEND="${CDEPEND}
3913 -!!<sys-apps/sandbox-2.0
3914 -sys-devel/bison
3915 -sys-devel/flex
3916 -nls? ( sys-devel/gettext )
3917 -xml? ( virtual/pkgconfig )
3918 -"
3919 -
3920 -RDEPEND="${CDEPEND}
3921 -!dev-db/postgresql-docs:${SLOT}
3922 -!dev-db/postgresql-base:${SLOT}
3923 -!dev-db/postgresql-server:${SLOT}
3924 -selinux? ( sec-policy/selinux-postgresql )
3925 -"
3926 -
3927 -pkg_setup() {
3928 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
3929 -
3930 - enewgroup postgres 70
3931 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
3932 -
3933 - use python && python-single-r1_pkg_setup
3934 -}
3935 -
3936 -src_prepare() {
3937 - # Work around PPC{,64} compilation bug where bool is already defined
3938 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
3939 -
3940 - # Set proper run directory
3941 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
3942 - -i src/include/pg_config_manual.h || die
3943 -
3944 - # Rely on $PATH being in the proper order so that the correct
3945 - # install program is used for modules utilizing PGXS in both
3946 - # hardened and non-hardened environments. (Bug #528786)
3947 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
3948 -
3949 - use server || eapply "${FILESDIR}/${PN}-9.5.5-no-server.patch"
3950 -
3951 - if use pam ; then
3952 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
3953 - -i src/backend/libpq/auth.c || \
3954 - die 'PGSQL_PAM_SERVICE rename failed.'
3955 - fi
3956 -
3957 - eapply_user
3958 -}
3959 -
3960 -src_configure() {
3961 - case ${CHOST} in
3962 - *-darwin*|*-solaris*)
3963 - use nls && append-libs intl
3964 - ;;
3965 - esac
3966 -
3967 - export LDFLAGS_SL="${LDFLAGS}"
3968 - export LDFLAGS_EX="${LDFLAGS}"
3969 -
3970 - local PO="${EPREFIX%/}"
3971 -
3972 - local i uuid_config=""
3973 - if use uuid; then
3974 - for i in ${UTIL_LINUX_LIBC[@]}; do
3975 - use ${i} && uuid_config="--with-uuid=e2fs"
3976 - done
3977 - for i in ${BSD_LIBC[@]}; do
3978 - use ${i} && uuid_config="--with-uuid=bsd"
3979 - done
3980 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
3981 - fi
3982 -
3983 - econf \
3984 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
3985 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
3986 - --docdir="${PO}/usr/share/doc/${PF}" \
3987 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
3988 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
3989 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
3990 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
3991 - $(use_enable !alpha spinlocks) \
3992 - $(use_enable !pg_legacytimestamp integer-datetimes) \
3993 - $(use_enable threads thread-safety) \
3994 - $(use_with kerberos gssapi) \
3995 - $(use_with ldap) \
3996 - $(use_with pam) \
3997 - $(use_with perl) \
3998 - $(use_with python) \
3999 - $(use_with readline) \
4000 - $(use_with ssl openssl) \
4001 - $(use_with tcl) \
4002 - ${uuid_config} \
4003 - $(use_with xml libxml) \
4004 - $(use_with xml libxslt) \
4005 - $(use_with zlib) \
4006 - "$(use_enable nls nls "$(wanted_languages)")"
4007 -}
4008 -
4009 -src_compile() {
4010 - emake
4011 - emake -C contrib
4012 -}
4013 -
4014 -src_install() {
4015 - emake DESTDIR="${D}" install
4016 - emake DESTDIR="${D}" install -C contrib
4017 -
4018 - dodoc README HISTORY doc/{TODO,bug.template}
4019 -
4020 - # man pages are already built, but if we have the target make them,
4021 - # they'll be generated from source before being installed so we
4022 - # manually install man pages.
4023 - # We use ${SLOT} instead of doman for postgresql.eselect
4024 - insinto /usr/share/postgresql-${SLOT}/man/
4025 - doins -r doc/src/sgml/man{1,3,7}
4026 - if ! use server; then
4027 - # Remove man pages for non-existent binaries
4028 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
4029 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
4030 - done
4031 - fi
4032 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
4033 -
4034 - # Create slot specific man pages
4035 - local bn f mansec slotted_name
4036 - for mansec in 1 3 7 ; do
4037 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
4038 -
4039 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
4040 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
4041 -
4042 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
4043 - bn=$(basename "${f}")
4044 - slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
4045 - case ${bn} in
4046 - TABLE.7|WITH.7)
4047 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
4048 - ;;
4049 - *)
4050 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
4051 - ;;
4052 - esac
4053 - done
4054 -
4055 - popd > /dev/null
4056 - done
4057 -
4058 - insinto /etc/postgresql-${SLOT}
4059 - newins src/bin/psql/psqlrc.sample psqlrc
4060 -
4061 - use static-libs || find "${ED}" -name '*.a' -delete
4062 -
4063 - local f bn
4064 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
4065 - -mindepth 1 -maxdepth 1)
4066 - do
4067 - bn=$(basename "${f}")
4068 - # Temporarily tack on tmp to workaround a file collision
4069 - # issue. This is only necessary for 9.7 and earlier. 10 never
4070 - # had this issue.
4071 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
4072 - "/usr/bin/${bn}${SLOT/.}tmp"
4073 - done
4074 -
4075 - if use doc ; then
4076 - docinto html
4077 - dodoc doc/src/sgml/html/*
4078 -
4079 - docinto sgml
4080 - dodoc doc/src/sgml/*.{sgml,dsl}
4081 - fi
4082 -
4083 - if use server; then
4084 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
4085 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
4086 -
4087 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
4088 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
4089 -
4090 - if use systemd; then
4091 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
4092 - "${FILESDIR}/${PN}.service-9.2" | \
4093 - systemd_newunit - ${PN}-${SLOT}.service
4094 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
4095 - fi
4096 -
4097 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
4098 -
4099 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
4100 -
4101 - if use prefix ; then
4102 - keepdir /run/postgresql
4103 - fperms 1775 /run/postgresql
4104 - fi
4105 - fi
4106 -}
4107 -
4108 -pkg_preinst() {
4109 - # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
4110 - # /usr/bin/psql96). They may have been created by the
4111 - # postgresql.eselect module, but they're handled within this ebuild
4112 - # now. It's alright if we momentarily delete /usr/bin/psql as it
4113 - # will be recreated by the eselect module in pkg_ppostinst(). This
4114 - # is only necessary for 9.7 and earlier. 10 and later were never
4115 - # handled in this manner.
4116 - local canonicalise
4117 - if type -p realpath > /dev/null; then
4118 - canonicalise=realpath
4119 - elif type -p readlink > /dev/null; then
4120 - canonicalise='readlink -f'
4121 - else
4122 - # can't die, subshell
4123 - die "No readlink nor realpath found, cannot canonicalise"
4124 - fi
4125 -
4126 - local l
4127 - # First remove any symlinks in /usr/bin that may have been created
4128 - # by the old eselect
4129 - for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
4130 - if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
4131 - rm "${l}" || ewarn "Couldn't remove ${l}"
4132 - fi
4133 - done
4134 -
4135 - # Then move the symlinks created by the ebuild to their proper place.
4136 - for l in "${ED}"/usr/bin/*tmp ; do
4137 - mv "${l}" "${l%tmp}" \
4138 - || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
4139 - done
4140 -}
4141 -
4142 -pkg_postinst() {
4143 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
4144 - postgresql-config update
4145 -
4146 - if use alpha && use server ; then
4147 - ewarn "PostgreSQL 9.5+ no longer has native spinlock support on Alpha platforms."
4148 - ewarn "As a result, performance will be extremely degraded."
4149 - fi
4150 -
4151 - elog "If you need a global psqlrc-file, you can place it in:"
4152 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
4153 -
4154 - if use server ; then
4155 - elog
4156 - elog "Gentoo specific documentation:"
4157 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
4158 - elog
4159 - elog "Official documentation:"
4160 - elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
4161 - elog
4162 - elog "The default location of the Unix-domain socket is:"
4163 - elog " ${EROOT%/}/run/postgresql/"
4164 - elog
4165 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
4166 - elog "so that it contains your preferred locale in:"
4167 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
4168 - elog
4169 - elog "Then, execute the following command to setup the initial database"
4170 - elog "environment:"
4171 - elog " emerge --config =${CATEGORY}/${PF}"
4172 - fi
4173 -}
4174 -
4175 -pkg_prerm() {
4176 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
4177 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
4178 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
4179 -
4180 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
4181 - sleep 10
4182 - eend 0
4183 - fi
4184 -}
4185 -
4186 -pkg_postrm() {
4187 - postgresql-config update
4188 -}
4189 -
4190 -pkg_config() {
4191 - use server || die "USE flag 'server' not enabled. Nothing to configure."
4192 -
4193 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
4194 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
4195 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
4196 - [[ -z "${DATA_DIR}" ]] \
4197 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
4198 -
4199 - # environment.bz2 may not contain the same locale as the current system
4200 - # locale. Unset and source from the current system locale.
4201 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
4202 - unset LANG
4203 - unset LC_CTYPE
4204 - unset LC_NUMERIC
4205 - unset LC_TIME
4206 - unset LC_COLLATE
4207 - unset LC_MONETARY
4208 - unset LC_MESSAGES
4209 - unset LC_ALL
4210 - source "${EROOT%/}/etc/env.d/02locale"
4211 - [ -n "${LANG}" ] && export LANG
4212 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
4213 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
4214 - [ -n "${LC_TIME}" ] && export LC_TIME
4215 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
4216 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
4217 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
4218 - [ -n "${LC_ALL}" ] && export LC_ALL
4219 - fi
4220 -
4221 - einfo "You can modify the paths and options passed to initdb by editing:"
4222 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
4223 - einfo
4224 - einfo "Information on options that can be passed to initdb are found at:"
4225 - einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
4226 - einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
4227 - einfo
4228 - einfo "PG_INITDB_OPTS is currently set to:"
4229 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
4230 - einfo " (none)"
4231 - else
4232 - einfo " ${PG_INITDB_OPTS}"
4233 - fi
4234 - einfo
4235 - einfo "Configuration files will be installed to:"
4236 - einfo " ${PGDATA}"
4237 - einfo
4238 - einfo "The database cluster will be created in:"
4239 - einfo " ${DATA_DIR}"
4240 - einfo
4241 -
4242 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
4243 - sleep 5
4244 - eend 0
4245 -
4246 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
4247 - eerror "The given directory, '${DATA_DIR}', is not empty."
4248 - eerror "Modify DATA_DIR to point to an empty directory."
4249 - die "${DATA_DIR} is not empty."
4250 - fi
4251 -
4252 - einfo "Creating the data directory ..."
4253 - if [[ ${EUID} == 0 ]] ; then
4254 - mkdir -p "${DATA_DIR}"
4255 - chown -Rf postgres:postgres "${DATA_DIR}"
4256 - chmod 0700 "${DATA_DIR}"
4257 - fi
4258 -
4259 - einfo "Initializing the database ..."
4260 -
4261 - if [[ ${EUID} == 0 ]] ; then
4262 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
4263 - else
4264 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
4265 - fi
4266 -
4267 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
4268 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
4269 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
4270 - fi
4271 -
4272 - # unix_socket_directory has no effect in postgresql.conf as it's
4273 - # overridden in the initscript
4274 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
4275 -
4276 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
4277 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
4278 - # On the off-chance that you might need to work with UTF-8 encoded
4279 - # characters in PL/Perl
4280 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
4281 - EOF
4282 -
4283 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
4284 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
4285 - einfo "by default. You can disable it in the cluster's:"
4286 - einfo " ${PGDATA%/}/postgresql.conf"
4287 - einfo
4288 - einfo "The PostgreSQL server, by default, will log events to:"
4289 - einfo " ${DATA_DIR%/}/postmaster.log"
4290 - einfo
4291 - if use prefix ; then
4292 - einfo "The location of the configuration files have moved to:"
4293 - einfo " ${PGDATA}"
4294 - einfo "To start the server:"
4295 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
4296 - einfo "To stop:"
4297 - einfo " pg_ctl stop -D ${DATA_DIR}"
4298 - einfo
4299 - einfo "Or move the configuration files back:"
4300 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
4301 - else
4302 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
4303 - einfo "instead of 'pg_ctl'."
4304 - fi
4305 -}
4306 -
4307 -src_test() {
4308 - if use server && [[ ${UID} -ne 0 ]] ; then
4309 - emake check
4310 -
4311 - einfo "If you think other tests besides the regression tests are necessary, please"
4312 - einfo "submit a bug including a patch for this ebuild to enable them."
4313 - else
4314 - use server || \
4315 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
4316 - [[ ${UID} -eq 0 ]] || \
4317 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
4318 -
4319 - ewarn 'Skipping.'
4320 - fi
4321 -}
4322
4323 diff --git a/dev-db/postgresql/postgresql-9.6.8.ebuild b/dev-db/postgresql/postgresql-9.6.8.ebuild
4324 deleted file mode 100644
4325 index c5669d4179f..00000000000
4326 --- a/dev-db/postgresql/postgresql-9.6.8.ebuild
4327 +++ /dev/null
4328 @@ -1,493 +0,0 @@
4329 -# Copyright 1999-2018 Gentoo Foundation
4330 -# Distributed under the terms of the GNU General Public License v2
4331 -
4332 -EAPI="6"
4333 -
4334 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
4335 -
4336 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
4337 - systemd user versionator
4338 -
4339 -KEYWORDS="alpha amd64 arm ~arm64 ~hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
4340 -
4341 -SLOT="$(get_version_component_range 1-2)"
4342 -
4343 -MY_PV=${PV/_/}
4344 -S="${WORKDIR}/${PN}-${MY_PV}"
4345 -
4346 -SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
4347 -
4348 -LICENSE="POSTGRESQL GPL-2"
4349 -DESCRIPTION="PostgreSQL RDBMS"
4350 -HOMEPAGE="https://www.postgresql.org/"
4351 -
4352 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
4353 - +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
4354 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
4355 -
4356 -wanted_languages() {
4357 - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru
4358 - sk sl sv tr zh_CN zh_TW"
4359 - local enable_langs lingua
4360 -
4361 - for lingua in ${linguas} ; do
4362 - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
4363 - done
4364 -
4365 - echo -n ${enable_langs}
4366 -}
4367 -
4368 -CDEPEND="
4369 ->=app-eselect/eselect-postgresql-2.0
4370 -sys-apps/less
4371 -virtual/libintl
4372 -kerberos? ( virtual/krb5 )
4373 -ldap? ( net-nds/openldap )
4374 -pam? ( virtual/pam )
4375 -perl? ( >=dev-lang/perl-5.8:= )
4376 -python? ( ${PYTHON_DEPS} )
4377 -readline? ( sys-libs/readline:0= )
4378 -ssl? (
4379 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
4380 - libressl? ( dev-libs/libressl:= )
4381 -)
4382 -server? ( systemd? ( sys-apps/systemd ) )
4383 -tcl? ( >=dev-lang/tcl-8:0= )
4384 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
4385 -zlib? ( sys-libs/zlib )
4386 -"
4387 -
4388 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
4389 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
4390 -# the libc includes UUID functions.
4391 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
4392 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
4393 -
4394 -nest_usedep() {
4395 - local front back
4396 - while [[ ${#} -gt 1 ]]; do
4397 - front+="${1}? ( "
4398 - back+=" )"
4399 - shift
4400 - done
4401 - echo "${front}${1}${back}"
4402 -}
4403 -
4404 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
4405 -CDEPEND+="
4406 -uuid? (
4407 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
4408 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
4409 -)"
4410 -
4411 -DEPEND="${CDEPEND}
4412 -!!<sys-apps/sandbox-2.0
4413 -sys-devel/bison
4414 -sys-devel/flex
4415 -nls? ( sys-devel/gettext )
4416 -xml? ( virtual/pkgconfig )
4417 -"
4418 -
4419 -RDEPEND="${CDEPEND}
4420 -!dev-db/postgresql-docs:${SLOT}
4421 -!dev-db/postgresql-base:${SLOT}
4422 -!dev-db/postgresql-server:${SLOT}
4423 -selinux? ( sec-policy/selinux-postgresql )
4424 -"
4425 -
4426 -pkg_setup() {
4427 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
4428 -
4429 - enewgroup postgres 70
4430 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
4431 -
4432 - use python && python-single-r1_pkg_setup
4433 -}
4434 -
4435 -src_prepare() {
4436 - # Work around PPC{,64} compilation bug where bool is already defined
4437 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
4438 -
4439 - # Set proper run directory
4440 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
4441 - -i src/include/pg_config_manual.h || die
4442 -
4443 - # Rely on $PATH being in the proper order so that the correct
4444 - # install program is used for modules utilizing PGXS in both
4445 - # hardened and non-hardened environments. (Bug #528786)
4446 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
4447 -
4448 - use server || eapply "${FILESDIR}/${PN}-${SLOT}.3-no-server.patch"
4449 -
4450 - if use pam ; then
4451 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
4452 - -i src/backend/libpq/auth.c || \
4453 - die 'PGSQL_PAM_SERVICE rename failed.'
4454 - fi
4455 -
4456 - eapply_user
4457 -}
4458 -
4459 -src_configure() {
4460 - case ${CHOST} in
4461 - *-darwin*|*-solaris*)
4462 - use nls && append-libs intl
4463 - ;;
4464 - esac
4465 -
4466 - export LDFLAGS_SL="${LDFLAGS}"
4467 - export LDFLAGS_EX="${LDFLAGS}"
4468 -
4469 - local PO="${EPREFIX%/}"
4470 -
4471 - local i uuid_config=""
4472 - if use uuid; then
4473 - for i in ${UTIL_LINUX_LIBC[@]}; do
4474 - use ${i} && uuid_config="--with-uuid=e2fs"
4475 - done
4476 - for i in ${BSD_LIBC[@]}; do
4477 - use ${i} && uuid_config="--with-uuid=bsd"
4478 - done
4479 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
4480 - fi
4481 -
4482 - econf \
4483 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
4484 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
4485 - --docdir="${PO}/usr/share/doc/${PF}" \
4486 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
4487 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
4488 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
4489 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
4490 - $(use_enable !alpha spinlocks) \
4491 - $(use_enable !pg_legacytimestamp integer-datetimes) \
4492 - $(use_enable threads thread-safety) \
4493 - $(use_with kerberos gssapi) \
4494 - $(use_with ldap) \
4495 - $(use_with pam) \
4496 - $(use_with perl) \
4497 - $(use_with python) \
4498 - $(use_with readline) \
4499 - $(use_with ssl openssl) \
4500 - $(usex server "$(use_with systemd)" '--without-systemd') \
4501 - $(use_with tcl) \
4502 - ${uuid_config} \
4503 - $(use_with xml libxml) \
4504 - $(use_with xml libxslt) \
4505 - $(use_with zlib) \
4506 - "$(use_enable nls nls "$(wanted_languages)")"
4507 -}
4508 -
4509 -src_compile() {
4510 - emake
4511 - emake -C contrib
4512 -}
4513 -
4514 -src_install() {
4515 - emake DESTDIR="${D}" install
4516 - emake DESTDIR="${D}" install -C contrib
4517 -
4518 - dodoc README HISTORY doc/{TODO,bug.template}
4519 -
4520 - # man pages are already built, but if we have the target make them,
4521 - # they'll be generated from source before being installed so we
4522 - # manually install man pages.
4523 - # We use ${SLOT} instead of doman for postgresql.eselect
4524 - insinto /usr/share/postgresql-${SLOT}/man/
4525 - doins -r doc/src/sgml/man{1,3,7}
4526 - if ! use server; then
4527 - # Remove man pages for non-existent binaries
4528 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
4529 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
4530 - done
4531 - fi
4532 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
4533 -
4534 - # Create slot specific man pages
4535 - local bn f mansec slotted_name
4536 - for mansec in 1 3 7 ; do
4537 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
4538 -
4539 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
4540 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
4541 -
4542 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
4543 - bn=$(basename "${f}")
4544 - slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
4545 - case ${bn} in
4546 - TABLE.7|WITH.7)
4547 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
4548 - ;;
4549 - *)
4550 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
4551 - ;;
4552 - esac
4553 - done
4554 -
4555 - popd > /dev/null
4556 - done
4557 -
4558 - insinto /etc/postgresql-${SLOT}
4559 - newins src/bin/psql/psqlrc.sample psqlrc
4560 -
4561 - use static-libs || find "${ED}" -name '*.a' -delete
4562 -
4563 - local f bn
4564 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
4565 - -mindepth 1 -maxdepth 1)
4566 - do
4567 - bn=$(basename "${f}")
4568 - # Temporarily tack on tmp to workaround a file collision
4569 - # issue. This is only necessary for 9.7 and earlier. 10 never
4570 - # had this issue.
4571 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
4572 - "/usr/bin/${bn}${SLOT/.}tmp"
4573 - done
4574 -
4575 - if use doc ; then
4576 - docinto html
4577 - dodoc doc/src/sgml/html/*
4578 -
4579 - docinto sgml
4580 - dodoc doc/src/sgml/*.{sgml,dsl}
4581 - fi
4582 -
4583 - if use server; then
4584 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
4585 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
4586 -
4587 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
4588 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
4589 -
4590 - if use systemd; then
4591 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
4592 - "${FILESDIR}/${PN}.service-9.6-r1" | \
4593 - systemd_newunit - ${PN}-${SLOT}.service
4594 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
4595 - fi
4596 -
4597 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
4598 -
4599 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
4600 -
4601 - if use prefix ; then
4602 - keepdir /run/postgresql
4603 - fperms 1775 /run/postgresql
4604 - fi
4605 - fi
4606 -}
4607 -
4608 -pkg_preinst() {
4609 - # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
4610 - # /usr/bin/psql96). They may have been created by the
4611 - # postgresql.eselect module, but they're handled within this ebuild
4612 - # now. It's alright if we momentarily delete /usr/bin/psql as it
4613 - # will be recreated by the eselect module in pkg_ppostinst(). This
4614 - # is only necessary for 9.7 and earlier. 10 and later were never
4615 - # handled in this manner.
4616 - local canonicalise
4617 - if type -p realpath > /dev/null; then
4618 - canonicalise=realpath
4619 - elif type -p readlink > /dev/null; then
4620 - canonicalise='readlink -f'
4621 - else
4622 - # can't die, subshell
4623 - die "No readlink nor realpath found, cannot canonicalise"
4624 - fi
4625 -
4626 - local l
4627 - # First remove any symlinks in /usr/bin that may have been created
4628 - # by the old eselect
4629 - for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
4630 - if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
4631 - rm "${l}" || ewarn "Couldn't remove ${l}"
4632 - fi
4633 - done
4634 -
4635 - # Then move the symlinks created by the ebuild to their proper place.
4636 - for l in "${ED}"/usr/bin/*tmp ; do
4637 - mv "${l}" "${l%tmp}" \
4638 - || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
4639 - done
4640 -}
4641 -
4642 -pkg_postinst() {
4643 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
4644 - postgresql-config update
4645 -
4646 - elog "If you need a global psqlrc-file, you can place it in:"
4647 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
4648 -
4649 - if use server ; then
4650 - elog
4651 - elog "Gentoo specific documentation:"
4652 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
4653 - elog
4654 - elog "Official documentation:"
4655 - elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
4656 - elog
4657 - elog "The default location of the Unix-domain socket is:"
4658 - elog " ${EROOT%/}/run/postgresql/"
4659 - elog
4660 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
4661 - elog "so that it contains your preferred locale in:"
4662 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
4663 - elog
4664 - elog "Then, execute the following command to setup the initial database"
4665 - elog "environment:"
4666 - elog " emerge --config =${CATEGORY}/${PF}"
4667 - fi
4668 -}
4669 -
4670 -pkg_prerm() {
4671 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
4672 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
4673 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
4674 -
4675 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
4676 - sleep 10
4677 - eend 0
4678 - fi
4679 -}
4680 -
4681 -pkg_postrm() {
4682 - postgresql-config update
4683 -}
4684 -
4685 -pkg_config() {
4686 - use server || die "USE flag 'server' not enabled. Nothing to configure."
4687 -
4688 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
4689 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
4690 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
4691 - [[ -z "${DATA_DIR}" ]] \
4692 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
4693 -
4694 - # environment.bz2 may not contain the same locale as the current system
4695 - # locale. Unset and source from the current system locale.
4696 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
4697 - unset LANG
4698 - unset LC_CTYPE
4699 - unset LC_NUMERIC
4700 - unset LC_TIME
4701 - unset LC_COLLATE
4702 - unset LC_MONETARY
4703 - unset LC_MESSAGES
4704 - unset LC_ALL
4705 - source "${EROOT%/}/etc/env.d/02locale"
4706 - [ -n "${LANG}" ] && export LANG
4707 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
4708 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
4709 - [ -n "${LC_TIME}" ] && export LC_TIME
4710 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
4711 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
4712 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
4713 - [ -n "${LC_ALL}" ] && export LC_ALL
4714 - fi
4715 -
4716 - einfo "You can modify the paths and options passed to initdb by editing:"
4717 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
4718 - einfo
4719 - einfo "Information on options that can be passed to initdb are found at:"
4720 - einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
4721 - einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
4722 - einfo
4723 - einfo "PG_INITDB_OPTS is currently set to:"
4724 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
4725 - einfo " (none)"
4726 - else
4727 - einfo " ${PG_INITDB_OPTS}"
4728 - fi
4729 - einfo
4730 - einfo "Configuration files will be installed to:"
4731 - einfo " ${PGDATA}"
4732 - einfo
4733 - einfo "The database cluster will be created in:"
4734 - einfo " ${DATA_DIR}"
4735 - einfo
4736 -
4737 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
4738 - sleep 5
4739 - eend 0
4740 -
4741 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
4742 - eerror "The given directory, '${DATA_DIR}', is not empty."
4743 - eerror "Modify DATA_DIR to point to an empty directory."
4744 - die "${DATA_DIR} is not empty."
4745 - fi
4746 -
4747 - einfo "Creating the data directory ..."
4748 - if [[ ${EUID} == 0 ]] ; then
4749 - mkdir -p "${DATA_DIR}"
4750 - chown -Rf postgres:postgres "${DATA_DIR}"
4751 - chmod 0700 "${DATA_DIR}"
4752 - fi
4753 -
4754 - einfo "Initializing the database ..."
4755 -
4756 - if [[ ${EUID} == 0 ]] ; then
4757 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
4758 - else
4759 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
4760 - fi
4761 -
4762 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
4763 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
4764 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
4765 - fi
4766 -
4767 - # unix_socket_directory has no effect in postgresql.conf as it's
4768 - # overridden in the initscript
4769 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
4770 -
4771 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
4772 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
4773 - # On the off-chance that you might need to work with UTF-8 encoded
4774 - # characters in PL/Perl
4775 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
4776 - EOF
4777 -
4778 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
4779 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
4780 - einfo "by default. You can disable it in the cluster's:"
4781 - einfo " ${PGDATA%/}/postgresql.conf"
4782 - einfo
4783 - if ! use systemd; then
4784 - einfo "The PostgreSQL server, by default, will log events to:"
4785 - einfo " ${DATA_DIR%/}/postmaster.log"
4786 - einfo
4787 - fi
4788 - if use prefix ; then
4789 - einfo "The location of the configuration files have moved to:"
4790 - einfo " ${PGDATA}"
4791 - einfo "To start the server:"
4792 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
4793 - einfo "To stop:"
4794 - einfo " pg_ctl stop -D ${DATA_DIR}"
4795 - einfo
4796 - einfo "Or move the configuration files back:"
4797 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
4798 - elif use systemd; then
4799 - einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
4800 - einfo "instead of 'pg_ctl'."
4801 - else
4802 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
4803 - einfo "instead of 'pg_ctl'."
4804 - fi
4805 -}
4806 -
4807 -src_test() {
4808 - if use server && [[ ${UID} -ne 0 ]] ; then
4809 - emake check
4810 -
4811 - einfo "If you think other tests besides the regression tests are necessary, please"
4812 - einfo "submit a bug including a patch for this ebuild to enable them."
4813 - else
4814 - use server || \
4815 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
4816 - [[ ${UID} -eq 0 ]] || \
4817 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
4818 -
4819 - ewarn 'Skipping.'
4820 - fi
4821 -}
4822
4823 diff --git a/dev-db/postgresql/postgresql-9.6.9.ebuild b/dev-db/postgresql/postgresql-9.6.9.ebuild
4824 deleted file mode 100644
4825 index 1297819d3de..00000000000
4826 --- a/dev-db/postgresql/postgresql-9.6.9.ebuild
4827 +++ /dev/null
4828 @@ -1,493 +0,0 @@
4829 -# Copyright 1999-2018 Gentoo Foundation
4830 -# Distributed under the terms of the GNU General Public License v2
4831 -
4832 -EAPI="6"
4833 -
4834 -PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
4835 -
4836 -inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \
4837 - systemd user versionator
4838 -
4839 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris"
4840 -
4841 -SLOT="$(get_version_component_range 1-2)"
4842 -
4843 -MY_PV=${PV/_/}
4844 -S="${WORKDIR}/${PN}-${MY_PV}"
4845 -
4846 -SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2"
4847 -
4848 -LICENSE="POSTGRESQL GPL-2"
4849 -DESCRIPTION="PostgreSQL RDBMS"
4850 -HOMEPAGE="https://www.postgresql.org/"
4851 -
4852 -IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python
4853 - +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib"
4854 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
4855 -
4856 -wanted_languages() {
4857 - local linguas="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru
4858 - sk sl sv tr zh_CN zh_TW"
4859 - local enable_langs lingua
4860 -
4861 - for lingua in ${linguas} ; do
4862 - has ${lingua} ${LINGUAS-${lingua}} && enable_langs+="${lingua} "
4863 - done
4864 -
4865 - echo -n ${enable_langs}
4866 -}
4867 -
4868 -CDEPEND="
4869 ->=app-eselect/eselect-postgresql-2.0
4870 -sys-apps/less
4871 -virtual/libintl
4872 -kerberos? ( virtual/krb5 )
4873 -ldap? ( net-nds/openldap )
4874 -pam? ( virtual/pam )
4875 -perl? ( >=dev-lang/perl-5.8:= )
4876 -python? ( ${PYTHON_DEPS} )
4877 -readline? ( sys-libs/readline:0= )
4878 -ssl? (
4879 - !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= )
4880 - libressl? ( dev-libs/libressl:= )
4881 -)
4882 -server? ( systemd? ( sys-apps/systemd ) )
4883 -tcl? ( >=dev-lang/tcl-8:0= )
4884 -xml? ( dev-libs/libxml2 dev-libs/libxslt )
4885 -zlib? ( sys-libs/zlib )
4886 -"
4887 -
4888 -# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no
4889 -# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems,
4890 -# the libc includes UUID functions.
4891 -UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} )
4892 -BSD_LIBC=( elibc_{Free,Net,Open}BSD )
4893 -
4894 -nest_usedep() {
4895 - local front back
4896 - while [[ ${#} -gt 1 ]]; do
4897 - front+="${1}? ( "
4898 - back+=" )"
4899 - shift
4900 - done
4901 - echo "${front}${1}${back}"
4902 -}
4903 -
4904 -IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}"
4905 -CDEPEND+="
4906 -uuid? (
4907 - ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )}
4908 - $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid)
4909 -)"
4910 -
4911 -DEPEND="${CDEPEND}
4912 -!!<sys-apps/sandbox-2.0
4913 -sys-devel/bison
4914 -sys-devel/flex
4915 -nls? ( sys-devel/gettext )
4916 -xml? ( virtual/pkgconfig )
4917 -"
4918 -
4919 -RDEPEND="${CDEPEND}
4920 -!dev-db/postgresql-docs:${SLOT}
4921 -!dev-db/postgresql-base:${SLOT}
4922 -!dev-db/postgresql-server:${SLOT}
4923 -selinux? ( sec-policy/selinux-postgresql )
4924 -"
4925 -
4926 -pkg_setup() {
4927 - use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup
4928 -
4929 - enewgroup postgres 70
4930 - enewuser postgres 70 /bin/sh /var/lib/postgresql postgres
4931 -
4932 - use python && python-single-r1_pkg_setup
4933 -}
4934 -
4935 -src_prepare() {
4936 - # Work around PPC{,64} compilation bug where bool is already defined
4937 - sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die
4938 -
4939 - # Set proper run directory
4940 - sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \
4941 - -i src/include/pg_config_manual.h || die
4942 -
4943 - # Rely on $PATH being in the proper order so that the correct
4944 - # install program is used for modules utilizing PGXS in both
4945 - # hardened and non-hardened environments. (Bug #528786)
4946 - sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die
4947 -
4948 - use server || eapply "${FILESDIR}/${PN}-${SLOT}.3-no-server.patch"
4949 -
4950 - if use pam ; then
4951 - sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \
4952 - -i src/backend/libpq/auth.c || \
4953 - die 'PGSQL_PAM_SERVICE rename failed.'
4954 - fi
4955 -
4956 - eapply_user
4957 -}
4958 -
4959 -src_configure() {
4960 - case ${CHOST} in
4961 - *-darwin*|*-solaris*)
4962 - use nls && append-libs intl
4963 - ;;
4964 - esac
4965 -
4966 - export LDFLAGS_SL="${LDFLAGS}"
4967 - export LDFLAGS_EX="${LDFLAGS}"
4968 -
4969 - local PO="${EPREFIX%/}"
4970 -
4971 - local i uuid_config=""
4972 - if use uuid; then
4973 - for i in ${UTIL_LINUX_LIBC[@]}; do
4974 - use ${i} && uuid_config="--with-uuid=e2fs"
4975 - done
4976 - for i in ${BSD_LIBC[@]}; do
4977 - use ${i} && uuid_config="--with-uuid=bsd"
4978 - done
4979 - [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp"
4980 - fi
4981 -
4982 - econf \
4983 - --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \
4984 - --datadir="${PO}/usr/share/postgresql-${SLOT}" \
4985 - --docdir="${PO}/usr/share/doc/${PF}" \
4986 - --includedir="${PO}/usr/include/postgresql-${SLOT}" \
4987 - --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \
4988 - --sysconfdir="${PO}/etc/postgresql-${SLOT}" \
4989 - --with-system-tzdata="${PO}/usr/share/zoneinfo" \
4990 - $(use_enable !alpha spinlocks) \
4991 - $(use_enable !pg_legacytimestamp integer-datetimes) \
4992 - $(use_enable threads thread-safety) \
4993 - $(use_with kerberos gssapi) \
4994 - $(use_with ldap) \
4995 - $(use_with pam) \
4996 - $(use_with perl) \
4997 - $(use_with python) \
4998 - $(use_with readline) \
4999 - $(use_with ssl openssl) \
5000 - $(usex server "$(use_with systemd)" '--without-systemd') \
5001 - $(use_with tcl) \
5002 - ${uuid_config} \
5003 - $(use_with xml libxml) \
5004 - $(use_with xml libxslt) \
5005 - $(use_with zlib) \
5006 - "$(use_enable nls nls "$(wanted_languages)")"
5007 -}
5008 -
5009 -src_compile() {
5010 - emake
5011 - emake -C contrib
5012 -}
5013 -
5014 -src_install() {
5015 - emake DESTDIR="${D}" install
5016 - emake DESTDIR="${D}" install -C contrib
5017 -
5018 - dodoc README HISTORY doc/{TODO,bug.template}
5019 -
5020 - # man pages are already built, but if we have the target make them,
5021 - # they'll be generated from source before being installed so we
5022 - # manually install man pages.
5023 - # We use ${SLOT} instead of doman for postgresql.eselect
5024 - insinto /usr/share/postgresql-${SLOT}/man/
5025 - doins -r doc/src/sgml/man{1,3,7}
5026 - if ! use server; then
5027 - # Remove man pages for non-existent binaries
5028 - for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do
5029 - rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1"
5030 - done
5031 - fi
5032 - docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7}
5033 -
5034 - # Create slot specific man pages
5035 - local bn f mansec slotted_name
5036 - for mansec in 1 3 7 ; do
5037 - local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}"
5038 -
5039 - mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir"
5040 - pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed"
5041 -
5042 - for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do
5043 - bn=$(basename "${f}")
5044 - slotted_name=${bn%.${mansec}}${SLOT/.}.${mansec}
5045 - case ${bn} in
5046 - TABLE.7|WITH.7)
5047 - echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name}
5048 - ;;
5049 - *)
5050 - echo ".so ${rel_manpath}/${bn}" > ${slotted_name}
5051 - ;;
5052 - esac
5053 - done
5054 -
5055 - popd > /dev/null
5056 - done
5057 -
5058 - insinto /etc/postgresql-${SLOT}
5059 - newins src/bin/psql/psqlrc.sample psqlrc
5060 -
5061 - use static-libs || find "${ED}" -name '*.a' -delete
5062 -
5063 - local f bn
5064 - for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \
5065 - -mindepth 1 -maxdepth 1)
5066 - do
5067 - bn=$(basename "${f}")
5068 - # Temporarily tack on tmp to workaround a file collision
5069 - # issue. This is only necessary for 9.7 and earlier. 10 never
5070 - # had this issue.
5071 - dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \
5072 - "/usr/bin/${bn}${SLOT/.}tmp"
5073 - done
5074 -
5075 - if use doc ; then
5076 - docinto html
5077 - dodoc doc/src/sgml/html/*
5078 -
5079 - docinto sgml
5080 - dodoc doc/src/sgml/*.{sgml,dsl}
5081 - fi
5082 -
5083 - if use server; then
5084 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
5085 - "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT}
5086 -
5087 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
5088 - "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT}
5089 -
5090 - if use systemd; then
5091 - sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \
5092 - "${FILESDIR}/${PN}.service-9.6-r1" | \
5093 - systemd_newunit - ${PN}-${SLOT}.service
5094 - systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf
5095 - fi
5096 -
5097 - newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir
5098 -
5099 - use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session
5100 -
5101 - if use prefix ; then
5102 - keepdir /run/postgresql
5103 - fperms 1775 /run/postgresql
5104 - fi
5105 - fi
5106 -}
5107 -
5108 -pkg_preinst() {
5109 - # Find all of the slot-specific symlinks, if any, in /usr/bin (e.g.,
5110 - # /usr/bin/psql96). They may have been created by the
5111 - # postgresql.eselect module, but they're handled within this ebuild
5112 - # now. It's alright if we momentarily delete /usr/bin/psql as it
5113 - # will be recreated by the eselect module in pkg_ppostinst(). This
5114 - # is only necessary for 9.7 and earlier. 10 and later were never
5115 - # handled in this manner.
5116 - local canonicalise
5117 - if type -p realpath > /dev/null; then
5118 - canonicalise=realpath
5119 - elif type -p readlink > /dev/null; then
5120 - canonicalise='readlink -f'
5121 - else
5122 - # can't die, subshell
5123 - die "No readlink nor realpath found, cannot canonicalise"
5124 - fi
5125 -
5126 - local l
5127 - # First remove any symlinks in /usr/bin that may have been created
5128 - # by the old eselect
5129 - for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do
5130 - if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then
5131 - rm "${l}" || ewarn "Couldn't remove ${l}"
5132 - fi
5133 - done
5134 -
5135 - # Then move the symlinks created by the ebuild to their proper place.
5136 - for l in "${ED}"/usr/bin/*tmp ; do
5137 - mv "${l}" "${l%tmp}" \
5138 - || ewarn "Couldn't rename $(basename ${l}) to $(basename ${l%tmp})"
5139 - done
5140 -}
5141 -
5142 -pkg_postinst() {
5143 - use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf
5144 - postgresql-config update
5145 -
5146 - elog "If you need a global psqlrc-file, you can place it in:"
5147 - elog " ${EROOT%/}/etc/postgresql-${SLOT}/"
5148 -
5149 - if use server ; then
5150 - elog
5151 - elog "Gentoo specific documentation:"
5152 - elog "https://wiki.gentoo.org/wiki/PostgreSQL"
5153 - elog
5154 - elog "Official documentation:"
5155 - elog "https://www.postgresql.org/docs/${SLOT}/static/index.html"
5156 - elog
5157 - elog "The default location of the Unix-domain socket is:"
5158 - elog " ${EROOT%/}/run/postgresql/"
5159 - elog
5160 - elog "Before initializing the database, you may want to edit PG_INITDB_OPTS"
5161 - elog "so that it contains your preferred locale in:"
5162 - elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
5163 - elog
5164 - elog "Then, execute the following command to setup the initial database"
5165 - elog "environment:"
5166 - elog " emerge --config =${CATEGORY}/${PF}"
5167 - fi
5168 -}
5169 -
5170 -pkg_prerm() {
5171 - if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then
5172 - ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?"
5173 - ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL"
5174 -
5175 - ebegin "Resuming removal in 10 seconds (Control-C to cancel)"
5176 - sleep 10
5177 - eend 0
5178 - fi
5179 -}
5180 -
5181 -pkg_postrm() {
5182 - postgresql-config update
5183 -}
5184 -
5185 -pkg_config() {
5186 - use server || die "USE flag 'server' not enabled. Nothing to configure."
5187 -
5188 - [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \
5189 - && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
5190 - [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/"
5191 - [[ -z "${DATA_DIR}" ]] \
5192 - && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data"
5193 -
5194 - # environment.bz2 may not contain the same locale as the current system
5195 - # locale. Unset and source from the current system locale.
5196 - if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then
5197 - unset LANG
5198 - unset LC_CTYPE
5199 - unset LC_NUMERIC
5200 - unset LC_TIME
5201 - unset LC_COLLATE
5202 - unset LC_MONETARY
5203 - unset LC_MESSAGES
5204 - unset LC_ALL
5205 - source "${EROOT%/}/etc/env.d/02locale"
5206 - [ -n "${LANG}" ] && export LANG
5207 - [ -n "${LC_CTYPE}" ] && export LC_CTYPE
5208 - [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC
5209 - [ -n "${LC_TIME}" ] && export LC_TIME
5210 - [ -n "${LC_COLLATE}" ] && export LC_COLLATE
5211 - [ -n "${LC_MONETARY}" ] && export LC_MONETARY
5212 - [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES
5213 - [ -n "${LC_ALL}" ] && export LC_ALL
5214 - fi
5215 -
5216 - einfo "You can modify the paths and options passed to initdb by editing:"
5217 - einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}"
5218 - einfo
5219 - einfo "Information on options that can be passed to initdb are found at:"
5220 - einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html"
5221 - einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html"
5222 - einfo
5223 - einfo "PG_INITDB_OPTS is currently set to:"
5224 - if [[ -z "${PG_INITDB_OPTS}" ]] ; then
5225 - einfo " (none)"
5226 - else
5227 - einfo " ${PG_INITDB_OPTS}"
5228 - fi
5229 - einfo
5230 - einfo "Configuration files will be installed to:"
5231 - einfo " ${PGDATA}"
5232 - einfo
5233 - einfo "The database cluster will be created in:"
5234 - einfo " ${DATA_DIR}"
5235 - einfo
5236 -
5237 - ebegin "Continuing initialization in 5 seconds (Control-C to cancel)"
5238 - sleep 5
5239 - eend 0
5240 -
5241 - if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then
5242 - eerror "The given directory, '${DATA_DIR}', is not empty."
5243 - eerror "Modify DATA_DIR to point to an empty directory."
5244 - die "${DATA_DIR} is not empty."
5245 - fi
5246 -
5247 - einfo "Creating the data directory ..."
5248 - if [[ ${EUID} == 0 ]] ; then
5249 - mkdir -p "${DATA_DIR}"
5250 - chown -Rf postgres:postgres "${DATA_DIR}"
5251 - chmod 0700 "${DATA_DIR}"
5252 - fi
5253 -
5254 - einfo "Initializing the database ..."
5255 -
5256 - if [[ ${EUID} == 0 ]] ; then
5257 - su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}"
5258 - else
5259 - "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS}
5260 - fi
5261 -
5262 - if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then
5263 - mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}"
5264 - ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}"
5265 - fi
5266 -
5267 - # unix_socket_directory has no effect in postgresql.conf as it's
5268 - # overridden in the initscript
5269 - sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf
5270 -
5271 - cat <<- EOF >> "${PGDATA%/}"/postgresql.conf
5272 - # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522
5273 - # On the off-chance that you might need to work with UTF-8 encoded
5274 - # characters in PL/Perl
5275 - plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";'
5276 - EOF
5277 -
5278 - einfo "The autovacuum function, which was in contrib, has been moved to the main"
5279 - einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled"
5280 - einfo "by default. You can disable it in the cluster's:"
5281 - einfo " ${PGDATA%/}/postgresql.conf"
5282 - einfo
5283 - if ! use systemd; then
5284 - einfo "The PostgreSQL server, by default, will log events to:"
5285 - einfo " ${DATA_DIR%/}/postmaster.log"
5286 - einfo
5287 - fi
5288 - if use prefix ; then
5289 - einfo "The location of the configuration files have moved to:"
5290 - einfo " ${PGDATA}"
5291 - einfo "To start the server:"
5292 - einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'"
5293 - einfo "To stop:"
5294 - einfo " pg_ctl stop -D ${DATA_DIR}"
5295 - einfo
5296 - einfo "Or move the configuration files back:"
5297 - einfo "mv ${PGDATA}*.conf ${DATA_DIR}"
5298 - elif use systemd; then
5299 - einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL"
5300 - einfo "instead of 'pg_ctl'."
5301 - else
5302 - einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL"
5303 - einfo "instead of 'pg_ctl'."
5304 - fi
5305 -}
5306 -
5307 -src_test() {
5308 - if use server && [[ ${UID} -ne 0 ]] ; then
5309 - emake check
5310 -
5311 - einfo "If you think other tests besides the regression tests are necessary, please"
5312 - einfo "submit a bug including a patch for this ebuild to enable them."
5313 - else
5314 - use server || \
5315 - ewarn 'Tests cannot be run without the "server" use flag enabled.'
5316 - [[ ${UID} -eq 0 ]] || \
5317 - ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.'
5318 -
5319 - ewarn 'Skipping.'
5320 - fi
5321 -}