From 1243b0dcffbaa69d475a2f5c6e340cee73d34cf9 Mon Sep 17 00:00:00 2001 From: Richard Shaw Date: Wed, 31 Dec 2025 09:07:24 -0600 Subject: [PATCH] Remove obsolete distro version related conditionals. --- fail2ban.spec | 68 --------------------------------------------------- 1 file changed, 68 deletions(-) diff --git a/fail2ban.spec b/fail2ban.spec index 44bf5d9..d7945ec 100644 --- a/fail2ban.spec +++ b/fail2ban.spec @@ -57,36 +57,17 @@ Patch5: https://github.com/fail2ban/fail2ban/commit/54c0effceb998b73545073ac59c4 BuildArch: noarch -%if 0%{?rhel} && 0%{?rhel} < 8 -BuildRequires: python-devel -BuildRequires: python-setuptools -# For testcases -BuildRequires: python-inotify -%else BuildRequires: python3-devel BuildRequires: python3-setuptools # For testcases BuildRequires: python3-inotify -%endif -# using a python3_version-based conditional does not work here, so -# this is a proxy for "Python version greater than 3.12". asyncore -# and asynchat were dropped from cpython core in 3.12, these modules -# make them available again. See: -# https://github.com/fail2ban/fail2ban/issues/3487 -# https://bugzilla.redhat.com/show_bug.cgi?id=2219991 -%if 0%{?fedora} > 38 BuildRequires: python3-pyasyncore BuildRequires: python3-pyasynchat -%endif BuildRequires: sqlite BuildRequires: systemd BuildRequires: selinux-policy-devel BuildRequires: make -%if 0%{?fedora} >= 41 BuildRequires: bash-completion-devel -%else -BuildRequires: bash-completion -%endif BuildRequires: gnupg2 # Default components @@ -123,27 +104,15 @@ SELinux policies for Fail2Ban. %package server Summary: Core server component for Fail2Ban -%if 0%{?rhel} && 0%{?rhel} < 8 -Requires: systemd-python -Requires: ipset -Requires: iptables -%else Requires: python3-systemd Requires: nftables -%endif Requires(post): systemd Requires(preun): systemd Requires(postun): systemd -%if 0%{?fedora} || 0%{?rhel} >= 8 Requires: (%{name}-selinux if selinux-policy-%{selinuxtype}) -%else -Requires: %{name}-selinux -%endif # see note above in BuildRequires section -%if 0%{?fedora} > 38 Requires: python3-pyasyncore Requires: python3-pyasynchat -%endif %description server This package contains the core server components for Fail2Ban with minimal @@ -162,13 +131,7 @@ Requires: %{name}-server = %{version}-%{release} Requires: %{name}-shorewall = %{version}-%{release} %endif Requires: perl-interpreter -%if 0%{?rhel} && 0%{?rhel} < 8 -Requires: python-inotify -# No python3 support for gamin so epel only -Requires: gamin-python -%else Requires: python3-inotify -%endif Requires: /usr/bin/whois %description all @@ -260,9 +223,7 @@ by default. %autosetup -p1 # this test uses smtpd which is removed in Python 3.12, rewriting it # isn't trivial -%if 0%{?fedora} > 38 rm -f fail2ban/tests/action_d/test_smtp.py -%endif # Use Fedora paths sed -i -e 's/^before = paths-.*/before = paths-fedora.conf/' config/jail.conf @@ -284,26 +245,16 @@ sed -i "/use_2to3/d" setup.py %build -%if 0%{?rhel} && 0%{?rhel} < 8 -%py2_build -%else %pyproject_wheel -%endif make -f %SOURCE6 %install -%if 0%{?rhel} && 0%{?rhel} < 8 -%py2_install -# Make symbolic link relative -ln -fs python2 %{buildroot}%{_bindir}/fail2ban-python -%else %pyproject_install ln -fs python3 %{buildroot}%{_bindir}/fail2ban-python mv %{buildroot}%{python3_sitelib}/etc %{buildroot} mv %{buildroot}%{python3_sitelib}/%{_datadir} %{buildroot}%{_datadir} rmdir %{buildroot}%{python3_sitelib}%{_prefix} -%endif mkdir -p %{buildroot}%{_unitdir} # Note that the tests rewrite build/fail2ban.service, but it uses build/ paths before the rewrite @@ -364,17 +315,7 @@ COMPLETIONDIR=%{buildroot}$(pkg-config --variable=completionsdir bash-completion %check -%if 0%{?rhel} && 0%{?rhel} < 8 -%python2 bin/fail2ban-testcases --verbosity=2 --no-network -%else -%if 0%{?fedora} > 38 -# testRepairDb does not work with sqlite 3.42.0+ -# https://github.com/fail2ban/fail2ban/issues/3586 -%python3 bin/fail2ban-testcases --verbosity=2 --no-network -i testRepairDb -%else %python3 bin/fail2ban-testcases --verbosity=2 --no-network -%endif -%endif %pre selinux @@ -414,13 +355,8 @@ fi %{_bindir}/fail2ban-python %{_bindir}/fail2ban-regex %{_bindir}/fail2ban-server -%if 0%{?rhel} && 0%{?rhel} < 8 -%{python2_sitelib}/* -%exclude %{python2_sitelib}/fail2ban/tests -%else %{python3_sitelib}/* %exclude %{python3_sitelib}/fail2ban/tests -%endif %{_unitdir}/fail2ban.service %{_datadir}/bash-completion/ %{_mandir}/man1/fail2ban.1* @@ -456,11 +392,7 @@ fi %files tests %{_bindir}/fail2ban-testcases %{_mandir}/man1/fail2ban-testcases.1* -%if 0%{?rhel} && 0%{?rhel} < 8 -%{python2_sitelib}/fail2ban/tests -%else %{python3_sitelib}/fail2ban/tests -%endif %files mail %config(noreplace) %{_sysconfdir}/fail2ban/action.d/complain.conf