GNU bug report logs - #77072
[PATCH v1] channels: add transformer field

Previous Next

Package: guix-patches;

Reported by: Jakob Kirsch <jakob.kirsch <at> web.de>

Date: Mon, 17 Mar 2025 15:20:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 77072 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#77072; Package guix-patches. (Mon, 17 Mar 2025 15:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jakob Kirsch <jakob.kirsch <at> web.de>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 17 Mar 2025 15:20:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jakob Kirsch <jakob.kirsch <at> web.de>
To: guix-patches <at> gnu.org
Cc: guix-devel <at> gnu.org
Subject: [PATCH v1] channels: add transformer field
Date: Mon, 17 Mar 2025 16:19:35 +0100
[Message part 1 (text/plain, inline)]
Hey everyone,
I've recently tried to declaratively apply my own patches to the upstream guix channel or channels in general but I found it very hard (aka impossible) to do that cleanly so I made this simple patch.

This patch adds a new "transformer" field to the channel record. That "transformer" is a lambda that is called right before applying the quirk patches with the checkout path being its only argument.

What do you think about my proposal?
[v1-0001-channels-add-transformer-field.patch (text/plain, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#77072; Package guix-patches. (Sat, 22 Mar 2025 10:14:02 GMT) Full text and rfc822 format available.

Message #8 received at 77072 <at> debbugs.gnu.org (full text, mbox):

From: Rutherther <rutherther <at> ditigal.xyz>
To: 77072 <at> debbugs.gnu.org
Cc: Jakob Kirsch <jakob.kirsch <at> web.de>
Subject: Re: [PATCH v1] channels: add transformer field
Date: Sat, 22 Mar 2025 11:13:10 +0100
Hello Jakob,

I also encountered this issue and would like a way to transform
channels. However, I have a few notes.

While looking through the code I noticed latest-channel-instance
has an argument called patches. This argument is already capable of
applying patches. Each patch has a predicate and application function,
First the predicate is ran to know if the patch is applicable,
and if so, then it's applied with the application function.

Wouldn't it make sense to rather than making a new mechanism,
extend the current one, by adding to channels a new field
that will hold list of `patch` records, and then in
latest-channels-instance we would just do

```
(apply-patches checkout commit (channel-patches patches))
```

?

Apart from that I am wondering if this is going to be user friendly,
because I would imagine most people will just want to patch with already
existing commits. And for that it would be much easier to just have a
list of files to apply, similar to what origin has.
While this will be possible with this transformer field, it will mean
calling the patch (or I could've missed a function that does that
already).
So maybe at least exposing a new procedure to apply a list of patches
would be good, so users can then just do something like:

```
(channel
  (patches ;; already expecting list of patch records
    (make-channel-patches
      (list (local-file "fix-1.patch")))))
```
Where make-channel-patches takes a list of files
and returns a patch record returning #t for predicate,
and applying by calling the patch executable for each file, similarly
to what patch-and-repack in guix/packages.scm does.
Note that I am not sure if local-file is appropriate here
or if gexps are unusable.

What do you think?

Regards,
Rutherther




This bug report was last modified 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.