public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Richard Freeman" <rich0@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-process/systemd-cron/files/, sys-process/systemd-cron/
Date: Mon, 25 Jul 2022 21:35:31 +0000 (UTC)	[thread overview]
Message-ID: <1658784803.787ea3d5ae3a9a6b8d4233b862f32a0d2a8615f9.rich0@gentoo> (raw)

commit:     787ea3d5ae3a9a6b8d4233b862f32a0d2a8615f9
Author:     Richard Freeman <rich0 <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 25 21:33:23 2022 +0000
Commit:     Richard Freeman <rich0 <AT> gentoo <DOT> org>
CommitDate: Mon Jul 25 21:33:23 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=787ea3d5

sys-process/systemd-cron: Fix cron-failure email errors

Includes creation of missing user, and patch to email script.
Pending upstream PR for the patch.

Signed-off-by: Richard Freeman <rich0 <AT> gentoo.org>

 .../systemd-cron-1.15.19-default-mail-user.patch   | 28 +++++++
 .../systemd-cron/systemd-cron-1.15.19-r1.ebuild    | 96 ++++++++++++++++++++++
 2 files changed, 124 insertions(+)

diff --git a/sys-process/systemd-cron/files/systemd-cron-1.15.19-default-mail-user.patch b/sys-process/systemd-cron/files/systemd-cron-1.15.19-default-mail-user.patch
new file mode 100644
index 000000000000..420f68d81091
--- /dev/null
+++ b/sys-process/systemd-cron/files/systemd-cron-1.15.19-default-mail-user.patch
@@ -0,0 +1,28 @@
+From 525410d5dc2a7c33590d25d6c574dec7eb826ec1 Mon Sep 17 00:00:00 2001
+From: Richard Freeman <rich0@gentoo.org>
+Date: Mon, 25 Jul 2022 15:36:21 -0400
+Subject: [PATCH] Fix default user fallback.
+
+Signed-off-by: Richard Freeman <rich0@gentoo.org>
+---
+ src/bin/mail_on_failure.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/bin/mail_on_failure.py b/src/bin/mail_on_failure.py
+index 132eab9..dd2288f 100755
+--- a/src/bin/mail_on_failure.py
++++ b/src/bin/mail_on_failure.py
+@@ -26,7 +26,9 @@ user = subprocess.check_output(
+                      ['systemctl', 'show', args.unit, '--property=User'],
+                      universal_newlines=True)
+ user = user.rstrip('\n')
+-user = user.split('=')[1] if user else 'root'
++user = user.split('=')[1]
++if not user:
++    user = 'root'
+ 
+ mailto = user
+ mailfrom = 'root'
+-- 
+2.35.1
+

diff --git a/sys-process/systemd-cron/systemd-cron-1.15.19-r1.ebuild b/sys-process/systemd-cron/systemd-cron-1.15.19-r1.ebuild
new file mode 100644
index 000000000000..400475508671
--- /dev/null
+++ b/sys-process/systemd-cron/systemd-cron-1.15.19-r1.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+PYTHON_COMPAT=( pypy3 python3_{8..10} )
+inherit python-single-r1 systemd
+
+DESCRIPTION="systemd units to create timers for cron directories and crontab"
+HOMEPAGE="https://github.com/systemd-cron/systemd-cron/"
+SRC_URI="https://github.com/systemd-cron/${PN}/archive/v${PV}.tar.gz -> systemd-cron-${PV}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
+IUSE="cron-boot etc-crontab-systemd minutely +runparts setgid test yearly"
+RESTRICT="!test? ( test )"
+
+RDEPEND=">=sys-apps/systemd-217
+	sys-apps/debianutils
+	!sys-process/cronie[anacron]
+	!etc-crontab-systemd? ( !sys-process/dcron )
+	${PYTHON_DEPS}
+	sys-process/cronbase
+	acct-user/_cron-failure
+	acct-group/_cron-failure"
+
+DEPEND="sys-process/cronbase
+	test? ( sys-apps/man-db dev-python/pyflakes )"
+
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+PATCHES=( "${FILESDIR}/${P}-default-mail-user.patch" )
+
+src_prepare() {
+	python_fix_shebang --force "${S}/src/bin"
+
+	sed -i \
+		-e 's/^crontab/crontab-systemd/' \
+		-e 's/^CRONTAB/CRONTAB-SYSTEMD/' \
+		-- "${S}/src/man/crontab."{1,5}".in" || die
+
+	sed -i \
+		-e 's!/crontab$!/crontab-systemd!' \
+		-e 's!/crontab\(\.[15]\)$!/crontab-systemd\1!' \
+		-e 's/pyflakes3/pyflakes/' \
+		-- "${S}/Makefile.in" || die
+
+	if use etc-crontab-systemd
+	then	sed -i \
+			-e "s!/etc/crontab!/etc/crontab-systemd!" \
+			-- "${S}/src/man/crontab."{1,5}".in" \
+			"${S}/src/bin/systemd-crontab-generator.py" || die
+	fi
+
+	eapply "${PATCHES[@]}"
+	eapply_user
+}
+
+my_use_enable() {
+	if use ${1}; then
+		echo --enable-${2:-${1}}=yes
+	else
+		echo --enable-${2:-${1}}=no
+	fi
+}
+
+src_configure() {
+	./configure \
+		--prefix="${EPREFIX}/usr" \
+		--confdir="${EPREFIX}/etc" \
+		--runparts="${EPREFIX}/bin/run-parts" \
+		--mandir="${EPREFIX}/usr/share/man" \
+		--unitdir="$(systemd_get_systemunitdir)" \
+		--generatordir="$(systemd_get_systemgeneratordir)" \
+		$(my_use_enable cron-boot boot) \
+		$(my_use_enable minutely) \
+		$(my_use_enable runparts) \
+		$(my_use_enable yearly) \
+		$(my_use_enable yearly quarterly) \
+		$(my_use_enable yearly semi_annually) \
+		$(my_use_enable setgid) \
+		--enable-persistent=yes
+}
+
+src_install() {
+	default
+	rm -f "${ED}"/usr/lib/sysusers.d/systemd-cron.conf
+}
+
+pkg_postinst() {
+	elog "This package now supports USE=runparts which is enabled by default."
+	elog "This enables the traditional run-parts behavior."
+	elog "If you disable this flag you will get the new behavior of having"
+	elog "multiple jobs for each cron.* entry run in parallel with"
+	elog "separate services/logs/etc."
+}


             reply	other threads:[~2022-07-25 21:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 21:35 Richard Freeman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-16 15:16 [gentoo-commits] repo/gentoo:master commit in: sys-process/systemd-cron/files/, sys-process/systemd-cron/ Richard Freeman
2018-01-13 16:53 Mike Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1658784803.787ea3d5ae3a9a6b8d4233b862f32a0d2a8615f9.rich0@gentoo \
    --to=rich0@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox