1 |
commit: c5244125f049f0de1b4055169ea2c37958c612a4 |
2 |
Author: Chris Mayo <aklhfex <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon May 15 18:51:11 2017 +0000 |
4 |
Commit: Patrice Clement <monsieurp <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 31 16:47:32 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5244125 |
7 |
|
8 |
dev-db/postgresql: change systemd unit type to notify. |
9 |
|
10 |
Add systemd USE flag to control required configure option and dependency. |
11 |
|
12 |
Default events that used to be written to postmaster.log will now be written to |
13 |
the location specified by DefaultStandardOutput and DefaultStandardError in |
14 |
system.conf. |
15 |
|
16 |
Package-Manager: Portage-2.3.5, Repoman-2.3.2 |
17 |
Closes: https://github.com/gentoo/gentoo/pull/4557 |
18 |
|
19 |
dev-db/postgresql/files/postgresql.service-9.6 | 56 +++++ |
20 |
...esql-9999.ebuild => postgresql-9.6.3-r1.ebuild} | 227 +++++++++++++-------- |
21 |
dev-db/postgresql/postgresql-9999.ebuild | 23 ++- |
22 |
3 files changed, 215 insertions(+), 91 deletions(-) |
23 |
|
24 |
diff --git a/dev-db/postgresql/files/postgresql.service-9.6 b/dev-db/postgresql/files/postgresql.service-9.6 |
25 |
new file mode 100644 |
26 |
index 00000000000..89ec2d5cf7c |
27 |
--- /dev/null |
28 |
+++ b/dev-db/postgresql/files/postgresql.service-9.6 |
29 |
@@ -0,0 +1,56 @@ |
30 |
+# It's not recommended to modify this file in-place, because it will be |
31 |
+# overwritten during package upgrades. If you want to customize, the |
32 |
+# best way is to create file |
33 |
+# "/etc/systemd/system/postgresql-@SLOT@.service.d/*.conf" |
34 |
+# containing your changes |
35 |
+ |
36 |
+# For example, if you want to change the server's port number to 5433, |
37 |
+# create a file named |
38 |
+# "/etc/systemd/system/postgresql-@SLOT@.service.d/port.conf" |
39 |
+# containing: |
40 |
+# [Service] |
41 |
+# Environment=PGPORT=5433 |
42 |
+# This will override the setting appearing below. |
43 |
+ |
44 |
+[Unit] |
45 |
+Description=PostgreSQL database server |
46 |
+After=network.target |
47 |
+ |
48 |
+[Service] |
49 |
+Type=notify |
50 |
+ |
51 |
+User=postgres |
52 |
+Group=postgres |
53 |
+ |
54 |
+# Port number for server to listen on |
55 |
+Environment=PGPORT=5432 |
56 |
+ |
57 |
+# Location of configuration files |
58 |
+Environment=PGDATA=/etc/postgresql-@SLOT@ |
59 |
+ |
60 |
+# Where the data directory is located |
61 |
+Environment=DATA_DIR=/var/lib/postgresql/@SLOT@/data |
62 |
+ |
63 |
+# Where to send early-startup messages from the server (before the logging |
64 |
+# options of postgresql.conf take effect) |
65 |
+# This is normally controlled by the global default set by systemd |
66 |
+# StandardOutput=syslog |
67 |
+ |
68 |
+ExecStartPre=/usr/bin/postgresql-@SLOT@-check-db-dir |
69 |
+ExecStart=/usr/@LIBDIR@/postgresql-@SLOT@/bin/postgres -p ${PGPORT} -D ${DATA_DIR} |
70 |
+ExecReload=/bin/kill -HUP $MAINPID |
71 |
+KillMode=mixed |
72 |
+KillSignal=SIGINT |
73 |
+ |
74 |
+# Give a reasonable amount of time for the server to start up/shut down |
75 |
+TimeoutSec=300 |
76 |
+ |
77 |
+# Disable OOM kill on the postmaster |
78 |
+OOMScoreAdjust=-1000 |
79 |
+ |
80 |
+# Make sure the required runtimedir is present |
81 |
+RuntimeDirectory=postgresql |
82 |
+RuntimeDirectoryMode=1775 |
83 |
+ |
84 |
+[Install] |
85 |
+WantedBy=multi-user.target |
86 |
|
87 |
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9.6.3-r1.ebuild |
88 |
similarity index 65% |
89 |
copy from dev-db/postgresql/postgresql-9999.ebuild |
90 |
copy to dev-db/postgresql/postgresql-9.6.3-r1.ebuild |
91 |
index 4c37f742af7..2a849b459b1 100644 |
92 |
--- a/dev-db/postgresql/postgresql-9999.ebuild |
93 |
+++ b/dev-db/postgresql/postgresql-9.6.3-r1.ebuild |
94 |
@@ -5,15 +5,17 @@ EAPI="5" |
95 |
|
96 |
PYTHON_COMPAT=( python2_7 python3_{4,5,6} ) |
97 |
|
98 |
-inherit eutils flag-o-matic git-2 linux-info multilib pam prefix \ |
99 |
- python-single-r1 systemd user versionator |
100 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
101 |
+ systemd user versionator |
102 |
|
103 |
-KEYWORDS="" |
104 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
105 |
|
106 |
-# Bump when rc released. |
107 |
-SLOT="10" |
108 |
+SLOT="$(get_version_component_range 1-2)" |
109 |
|
110 |
-EGIT_REPO_URI="git://git.postgresql.org/git/postgresql.git" |
111 |
+MY_PV=${PV/_/} |
112 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
113 |
+ |
114 |
+SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
115 |
|
116 |
LICENSE="POSTGRESQL GPL-2" |
117 |
DESCRIPTION="PostgreSQL RDBMS" |
118 |
@@ -21,8 +23,8 @@ HOMEPAGE="http://www.postgresql.org/" |
119 |
|
120 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
121 |
zh_CN zh_TW" |
122 |
-IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
123 |
- +readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
124 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
125 |
+ +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib" |
126 |
|
127 |
for lingua in ${LINGUAS}; do |
128 |
IUSE+=" linguas_${lingua}" |
129 |
@@ -53,31 +55,42 @@ ssl? ( |
130 |
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
131 |
libressl? ( dev-libs/libressl:= ) |
132 |
) |
133 |
+server? ( systemd? ( sys-apps/systemd ) ) |
134 |
tcl? ( >=dev-lang/tcl-8:0= ) |
135 |
-uuid? ( dev-libs/ossp-uuid ) |
136 |
xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
137 |
zlib? ( sys-libs/zlib ) |
138 |
" |
139 |
|
140 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
141 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
142 |
+# the libc includes UUID functions. |
143 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
144 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
145 |
+ |
146 |
+nest_usedep() { |
147 |
+ local front back |
148 |
+ while [[ ${#} -gt 1 ]]; do |
149 |
+ front+="${1}? ( " |
150 |
+ back+=" )" |
151 |
+ shift |
152 |
+ done |
153 |
+ echo "${front}${1}${back}" |
154 |
+} |
155 |
+ |
156 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
157 |
+CDEPEND+=" |
158 |
+uuid? ( |
159 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
160 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
161 |
+)" |
162 |
+ |
163 |
DEPEND="${CDEPEND} |
164 |
!!<sys-apps/sandbox-2.0 |
165 |
->=dev-lang/perl-5.8 |
166 |
-app-text/docbook-dsssl-stylesheets |
167 |
-app-text/docbook-sgml-dtd:4.2 |
168 |
-app-text/docbook-xml-dtd:4.2 |
169 |
-app-text/docbook-xsl-stylesheets |
170 |
-app-text/openjade |
171 |
-dev-libs/libxml2 |
172 |
-dev-libs/libxslt |
173 |
sys-devel/bison |
174 |
sys-devel/flex |
175 |
nls? ( sys-devel/gettext ) |
176 |
xml? ( virtual/pkgconfig ) |
177 |
" |
178 |
-src_unpack() { |
179 |
- base_src_unpack |
180 |
- git-2_src_unpack |
181 |
-} |
182 |
|
183 |
RDEPEND="${CDEPEND} |
184 |
!dev-db/postgresql-docs:${SLOT} |
185 |
@@ -86,17 +99,8 @@ RDEPEND="${CDEPEND} |
186 |
selinux? ( sec-policy/selinux-postgresql ) |
187 |
" |
188 |
|
189 |
-pkg_pretend() { |
190 |
- ewarn "You are using a live ebuild that uses the current source code as it is" |
191 |
- ewarn "available from PostgreSQL's Git repository at emerge time. Given such," |
192 |
- ewarn "the GNU Makefiles may be altered by upstream without notice and the" |
193 |
- ewarn "documentation for this live version is not readily available" |
194 |
- ewarn "online. Ergo, the ebuild maintainers will not support building a" |
195 |
- ewarn "client-only and/or document-free version." |
196 |
-} |
197 |
- |
198 |
pkg_setup() { |
199 |
- CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
200 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
201 |
|
202 |
enewgroup postgres 70 |
203 |
enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
204 |
@@ -117,6 +121,12 @@ src_prepare() { |
205 |
# hardened and non-hardened environments. (Bug #528786) |
206 |
sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
207 |
|
208 |
+ use server || epatch "${FILESDIR}/${PN}-${SLOT}.1-no-server.patch" |
209 |
+ |
210 |
+ # Fix bug 486556 where the server would crash at start up because of |
211 |
+ # an infinite loop caused by a self-referencing symlink. |
212 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
213 |
+ |
214 |
if use pam ; then |
215 |
sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
216 |
-i src/backend/libpq/auth.c || \ |
217 |
@@ -138,6 +148,17 @@ src_configure() { |
218 |
|
219 |
local PO="${EPREFIX%/}" |
220 |
|
221 |
+ local i uuid_config="" |
222 |
+ if use uuid; then |
223 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
224 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
225 |
+ done |
226 |
+ for i in ${BSD_LIBC[@]}; do |
227 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
228 |
+ done |
229 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
230 |
+ fi |
231 |
+ |
232 |
econf \ |
233 |
--prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
234 |
--datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
235 |
@@ -155,8 +176,9 @@ src_configure() { |
236 |
$(use_with python) \ |
237 |
$(use_with readline) \ |
238 |
$(use_with ssl openssl) \ |
239 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
240 |
$(use_with tcl) \ |
241 |
- $(use_with uuid ossp-uuid) \ |
242 |
+ ${uuid_config} \ |
243 |
$(use_with xml libxml) \ |
244 |
$(use_with xml libxslt) \ |
245 |
$(use_with zlib) \ |
246 |
@@ -164,33 +186,35 @@ src_configure() { |
247 |
} |
248 |
|
249 |
src_compile() { |
250 |
- emake world |
251 |
+ emake |
252 |
+ emake -C contrib |
253 |
} |
254 |
|
255 |
src_install() { |
256 |
- emake DESTDIR="${D}" install-world |
257 |
+ emake DESTDIR="${D}" install |
258 |
+ emake DESTDIR="${D}" install -C contrib |
259 |
|
260 |
dodoc README HISTORY doc/{TODO,bug.template} |
261 |
|
262 |
+ # man pages are already built, but if we have the target make them, |
263 |
+ # they'll be generated from source before being installed so we |
264 |
+ # manually install man pages. |
265 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
266 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
267 |
+ doins -r doc/src/sgml/man{1,3,7} |
268 |
+ if ! use server; then |
269 |
+ # Remove man pages for non-existent binaries |
270 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
271 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
272 |
+ done |
273 |
+ fi |
274 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
275 |
+ |
276 |
insinto /etc/postgresql-${SLOT} |
277 |
newins src/bin/psql/psqlrc.sample psqlrc |
278 |
|
279 |
use static-libs || find "${ED}" -name '*.a' -delete |
280 |
|
281 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
282 |
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
283 |
- |
284 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
285 |
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
286 |
- |
287 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
288 |
- "${FILESDIR}/${PN}.service" | \ |
289 |
- systemd_newunit - ${PN}-${SLOT}.service |
290 |
- |
291 |
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
292 |
- |
293 |
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
294 |
- |
295 |
local f bn |
296 |
for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
297 |
-mindepth 1 -maxdepth 1) |
298 |
@@ -213,22 +237,46 @@ src_install() { |
299 |
done |
300 |
done |
301 |
|
302 |
- if use prefix ; then |
303 |
- keepdir /run/postgresql |
304 |
- fperms 0775 /run/postgresql |
305 |
+ if use doc ; then |
306 |
+ docinto html |
307 |
+ dodoc doc/src/sgml/html/* |
308 |
+ |
309 |
+ docinto sgml |
310 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
311 |
+ fi |
312 |
+ |
313 |
+ if use server; then |
314 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
315 |
+ "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
316 |
+ |
317 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
318 |
+ "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
319 |
+ |
320 |
+ if use systemd; then |
321 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
322 |
+ "${FILESDIR}/${PN}.service-9.6" | \ |
323 |
+ systemd_newunit - ${PN}-${SLOT}.service |
324 |
+ fi |
325 |
+ |
326 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
327 |
+ |
328 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
329 |
+ |
330 |
+ if use prefix ; then |
331 |
+ keepdir /run/postgresql |
332 |
+ fperms 0775 /run/postgresql |
333 |
+ fi |
334 |
fi |
335 |
} |
336 |
|
337 |
pkg_preinst() { |
338 |
# Find all of the slot-specific symlinks, if any, in /usr/bin (e.g., |
339 |
- # /usr/bin/psql97). They may have been created by the |
340 |
+ # /usr/bin/psql96). They may have been created by the |
341 |
# postgresql.eselect module, but they're handled within this ebuild |
342 |
# now. It's alright if we momentarily delete /usr/bin/psql as it |
343 |
- # will be recreated by the eselect module in pkg_ppostinst(). We |
344 |
- # only worry about the 9.7 slot as that's the last slot that had its |
345 |
- # slot-specific links generated by eselect. |
346 |
- # |
347 |
- # This can be removed when 10 is the lowest slot in the tree. |
348 |
+ # will be recreated by the eselect module in pkg_ppostinst(). This |
349 |
+ # is only necessary for 9.7 and earlier. 10 and later were never |
350 |
+ # handled in this manner. |
351 |
local canonicalise |
352 |
if type -p realpath > /dev/null; then |
353 |
canonicalise=realpath |
354 |
@@ -243,7 +291,9 @@ pkg_preinst() { |
355 |
# First remove any symlinks in /usr/bin that may have been created |
356 |
# by the old eselect |
357 |
for l in $(find "${ROOT%/}/usr/bin" -mindepth 1 -maxdepth 1 -type l) ; do |
358 |
- [[ $(${canonicalise} "${l}") == *postgresql-9.7* ]] && rm "${l}" |
359 |
+ if [[ $(${canonicalise} "${l}") == *postgresql-${SLOT}* ]] ; then |
360 |
+ rm "${l}" || ewarn "Couldn't remove ${l}" |
361 |
+ fi |
362 |
done |
363 |
|
364 |
# Then move the symlinks created by the ebuild to their proper place. |
365 |
@@ -259,27 +309,29 @@ pkg_postinst() { |
366 |
elog "If you need a global psqlrc-file, you can place it in:" |
367 |
elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
368 |
|
369 |
- elog |
370 |
- elog "Gentoo specific documentation:" |
371 |
- elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
372 |
- elog |
373 |
- elog "Official documentation:" |
374 |
- elog "${EROOT%/}/usr/share/doc/${PF}/html" |
375 |
- elog |
376 |
- elog "The default location of the Unix-domain socket is:" |
377 |
- elog " ${EROOT%/}/run/postgresql/" |
378 |
- elog |
379 |
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
380 |
- elog "so that it contains your preferred locale, and other options, in:" |
381 |
- elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
382 |
- elog |
383 |
- elog "Then, execute the following command to setup the initial database" |
384 |
- elog "environment:" |
385 |
- elog " emerge --config =${CATEGORY}/${PF}" |
386 |
+ if use server ; then |
387 |
+ elog |
388 |
+ elog "Gentoo specific documentation:" |
389 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
390 |
+ elog |
391 |
+ elog "Official documentation:" |
392 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
393 |
+ elog |
394 |
+ elog "The default location of the Unix-domain socket is:" |
395 |
+ elog " ${EROOT%/}/run/postgresql/" |
396 |
+ elog |
397 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
398 |
+ elog "so that it contains your preferred locale in:" |
399 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
400 |
+ elog |
401 |
+ elog "Then, execute the following command to setup the initial database" |
402 |
+ elog "environment:" |
403 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
404 |
+ fi |
405 |
} |
406 |
|
407 |
pkg_prerm() { |
408 |
- if [[ -z ${REPLACED_BY_VERSION} ]] ; then |
409 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
410 |
ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
411 |
ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
412 |
|
413 |
@@ -294,6 +346,8 @@ pkg_postrm() { |
414 |
} |
415 |
|
416 |
pkg_config() { |
417 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
418 |
+ |
419 |
[[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
420 |
&& source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
421 |
[[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
422 |
@@ -389,9 +443,11 @@ pkg_config() { |
423 |
einfo "by default. You can disable it in the cluster's:" |
424 |
einfo " ${PGDATA%/}/postgresql.conf" |
425 |
einfo |
426 |
- einfo "The PostgreSQL server, by default, will log events to:" |
427 |
- einfo " ${DATA_DIR%/}/postmaster.log" |
428 |
- einfo |
429 |
+ if ! use systemd; then |
430 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
431 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
432 |
+ einfo |
433 |
+ fi |
434 |
if use prefix ; then |
435 |
einfo "The location of the configuration files have moved to:" |
436 |
einfo " ${PGDATA}" |
437 |
@@ -402,6 +458,9 @@ pkg_config() { |
438 |
einfo |
439 |
einfo "Or move the configuration files back:" |
440 |
einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
441 |
+ elif use systemd; then |
442 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
443 |
+ einfo "instead of 'pg_ctl'." |
444 |
else |
445 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
446 |
einfo "instead of 'pg_ctl'." |
447 |
@@ -409,17 +468,17 @@ pkg_config() { |
448 |
} |
449 |
|
450 |
src_test() { |
451 |
- einfo ">>> Test phase [check]: ${CATEGORY}/${PF}" |
452 |
- |
453 |
- if [[ ${UID} -ne 0 ]] ; then |
454 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
455 |
emake check |
456 |
|
457 |
einfo "If you think other tests besides the regression tests are necessary, please" |
458 |
einfo "submit a bug including a patch for this ebuild to enable them." |
459 |
else |
460 |
+ use server || \ |
461 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
462 |
[[ ${UID} -eq 0 ]] || \ |
463 |
- ewarn "Tests cannot be run as root. Enable 'userpriv' in FEATURES." |
464 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
465 |
|
466 |
- ewarn "Skipping." |
467 |
+ ewarn 'Skipping.' |
468 |
fi |
469 |
} |
470 |
|
471 |
diff --git a/dev-db/postgresql/postgresql-9999.ebuild b/dev-db/postgresql/postgresql-9999.ebuild |
472 |
index 4c37f742af7..cbc1266c206 100644 |
473 |
--- a/dev-db/postgresql/postgresql-9999.ebuild |
474 |
+++ b/dev-db/postgresql/postgresql-9999.ebuild |
475 |
@@ -22,7 +22,7 @@ HOMEPAGE="http://www.postgresql.org/" |
476 |
LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
477 |
zh_CN zh_TW" |
478 |
IUSE="kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
479 |
- +readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
480 |
+ +readline selinux +server systemd ssl static-libs tcl threads uuid xml zlib" |
481 |
|
482 |
for lingua in ${LINGUAS}; do |
483 |
IUSE+=" linguas_${lingua}" |
484 |
@@ -53,6 +53,7 @@ ssl? ( |
485 |
!libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
486 |
libressl? ( dev-libs/libressl:= ) |
487 |
) |
488 |
+server? ( systemd? ( sys-apps/systemd ) ) |
489 |
tcl? ( >=dev-lang/tcl-8:0= ) |
490 |
uuid? ( dev-libs/ossp-uuid ) |
491 |
xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
492 |
@@ -155,6 +156,7 @@ src_configure() { |
493 |
$(use_with python) \ |
494 |
$(use_with readline) \ |
495 |
$(use_with ssl openssl) \ |
496 |
+ $(usex server "$(use_with systemd)" '--without-systemd') \ |
497 |
$(use_with tcl) \ |
498 |
$(use_with uuid ossp-uuid) \ |
499 |
$(use_with xml libxml) \ |
500 |
@@ -183,9 +185,11 @@ src_install() { |
501 |
sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
502 |
"${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
503 |
|
504 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
505 |
- "${FILESDIR}/${PN}.service" | \ |
506 |
- systemd_newunit - ${PN}-${SLOT}.service |
507 |
+ if use systemd; then |
508 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
509 |
+ "${FILESDIR}/${PN}.service-9.6" | \ |
510 |
+ systemd_newunit - ${PN}-${SLOT}.service |
511 |
+ fi |
512 |
|
513 |
newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
514 |
|
515 |
@@ -389,9 +393,11 @@ pkg_config() { |
516 |
einfo "by default. You can disable it in the cluster's:" |
517 |
einfo " ${PGDATA%/}/postgresql.conf" |
518 |
einfo |
519 |
- einfo "The PostgreSQL server, by default, will log events to:" |
520 |
- einfo " ${DATA_DIR%/}/postmaster.log" |
521 |
- einfo |
522 |
+ if ! use systemd; then |
523 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
524 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
525 |
+ einfo |
526 |
+ fi |
527 |
if use prefix ; then |
528 |
einfo "The location of the configuration files have moved to:" |
529 |
einfo " ${PGDATA}" |
530 |
@@ -402,6 +408,9 @@ pkg_config() { |
531 |
einfo |
532 |
einfo "Or move the configuration files back:" |
533 |
einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
534 |
+ elif use systemd; then |
535 |
+ einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
536 |
+ einfo "instead of 'pg_ctl'." |
537 |
else |
538 |
einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
539 |
einfo "instead of 'pg_ctl'." |