unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#73073] [PATCH 0/6] Allow origin with label as inputs.
@ 2024-09-06 15:51 Simon Tournier
  2024-09-06 15:54 ` [bug#73073] [PATCH 1/6] guix: packages: " Simon Tournier
                   ` (8 more replies)
  0 siblings, 9 replies; 43+ messages in thread
From: Simon Tournier @ 2024-09-06 15:51 UTC (permalink / raw)
  To: 73073; +Cc: Simon Tournier, maxim.cournoyer

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@gmail.com>
Fri, 06 Sep 2024 13:17:33 +0900
id:87msklct5u.fsf@gmail.com
https://issues.guix.gnu.org/73034
https://issues.guix.gnu.org/msgid/87msklct5u.fsf@gmail.com
https://yhetil.org/guix/87msklct5u.fsf@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





^ permalink raw reply related	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2024-12-12 12:21 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06 15:51 [bug#73073] [PATCH 0/6] Allow origin with label as inputs Simon Tournier
2024-09-06 15:54 ` [bug#73073] [PATCH 1/6] guix: packages: " Simon Tournier
2024-09-06 15:54 ` [bug#73073] [PATCH 2/6] gnu: dmd-bootstrap: Move phobos origin from phases to native-inputs Simon Tournier
2024-09-06 15:54 ` [bug#73073] [PATCH 3/6] gnu: smithforth: Move system.fs " Simon Tournier
2024-09-06 15:54 ` [bug#73073] [PATCH 4/6] gnu: gnome-recipes: Move libgd " Simon Tournier
2024-09-06 17:33   ` Liliana Marie Prikler
2024-09-06 18:11     ` Simon Tournier
2024-09-06 20:14       ` Liliana Marie Prikler
2024-09-07 11:37         ` Simon Tournier
2024-09-06 15:54 ` [bug#73073] [PATCH 5/6] gnu: farstream: Move common " Simon Tournier
2024-09-06 15:54 ` [bug#73073] [PATCH 6/6] gnu: gnulib: Move phobos " Simon Tournier
2024-09-06 21:45 ` [bug#73073] [PATCH 0/6] Allow origin with label as inputs Ludovic Courtès
2024-09-07 13:40   ` Simon Tournier
2024-09-07 14:49     ` Liliana Marie Prikler
2024-09-16 20:13     ` Ludovic Courtès
2024-09-10  1:27 ` [bug#73073] [PATCH v2 0/8] Allow origin inside inputs with "new style" Simon Tournier
2024-09-10  1:27   ` [bug#73073] [PATCH v2 1/8] guix: packages: " Simon Tournier
2024-09-16 20:19     ` Ludovic Courtès
2024-09-16 20:42       ` Simon Tournier
2024-09-26 13:30         ` Maxim Cournoyer
2024-09-10  1:27   ` [bug#73073] [PATCH v2 2/8] gnu: gnome-recipes: Move libgd origin from phases to native-inputs Simon Tournier
2024-09-10  4:30     ` Liliana Marie Prikler
2024-09-10  7:58       ` Simon Tournier
2024-09-10  1:27   ` [bug#73073] [PATCH v2 3/8] gnu: dmd-bootstrap: Move phobos " Simon Tournier
2024-09-10  1:27   ` [bug#73073] [PATCH v2 4/8] gnu: smithforth: Move system.fs " Simon Tournier
2024-09-10  1:27   ` [bug#73073] [PATCH v2 5/8] gnu: farstream: Move common " Simon Tournier
2024-09-10  1:27   ` [bug#73073] [PATCH v2 6/8] gnu: gnulib: Move phobos " Simon Tournier
2024-09-10  1:27   ` [bug#73073] [PATCH v2 7/8] gnu: git: Move git-manpages " Simon Tournier
2024-09-10  1:27   ` [bug#73073] [PATCH v2 8/8] gnu: cgit: Remove input labels Simon Tournier
2024-12-04 17:54 ` [bug#73073] [PATCH v3 0/8] Support lookups of origins used as package inputs Ludovic Courtès
2024-12-04 17:54   ` [bug#73073] [PATCH v3 1/8] packages: Use origin file names as their input labels Ludovic Courtès
2024-12-10 13:55     ` Simon Tournier
2024-12-12 11:19       ` Ludovic Courtès
2024-12-12 11:51         ` Simon Tournier
2024-12-04 17:54   ` [bug#73073] [PATCH v3 2/8] gnu: gnome-recipes: Move libgd origin from phases to native-inputs Ludovic Courtès
2024-12-04 18:29     ` Liliana Marie Prikler
2024-12-12 11:27       ` Ludovic Courtès
2024-12-04 17:54   ` [bug#73073] [PATCH v3 3/8] gnu: dmd-bootstrap: Move phobos " Ludovic Courtès
2024-12-04 17:54   ` [bug#73073] [PATCH v3 4/8] gnu: smithforth: Move system.fs " Ludovic Courtès
2024-12-04 17:54   ` [bug#73073] [PATCH v3 5/8] gnu: farstream: Move common " Ludovic Courtès
2024-12-04 17:54   ` [bug#73073] [PATCH v3 6/8] gnu: gnulib: Move phobos " Ludovic Courtès
2024-12-04 17:54   ` [bug#73073] [PATCH v3 7/8] gnu: git: Move git-manpages " Ludovic Courtès
2024-12-04 17:54   ` [bug#73073] [PATCH v3 8/8] gnu: cgit: Remove input labels Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).