Gentoo Archives: gentoo-commits

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