sys-kernel/gentoo-sources: Linux patch 5.0.12
[gentoo.git] / sys-process / systemd-cron / systemd-cron-1.5.12-r1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5 PYTHON_COMPAT=( pypy3 python3_{5,6} )
6 inherit eutils python-single-r1 systemd
7
8 DESCRIPTION="systemd units to create timers for cron directories and crontab"
9 HOMEPAGE="https://github.com/systemd-cron/systemd-cron/"
10 SRC_URI="https://github.com/systemd-cron/${PN}/archive/v${PV}.tar.gz -> systemd-cron-${PV}.tar.gz"
11
12 LICENSE="MIT"
13 SLOT="0"
14 KEYWORDS="amd64 x86"
15 IUSE="cron-boot etc-crontab-systemd minutely setgid test yearly"
16
17 RDEPEND=">=sys-apps/systemd-217
18              sys-apps/debianutils
19              !etc-crontab-systemd? ( !sys-process/dcron )
20              ${PYTHON_DEPS}
21                  sys-process/cronbase"
22
23 DEPEND="sys-process/cronbase
24         test? ( sys-apps/man-db dev-python/pyflakes )"
25
26 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
27
28 src_prepare() {
29         epatch "${FILESDIR}/1.5.12-generatordir.patch"
30
31         python_fix_shebang --force "${S}/src/bin"
32
33         sed -i \
34                 -e 's/^crontab/crontab-systemd/' \
35                 -e 's/^CRONTAB/CRONTAB-SYSTEMD/' \
36                 -- "${S}/src/man/crontab."{1,5}".in" || die
37
38         sed -i \
39                 -e 's!/crontab$!/crontab-systemd!' \
40                 -e 's!/crontab\(\.[15]\)$!/crontab-systemd\1!' \
41                 -e 's/pyflakes3/pyflakes/' \
42                 -- "${S}/Makefile.in" || die
43
44         if use etc-crontab-systemd
45         then    sed -i \
46                         -e "s!/etc/crontab!/etc/crontab-systemd!" \
47                         -- "${S}/src/man/crontab."{1,5}".in" \
48                         "${S}/src/bin/systemd-crontab-generator.py" || die
49         fi
50
51         epatch_user
52 }
53
54 my_use_enable() {
55         if use ${1}; then
56                 echo --enable-${2:-${1}}=yes
57         else
58                 echo --enable-${2:-${1}}=no
59         fi
60 }
61
62 src_configure() {
63         ./configure \
64                 --prefix="${EPREFIX}/usr" \
65                 --confdir="${EPREFIX}/etc" \
66                 --runparts="${EPREFIX}/bin/run-parts" \
67                 --mandir="${EPREFIX}/usr/share/man" \
68                 --unitdir="$(systemd_get_unitdir)" \
69                 --generatordir="$(systemd_get_systemgeneratordir)" \
70                 $(my_use_enable cron-boot boot) \
71                 $(my_use_enable minutely) \
72                 $(my_use_enable yearly) \
73                 $(my_use_enable yearly quarterly) \
74                 $(my_use_enable yearly semi_annually) \
75                 $(my_use_enable setgid) \
76                 --enable-persistent=yes
77 }