GNU bug report logs - #73073
[PATCH 0/6] Allow origin with label as inputs.

Previous Next

Package: guix-patches;

Reported by: Simon Tournier <zimon.toutoune <at> gmail.com>

Date: Fri, 6 Sep 2024 15:52:01 UTC

Severity: normal

Tags: moreinfo, patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: 73073 <at> debbugs.gnu.org
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>, maxim.cournoyer <at> gmail.com
Subject: [bug#73073] [PATCH 0/6] Allow origin with label as inputs.
Date: Fri,  6 Sep 2024 17:51:14 +0200
Hi,

As discussed in bug#73034 [1], these 5 packages – farstream,
gnulib-checkout, smithforth, gnome-recipes and dmd-bootstrap – have an
origin inside the ’arguments’ package record.

This is annoying because these origins are hidden from
’package-direct-sources’; see module (guix packages).

I consider this is bug. :-)  Hence this prposal for fixing it.

Moreover and tangentially, it appears to me an anti-pattern of the
functional paradigm: The data from the impure outside should be handled
by the ’source’ record field, or otherwise by ’inputs’, ’native-inputs’
or ’propagated-inputs’ record fields; let say only ’inputs’ for
simplicity.

To my knowledge, using the old style with label, we strove on this
principle.  However, using the “new style” [2], it does not offer to
have labels with plain package symbol.  In other words, for example,
this snippet does not work:

      (list gdmd which
            `("phobos"
              ,(origin
                 (method git-fetch)
                 (uri (git-reference
                       (url "https://github.com/dlang/phobos")
                       (commit (string-append "v" version))))
                 (file-name (git-file-name "phobos" version))
                 (sha256
                  (base32
                   "1yw7nb5d78cx9m7sfibv7rfc7wj3w0dw9mfk3d269qpfpnwzs4n9"))))))

The reason is because ’sanitize-inputs’; see module (guix packages).

    ((_ (list args ...))
     (add-input-labels args ...))
    ((_ inputs)
     (maybe-add-input-labels inputs))))

Roughly speaking, because the ’inputs’ starts by the term ’list’ then
’add-input-labels’ is applied, else it applies ’maybe-add-input-labels’.

Note that:

    (define (add-input-labels . inputs)
      "Add labels to all of INPUTS if needed (this is the rest-argument version of
    'maybe-add-input-labels')."
      (maybe-add-input-labels inputs))

The procedure ’maybe-add-input-labels’ reads: if the first element of
the ’inputs’ record field is using the “old style“ then return all
as-is, assuming all are “old style”.  Else apply to all the ’inputs’
elements the procedure ’add-input-label’.

Hence the simple proposal:

--8<---------------cut here---------------start------------->8---
diff --git a/guix/packages.scm b/guix/packages.scm
index f373136d22..5fea44c2bb 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -676,6 +676,8 @@ (define (add-input-label input)
               "_")
          ,obj
          ,@(if (string=? output "out") '() (list output)))))
+    (((? string? label) obj) ;Allow old style as sometimes requires by origin in inputs
+     `(,label ,obj))
     (x
      `("_" ,x))))
--8<---------------cut here---------------end--------------->8---

This allows to write ’inputs’ as above. :-)  As done with the 5 packages.

And it does not hurt the new style.  Maybe “guix style” would need to be
adjusted too?

WDYT?

Cheers,
simon


1: [bug#73034] [PATCH v3 0/3] Fix annoyances of Git and update to 2.46.0
Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Fri, 06 Sep 2024 13:17:33 +0900
id:87msklct5u.fsf <at> gmail.com
https://issues.guix.gnu.org/73034
https://issues.guix.gnu.org/msgid/87msklct5u.fsf <at> gmail.com
https://yhetil.org/guix/87msklct5u.fsf <at> gmail.com

2: https://guix.gnu.org/en/blog/2021/the-big-change/

Simon Tournier (6):
  guix: packages: Allow origin with label as inputs.
  gnu: dmd-bootstrap: Move phobos origin from phases to native-inputs.
  gnu: smithforth: Move system.fs origin from phases to native-inputs.
  gnu: gnome-recipes: Move libgd origin from phases to native-inputs.
  gnu: farstream: Move common origin from phases to native-inputs.
  gnu: gnulib: Move phobos origin from phases to native-inputs.

 gnu/packages/build-tools.scm | 18 ++++++++++--------
 gnu/packages/dlang.scm       | 22 ++++++++++++----------
 gnu/packages/forth.scm       | 20 +++++++++++---------
 gnu/packages/freedesktop.scm | 24 +++++++++++++-----------
 gnu/packages/gnome.scm       | 22 ++++++++++++----------
 guix/packages.scm            |  2 ++
 6 files changed, 60 insertions(+), 48 deletions(-)


base-commit: 7d2ced8d6d9c38327592d312376d59a8c37fc160
-- 
2.45.2





This bug report was last modified 237 days ago.

Previous Next


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