[bug#78066,v2,1/5] gnu: fail2ban: Move file deletion to source snippet.
Commit Message
* gnu/packages/admin.scm (fail2ban)
[arguments]<phases>: Move multiple file deletion from here...
[source]<snippet>: ...to here.
---
gnu/packages/admin.scm | 64 +++++++++++++++++++++---------------------
1 file changed, 32 insertions(+), 32 deletions(-)
Comments
Hello Nicolas,
thanks for the update!
Am Sun, Apr 27, 2025 at 11:08:08AM +0200 schrieb Nicolas Graves:
> * gnu/packages/admin.scm (fail2ban)
> [arguments]<phases>: Move multiple file deletion from here...
> [source]<snippet>: ...to here.
> + ;; deleting things that are not feasible to fix
> + ;; or won't be used any way
What is the motivation for this change? I think we always remove
non-free code and often bundled libraries in a snippet, but changes only
related to the idiosyncrasies of Guix usually occur in the phases. In this
way, "guix build -S" returns essentially the source code of a package.
But this is not written policy, so no hard obstacle to pushing the
commit; I just do not see why a snippet would be better than a phase.
Andreas
On 2025-04-29 10:00, Andreas Enge wrote:
> Hello Nicolas,
>
> thanks for the update!
>
> Am Sun, Apr 27, 2025 at 11:08:08AM +0200 schrieb Nicolas Graves:
>> * gnu/packages/admin.scm (fail2ban)
>> [arguments]<phases>: Move multiple file deletion from here...
>> [source]<snippet>: ...to here.
>> + ;; deleting things that are not feasible to fix
>> + ;; or won't be used any way
>
> What is the motivation for this change? I think we always remove
> non-free code and often bundled libraries in a snippet, but changes only
> related to the idiosyncrasies of Guix usually occur in the phases. In this
> way, "guix build -S" returns essentially the source code of a package.
>
> But this is not written policy, so no hard obstacle to pushing the
> commit; I just do not see why a snippet would be better than a phase.
My rationale was that those files are not going to be used and are
replaced by a guix alternative file, provided as a patch. Since they
are removed anyway, it's arguably better to remove them from source too,
as not to download them when not needed. It might also be better for
readability of the phases replacement.
But it's not also an issue if we prefer to keep them in phases, I don't
really care.
On 2025-04-30 09:59, Nicolas Graves wrote:
> On 2025-04-29 10:00, Andreas Enge wrote:
>
>> Hello Nicolas,
>>
>> thanks for the update!
>>
>> Am Sun, Apr 27, 2025 at 11:08:08AM +0200 schrieb Nicolas Graves:
>>> * gnu/packages/admin.scm (fail2ban)
>>> [arguments]<phases>: Move multiple file deletion from here...
>>> [source]<snippet>: ...to here.
>>> + ;; deleting things that are not feasible to fix
>>> + ;; or won't be used any way
>>
>> What is the motivation for this change? I think we always remove
>> non-free code and often bundled libraries in a snippet, but changes only
>> related to the idiosyncrasies of Guix usually occur in the phases. In this
>> way, "guix build -S" returns essentially the source code of a package.
>>
>> But this is not written policy, so no hard obstacle to pushing the
>> commit; I just do not see why a snippet would be better than a phase.
>
> My rationale was that those files are not going to be used and are
> replaced by a guix alternative file, provided as a patch. Since they
> are removed anyway, it's arguably better to remove them from source too,
> as not to download them when not needed. It might also be better for
> readability of the phases replacement.
>
> But it's not also an issue if we prefer to keep them in phases, I don't
> really care.
Maybe it's better to only remove files for other distros in snippet, and
remove files in action.d in phases, that would make better sense overall
IMO.
I'll change that.
@@ -6244,6 +6244,38 @@ (define-public fail2ban
(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")))
;; Get rid of absolute file names.
(substitute* "setup.py"
(("/etc/fail2ban")
@@ -6305,38 +6337,6 @@ (define-public fail2ban
"/etc/fail2ban")))))
(add-after 'fix-default-config 'set-action-dependencies
(lambda* (#:key inputs #:allow-other-keys)
- ;; 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")))
(let* ((lookup-cmd (lambda (i)
(search-input-file inputs i)))
(bin (lambda (i)