Gentoo Archives: gentoo-commits

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