Subject: [bug#78066] [PATCH v3 6/6] gnu: fail2ban: Improve snippet.

From: Nicolas Graves <[email-masked]>
Date: Sun, 4 May 2025 10:56:26 +0200

* gnu/packages/admin.scm (fail2ban)
  [source]<modules>: Remove (srfi srfi-26).
  <snippet>: Use gexp. Move substitute* patches...
  [arguments]<phases>: ...to phases 'patch-setup.py and 'disable-some-tests.
---
 gnu/packages/admin.scm | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index e508340ef0..8fee710c7f 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -6218,23 +6218,19 @@ (define-public fail2ban
                  "'usr/share/doc/fail2ban'"))))
           (add-after 'unpack 'disable-some-tests
             (lambda _
-              (define (make-suite str)
-                (string-append "tests.addTest\\(loadTests\\(" str "\\)\\)"))
+              (define (make-suite-regex tests)
+                (string-append "tests.addTest\\(loadTests\\(("
+                               (string-join tests "|")
+                               ")\\)\\)"))
               ;; disable tests performing unacceptable side-effects
               (substitute* "fail2ban/tests/utils.py"
-                (((make-suite "actiontestcase.CommandActionTest"))
-                 "")
-                (((make-suite "misctestcase.SetupTest"))
-                 "")
-                (((make-suite "filtertestcase.DNSUtilsNetworkTests"))
-                 "")
-                (((make-suite "filtertestcase.IgnoreIPDNS"))
-                 "")
-                (((make-suite "filtertestcase.GetFailures"))
-                 "")
-                (((make-suite "fail2banclienttestcase.Fail2banServerTest"))
-                 "")
-                (((make-suite "servertestcase.ServerConfigReaderTests"))
+                (((make-suite-regex (list "actiontestcase.CommandActionTest"
+                                          "misctestcase.SetupTest"
+                                          "filtertestcase.DNSUtilsNetworkTests"
+                                          "filtertestcase.IgnoreIPDNS"
+                                          "filtertestcase.GetFailures"
+                                          "fail2banclienttestcase.Fail2banServerTest"
+                                          "servertestcase.ServerConfigReaderTests")))
                  ""))))
           (add-before 'build 'fix-default-config
             (lambda _
-- 
2.49.0