Package: guix-patches;
Reported by: Rodion Goritskov <rodion <at> goritskov.com>
Date: Fri, 25 Apr 2025 20:14:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: Nicolas Graves <ngraves <at> ngraves.fr> To: 78066 <at> debbugs.gnu.org Cc: Nicolas Graves <ngraves <at> ngraves.fr> Subject: [bug#78066] [PATCH v2 4/5] gnu: fail2ban: Improve snippet. Date: Sun, 27 Apr 2025 11:08:11 +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 | 127 +++++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 63 deletions(-) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index 1f48eb264d..25bce63aaf 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -6241,69 +6241,36 @@ (define-public fail2ban (file-name (git-file-name name version)) (sha256 (base32 "0lfakna6ad2xwz95sjxzkavipcsxiy7ybavkdkf9zzmspf2ws4yk")) - (modules '((guix build utils) - (srfi srfi-26))) - (snippet '(begin - ;; deleting things that are not feasible to fix - ;; or won't be used any way - (with-directory-excursion "config" - (for-each delete-file - '("paths-arch.conf" "paths-debian.conf" - "paths-fedora.conf" "paths-freebsd.conf" - "paths-opensuse.conf" "paths-osx.conf"))) - (with-directory-excursion "config/action.d" - (for-each delete-file - '("apf.conf" "bsd-ipfw.conf" - "dshield.conf" - "ipfilter.conf" - "ipfw.conf" - "firewallcmd-allports.conf" - "firewallcmd-common.conf" - "firewallcmd-ipset.conf" - "firewallcmd-multiport.conf" - "firewallcmd-new.conf" - "firewallcmd-rich-logging.conf" - "firewallcmd-rich-rules.conf" - "osx-afctl.conf" - "osx-ipfw.conf" - "pf.conf" - "nginx-block-map.conf" - "npf.conf" - "shorewall.conf" - "shorewall-ipset-proto6.conf" - "ufw.conf"))) - ;; Get rid of absolute file names. - (substitute* "setup.py" - (("/etc/fail2ban") - "etc/fail2ban") - (("/var/lib/fail2ban") - "var/lib/fail2ban") - (("\"/usr/bin/\"") - "\"usr/bin/\"") - (("\"/usr/lib/fail2ban/\"") - "\"usr/lib/fail2ban/\"") - (("'/usr/share/doc/fail2ban'") - "'usr/share/doc/fail2ban'")) - ;; disable tests performing unacceptable side-effects - (let ((make-suite (cut string-append - "tests.addTest\\(loadTests\\(" <> - "\\)\\)"))) - (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")) - ""))))) + (modules '((guix build utils))) + (snippet #~(begin + ;; deleting things that are not feasible to fix + ;; or won't be used any way + (with-directory-excursion "config" + (for-each delete-file + '("paths-arch.conf" "paths-debian.conf" + "paths-fedora.conf" "paths-freebsd.conf" + "paths-opensuse.conf" "paths-osx.conf"))) + (with-directory-excursion "config/action.d" + (for-each delete-file + '("apf.conf" "bsd-ipfw.conf" + "dshield.conf" + "ipfilter.conf" + "ipfw.conf" + "firewallcmd-allports.conf" + "firewallcmd-common.conf" + "firewallcmd-ipset.conf" + "firewallcmd-multiport.conf" + "firewallcmd-new.conf" + "firewallcmd-rich-logging.conf" + "firewallcmd-rich-rules.conf" + "osx-afctl.conf" + "osx-ipfw.conf" + "pf.conf" + "nginx-block-map.conf" + "npf.conf" + "shorewall.conf" + "shorewall-ipset-proto6.conf" + "ufw.conf"))))) (patches (search-patches "fail2ban-paths-guix-conf.patch")))) (build-system pyproject-build-system) (arguments @@ -6316,6 +6283,40 @@ (define-public fail2ban (substitute* '("bin/fail2ban-testcases" "setup.py") ((".*updatePyExec.*") "")))) + (add-after 'unpack 'patch-setup.py + (lambda _ + ;; Get rid of absolute file names. + (substitute* "setup.py" + (("/etc/fail2ban") + "etc/fail2ban") + (("/var/lib/fail2ban") + "var/lib/fail2ban") + (("\"/usr/bin/\"") + "\"usr/bin/\"") + (("\"/usr/lib/fail2ban/\"") + "\"usr/lib/fail2ban/\"") + (("'/usr/share/doc/fail2ban'") + "'usr/share/doc/fail2ban'")))) + (add-after 'unpack 'disable-some-tests + (lambda _ + (define (make-suite str) + (string-append "tests.addTest\\(loadTests\\(" str "\\)\\)")) + ;; 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")) + "")))) (add-before 'install 'fix-default-config (lambda _ (substitute* '("config/paths-common.conf" -- 2.49.0
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.