[packages/fail2ban] backport py3.12+/py3.15 compat fixes (gh-3728, gh-4126); rel 4

arekm arekm at pld-linux.org
Tue Jul 21 14:20:32 CEST 2026


commit d44e6b79f6816bf2760a010994ecd1e24370a933
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Tue Jul 21 14:19:22 2026 +0200

    backport py3.12+/py3.15 compat fixes (gh-3728, gh-4126); rel 4

 fail2ban-exec_module.patch  | 20 ++++++++++++++++++++
 fail2ban-no-distutils.patch | 35 +++++++++++++++++++++++++++++++++++
 fail2ban.spec               |  6 +++++-
 3 files changed, 60 insertions(+), 1 deletion(-)
---
diff --git a/fail2ban.spec b/fail2ban.spec
index b9bccd2..1aa70cc 100644
--- a/fail2ban.spec
+++ b/fail2ban.spec
@@ -2,7 +2,7 @@ Summary:	Ban IPs that make too many password failures
 Summary(pl.UTF-8):	Blokowanie IP powodujących zbyt dużo prób logowań z błędnym hasłem
 Name:		fail2ban
 Version:	1.1.0
-Release:	3
+Release:	4
 License:	GPL
 Group:		Daemons
 Source0:	https://github.com/fail2ban/fail2ban/archive/%{version}.tar.gz
@@ -14,6 +14,8 @@ Source4:	%{name}.sysconfig
 Patch0:		logifiles.patch
 Patch1:		%{name}-config_from_git.patch
 Patch2:		%{name}-config_banaction.patch
+Patch3:		%{name}-no-distutils.patch
+Patch4:		%{name}-exec_module.patch
 URL:		http://fail2ban.sourceforge.net/
 BuildRequires:	python3-devel
 BuildRequires:	python3-modules
@@ -46,6 +48,8 @@ z sshd czy plikami logów serwera WWW Apache.
 %patch -P0 -p1
 %patch -P1 -p1
 %patch -P2 -p1
+%patch -P3 -p1
+%patch -P4 -p1
 rm setup.cfg
 
 sed -E -i -e '1s,#!\s*/usr/bin/env\s+python2(\s|$),#!%{__python3}\1,' -e '1s,#!\s*/usr/bin/env\s+python(\s|$),#!%{__python3}\1,' -e '1s,#!\s*/usr/bin/python(\s|$),#!%{__python3}\1,' \
diff --git a/fail2ban-exec_module.patch b/fail2ban-exec_module.patch
new file mode 100644
index 0000000..7d5c1a2
--- /dev/null
+++ b/fail2ban-exec_module.patch
@@ -0,0 +1,20 @@
+--- a/fail2ban/server/utils.py	2026-07-21 14:13:14.357454894 +0200
++++ b/fail2ban/server/utils.py	2026-07-21 14:13:14.359662323 +0200
+@@ -29,6 +29,7 @@
+ import sys
+ from	 threading import Lock
+ import time
++import types
+ from ..helpers import getLogger, _merge_dicts, uni_decode
+ from collections import OrderedDict
+ 
+@@ -352,6 +353,7 @@
+ 	def load_python_module(pythonModule):
+ 		pythonModuleName = os.path.splitext(
+ 			os.path.basename(pythonModule))[0]
+-		mod = importlib.machinery.SourceFileLoader(
+-			pythonModuleName, pythonModule).load_module()
++		ldr = importlib.machinery.SourceFileLoader(pythonModuleName, pythonModule)
++		mod = types.ModuleType(ldr.name)
++		ldr.exec_module(mod)
+ 		return mod
diff --git a/fail2ban-no-distutils.patch b/fail2ban-no-distutils.patch
new file mode 100644
index 0000000..84dd103
--- /dev/null
+++ b/fail2ban-no-distutils.patch
@@ -0,0 +1,35 @@
+--- a/fail2ban/server/filterpyinotify.py	2026-07-21 14:13:14.357090751 +0200
++++ b/fail2ban/server/filterpyinotify.py	2026-07-21 14:13:14.358134478 +0200
+@@ -24,7 +24,6 @@
+ __license__ = "GPL"
+ 
+ import logging
+-from distutils.version import LooseVersion
+ import os
+ from os.path import dirname, sep as pathsep
+ 
+@@ -37,10 +36,6 @@
+ from ..helpers import getLogger
+ 
+ 
+-if not hasattr(pyinotify, '__version__') \
+-  or LooseVersion(pyinotify.__version__) < '0.8.3': # pragma: no cover
+-  raise ImportError("Fail2Ban requires pyinotify >= 0.8.3")
+-
+ # Verify that pyinotify is functional on this system
+ # Even though imports -- might be dysfunctional, e.g. as on kfreebsd
+ try:
+--- a/fail2ban/server/filtersystemd.py	2026-07-21 14:13:14.357294609 +0200
++++ b/fail2ban/server/filtersystemd.py	2026-07-21 14:13:14.359497444 +0200
+@@ -24,11 +24,8 @@
+ 
+ import os
+ import time
+-from distutils.version import LooseVersion
+ 
+ from systemd import journal
+-if LooseVersion(getattr(journal, '__version__', "0")) < '204':
+-	raise ImportError("Fail2Ban requires systemd >= 204")
+ 
+ from .failmanager import FailManagerEmpty
+ from .filter import JournalFilter, Filter
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/fail2ban.git/commitdiff/d44e6b79f6816bf2760a010994ecd1e24370a933



More information about the pld-cvs-commit mailing list