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


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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Simon Tournier <zimon.toutoune <at> gmail.com>
Cc: maxim.cournoyer <at> gmail.com, 73073 <at> debbugs.gnu.org
Subject: Re: [bug#73073] [PATCH 0/6] Allow origin with label as inputs.
Date: Fri, 06 Sep 2024 23:45:04 +0200
[Message part 1 (text/plain, inline)]
Hello,

Simon Tournier <zimon.toutoune <at> gmail.com> skribis:

> The reason is because ’sanitize-inputs’; see module (guix packages).
>
>     ((_ (list args ...))
>      (add-input-labels args ...))
>     ((_ inputs)
>      (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’.

Yes: as an optimization, we just check the first element or even just
the syntax (whether the value starts with (list …)).

This is one reason why I’d rather avoid the change you’re suggesting.
But more importantly: I think we should avoid polymorphic lists for
clarity (the principle is followed in most of the code), and
reintroducing labels would be a step backwards.

To be clear, I understand the current situation is not perfect, but I
would rather look for solutions that do not involve undoing what’s taken
this long to do.

The main issue we want to address here is origins being hidden from
‘package-direct-sources’, right?

What if we could do this:

[Message part 2 (text/x-patch, inline)]
diff --git a/guix/packages.scm b/guix/packages.scm
index f373136d22..624d3d8c45 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1320,7 +1320,16 @@ (define (package-direct-sources package)
                    ((_ (? origin? orig) _ ...)
                     orig)
                    (_ #f))
-                  (package-direct-inputs package))))
+                  (package-direct-inputs package))
+    (match (assoc #:phases (package-arguments package))
+      ((#:phases (? gexp? phases) . _)
+       (filter-map (lambda (input)
+                     (match (gexp-input-thing input)
+                       ((? origin? o) o)
+                       (_ #f)))
+                   (gexp-inputs phases)))
+      (_
+       '()))))
 
 (define (package-transitive-sources package)
   "Return PACKAGE's direct sources, and their direct sources, recursively."
[Message part 3 (text/plain, inline)]
?  (Currently we can’t because ‘gexp-inputs’ is private.)

Or, alternatively, we’d have origins without labels in inputs, with
this:

[Message part 4 (text/x-patch, inline)]
diff --git a/guix/packages.scm b/guix/packages.scm
index f373136d22..8b08f0d379 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)))))
+    ((? origin? origin)
+     (list (or (origin-actual-file-name origin) "_") origin))
     (x
      `("_" ,x))))
 
[Message part 5 (text/plain, inline)]
… meaning we could write (this-package-input "git-manpages.tar.gz") or
similar.  (This particular change would need tweaks in a few packages
such as ‘tzdata’ to avoid a full rebuild.)

WDYT?

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.