commit:     c3315537514a3457b3a43674bfe721aa4cff110e
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 31 15:47:41 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Mar 31 15:52:41 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c3315537

net-analyzer/fail2ban: port to python-single-r1

The package isn't suitable for PEP517, as it installs data files and
it simply happens to be written in Python, rather than intending to be
imported and so on.

Unfortunately, for the remaining PEP517 holdouts, there's little pressure
upstream for them to port to a proper build system yet, as while setuptools
deprecated the `setup.py` entrypoint some time ago, there's no removal
in sight yet, so the only pressing side is on Gentoo's where we want
to cleanup distutils-r1's support for that.

It was arguably a mistake to really have these packages use distutils-r1
in the first place.

The obvious workaround for now is to invoke setup.py manually w/ 
python-single-r1,
and punt the question until setuptools removal of the entrypoint looks
closer (at which time, other distros will be putting pressure on upstreams
too). Of course, if at the time of such a setuptools change, the package
is still not fixed, then we'd have to remove it.

(The same issues apply to bug #923080 which isn't fixed by this, but
hopefully won't be an actual problem until that aforementioned removal
in setuptools itself of the other bits.)

Bug: https://bugs.gentoo.org/923080
Closes: https://bugs.gentoo.org/909998
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...il2ban-9999.ebuild => fail2ban-1.1.0-r3.ebuild} | 32 +++++++++++++++-------
 net-analyzer/fail2ban/fail2ban-9999.ebuild         | 29 +++++++++++++-------
 2 files changed, 41 insertions(+), 20 deletions(-)

diff --git a/net-analyzer/fail2ban/fail2ban-9999.ebuild 
b/net-analyzer/fail2ban/fail2ban-1.1.0-r3.ebuild
similarity index 84%
copy from net-analyzer/fail2ban/fail2ban-9999.ebuild
copy to net-analyzer/fail2ban/fail2ban-1.1.0-r3.ebuild
index 45aad51f16eb..577332238350 100644
--- a/net-analyzer/fail2ban/fail2ban-9999.ebuild
+++ b/net-analyzer/fail2ban/fail2ban-1.1.0-r3.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -6,7 +6,7 @@ EAPI=8
 DISTUTILS_SINGLE_IMPL=1
 PYTHON_COMPAT=( python3_{10..13} )
 
-inherit bash-completion-r1 distutils-r1 systemd tmpfiles
+inherit bash-completion-r1 edo python-single-r1 systemd tmpfiles
 
 DESCRIPTION="Scans log files and bans IPs that show malicious signs"
 HOMEPAGE="https://www.fail2ban.org/";
@@ -23,8 +23,10 @@ LICENSE="GPL-2"
 SLOT="0"
 IUSE="selinux systemd test"
 RESTRICT="!test? ( test )"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
 
 RDEPEND="
+       ${PYTHON_DEPS}
        $(python_gen_cond_dep '
                dev-python/pyasyncore[${PYTHON_USEDEP}]
                dev-python/pyasynchat[${PYTHON_USEDEP}]
@@ -51,17 +53,24 @@ DOCS=( ChangeLog DEVELOP README.md THANKS TODO 
doc/run-rootless.txt )
 PATCHES=(
        "${FILESDIR}"/${PN}-0.11.2-adjust-apache-logs-paths.patch
        "${FILESDIR}"/${PN}-1.0.2-umask-tests.patch
+       "${FILESDIR}"/${PN}-1.1.0-openssh-9.8.patch
+       "${FILESDIR}"/${PN}-1.1.0-openssh-9.8-fixups.patch
+       "${FILESDIR}"/${PN}-1.1.0-openrc-nftables.patch
 )
 
-python_prepare_all() {
-       distutils-r1_python_prepare_all
+src_prepare() {
+       default
 
        # Replace /var/run with /run, but not in the top source directory
        find . -mindepth 2 -type f -exec \
                sed -i -e 's|/var\(/run/fail2ban\)|\1|g' {} + || die
 }
 
-python_test() {
+src_compile() {
+       edo ${EPYTHON} setup.py build
+}
+
+src_test() {
        # Skip testRepairDb for bug #907348 (didn't always fail..)
        # https://github.com/fail2ban/fail2ban/issues/3586
        bin/fail2ban-testcases \
@@ -73,17 +82,20 @@ python_test() {
        rm -rf fail2ban.egg-info || die
 }
 
-python_install_all() {
-       distutils-r1_python_install_all
+src_install() {
+       edo ${EPYTHON} setup.py install --prefix="${EPREFIX}/usr" --root="${D}"
+       python_fix_shebang "${ED}"/usr/bin
+       python_optimize
+
+       einstalldocs
 
        rm -rf "${ED}"/usr/share/doc/${PN} "${ED}"/run || die
 
        newconfd files/fail2ban-openrc.conf ${PN}
-
        # These two are placed in the ${BUILD_DIR} after being "built"
        # in install_scripts().
-       newinitd "${BUILD_DIR}/fail2ban-openrc.init" "${PN}"
-       systemd_dounit "${BUILD_DIR}/${PN}.service"
+       newinitd "${S}"/build/fail2ban-openrc.init ${PN}
+       systemd_dounit "${S}"/build/${PN}.service
 
        dotmpfiles files/${PN}-tmpfiles.conf
 

diff --git a/net-analyzer/fail2ban/fail2ban-9999.ebuild 
b/net-analyzer/fail2ban/fail2ban-9999.ebuild
index 45aad51f16eb..3ab7586d1797 100644
--- a/net-analyzer/fail2ban/fail2ban-9999.ebuild
+++ b/net-analyzer/fail2ban/fail2ban-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -6,7 +6,7 @@ EAPI=8
 DISTUTILS_SINGLE_IMPL=1
 PYTHON_COMPAT=( python3_{10..13} )
 
-inherit bash-completion-r1 distutils-r1 systemd tmpfiles
+inherit bash-completion-r1 edo python-single-r1 systemd tmpfiles
 
 DESCRIPTION="Scans log files and bans IPs that show malicious signs"
 HOMEPAGE="https://www.fail2ban.org/";
@@ -23,8 +23,10 @@ LICENSE="GPL-2"
 SLOT="0"
 IUSE="selinux systemd test"
 RESTRICT="!test? ( test )"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
 
 RDEPEND="
+       ${PYTHON_DEPS}
        $(python_gen_cond_dep '
                dev-python/pyasyncore[${PYTHON_USEDEP}]
                dev-python/pyasynchat[${PYTHON_USEDEP}]
@@ -53,15 +55,19 @@ PATCHES=(
        "${FILESDIR}"/${PN}-1.0.2-umask-tests.patch
 )
 
-python_prepare_all() {
-       distutils-r1_python_prepare_all
+src_prepare() {
+       default
 
        # Replace /var/run with /run, but not in the top source directory
        find . -mindepth 2 -type f -exec \
                sed -i -e 's|/var\(/run/fail2ban\)|\1|g' {} + || die
 }
 
-python_test() {
+src_compile() {
+       edo ${EPYTHON} setup.py build
+}
+
+src_test() {
        # Skip testRepairDb for bug #907348 (didn't always fail..)
        # https://github.com/fail2ban/fail2ban/issues/3586
        bin/fail2ban-testcases \
@@ -73,17 +79,20 @@ python_test() {
        rm -rf fail2ban.egg-info || die
 }
 
-python_install_all() {
-       distutils-r1_python_install_all
+src_install() {
+       edo ${EPYTHON} setup.py install --prefix="${EPREFIX}/usr" --root="${D}"
+       python_fix_shebang "${ED}"/usr/bin
+       python_optimize
+
+       einstalldocs
 
        rm -rf "${ED}"/usr/share/doc/${PN} "${ED}"/run || die
 
        newconfd files/fail2ban-openrc.conf ${PN}
-
        # These two are placed in the ${BUILD_DIR} after being "built"
        # in install_scripts().
-       newinitd "${BUILD_DIR}/fail2ban-openrc.init" "${PN}"
-       systemd_dounit "${BUILD_DIR}/${PN}.service"
+       newinitd "${S}"/build/fail2ban-openrc.init ${PN}
+       systemd_dounit "${S}"/build/${PN}.service
 
        dotmpfiles files/${PN}-tmpfiles.conf
 

Reply via email to