dev-python/pytest: arm64 stable (bug #723996)
[gentoo.git] / dev-db / pgagent / pgagent-3.4.0-r3.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 CMAKE_IN_SOURCE_BUILD=1
6 WX_GTK_VER="3.0"
7
8 inherit cmake-utils user wxwidgets
9
10 MY_PN=${PN/a/A}
11
12 KEYWORDS="amd64 x86"
13
14 DESCRIPTION="${MY_PN} is a job scheduler for PostgreSQL"
15 HOMEPAGE="http://www.pgadmin.org/download/pgagent.php"
16 SRC_URI="https://ftp.postgresql.org/pub/pgadmin3/release/${PN}/${MY_PN}-${PV}-Source.tar.gz"
17 LICENSE="POSTGRESQL GPL-2"
18 SLOT="0"
19 IUSE=""
20
21 RDEPEND="dev-db/postgresql:*
22                  x11-libs/wxGTK:${WX_GTK_VER}"
23 DEPEND="${RDEPEND}"
24
25 S="${WORKDIR}/${MY_PN}-${PV}-Source"
26
27 PATCHES=(
28         "${FILESDIR}/fix-dbconn-getlasterror-crash.patch"
29         "${FILESDIR}/save-stderr-jobstep-output.patch"
30         "${FILESDIR}/add-log-timestamps.patch"
31         "${FILESDIR}/fix-job-success-test.patch"
32         "${FILESDIR}/postgres-10-build-fix.patch"
33 )
34
35 src_prepare() {
36         cmake-utils_src_prepare
37
38         sed -e "s:share):share/${P}):" \
39                 -i CMakeLists.txt || die "failed to patch CMakeLists.txt"
40         sed -i -e '/SET(WX_VERSION "2.8")/d' CMakeLists.txt || die
41 }
42
43 src_configure() {
44         if has_version "x11-libs/wxGTK[X]"; then
45                 need-wxwidgets unicode
46         else
47                 need-wxwidgets base-unicode
48         fi
49         mycmakeargs=( "-DSTATIC_BUILD:BOOLEAN=FALSE"
50                                   "-DWX_VERSION=${WX_GTK_VER}" )
51         cmake-utils_src_configure
52 }
53
54 src_install() {
55         cmake-utils_src_install
56
57         newinitd "${FILESDIR}/pgagent.initd-r1" "${PN}"
58         newconfd "${FILESDIR}/pgagent.confd" "${PN}"
59
60         rm "${ED}"/usr/{LICENSE,README} || die "failed to remove useless docs"
61 }
62
63 pkg_preinst() {
64         # This user needs a real shell, and the daemon will use the
65         # ~/.pgpass file from its home directory.
66         enewuser pgagent -1 /bin/bash /home/pgagent
67 }
68
69 pkg_postinst() {
70         if [[ -n "${REPLACING_VERSIONS}" ]]; then
71                 # This warning can be removed around a year after this version
72                 # goes stable.
73                 ewarn 'pgAgent now runs as a dedicated "pgagent" user (as'
74                 ewarn 'opposed to root). You may need to move your /root/.pgpass'
75                 ewarn 'file to /home/pgagent/.pgpass, and the new user will'
76                 ewarn 'need permissions on any paths that it will access.'
77         fi
78 }