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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#73073: closed ([PATCH 0/6] Allow origin with label as inputs.)
Date: Sun, 15 Dec 2024 23:29:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 16 Dec 2024 00:28:12 +0100
with message-id <87msgwfrw3.fsf <at> gnu.org>
and subject line Re: [bug#73073] [PATCH v3 0/8] Support lookups of origins used as package inputs
has caused the debbugs.gnu.org bug report #73073,
regarding [PATCH 0/6] Allow origin with label as inputs.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
73073: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73073
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: [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



[Message part 3 (message/rfc822, inline)]
From: Ludovic Courtès <ludo <at> gnu.org>
To: 73073-done <at> debbugs.gnu.org
Subject: Re: [bug#73073] [PATCH v3 0/8] Support lookups of origins used as
 package inputs
Date: Mon, 16 Dec 2024 00:28:12 +0100
Hi,

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

> This is v3 of the patch series submitted by Simon, rebased
> on current ‘master’.
>
> The main change is the removal of special-casing from (guix
> packages), as suggested before, and the addition of a test.
>
> It passes “the LibreOffice test” (no world rebuild).
>
> Objetions?

Pushed as 79f8769530cc78297b2443856984b2b1338caa3c.

However, I had to drop the ‘git’ change because in the meantime it has
gained several thousand dependents (see
<https://issues.guix.gnu.org/74892>.)

I also fixed the “libgd-checkout” issue in ‘gnome-recipes’.

Last, I added a few words in the manual (commit
f8f005815efdf9f0d5d2a5ac30c6fdd19aa22e72).

Thanks,
Ludo’.


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.