[PATCH 0/6] Allow origin with label as inputs.

  • Open
  • quality assurance status badge
Details
4 participants
  • Liliana Marie Prikler
  • Ludovic Courtès
  • Maxim Cournoyer
  • Simon Tournier
Owner
unassigned
Submitted by
Simon Tournier
Severity
normal
S
S
Simon Tournier wrote on 6 Sep 17:51 +0200
(address . guix-patches@gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
cover.1725636992.git.zimon.toutoune@gmail.com
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
(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:

Toggle snippet (14 lines)
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))))

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


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
S
S
Simon Tournier wrote on 6 Sep 17:54 +0200
[PATCH 1/6] guix: packages: Allow origin with label as inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
5cbe0dd85c9326d7e598e7a9c30d7d26f1abdaa9.1725636992.git.zimon.toutoune@gmail.com
* guix/packages.scm (add-input-label): Allow the old style pattern using label
as it is sometimes required by origins listed under inputs record field.

Change-Id: I799612976a0051d4c953969d12d71913c9243cd4
---
guix/packages.scm | 2 ++
1 file changed, 2 insertions(+)

Toggle diff (15 lines)
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))))
--
2.45.2
S
S
Simon Tournier wrote on 6 Sep 17:54 +0200
[PATCH 2/6] gnu: dmd-bootstrap: Move phobos origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
1314d9ad29285e77e0b219bf2aee1ebd59cfbdff.1725636992.git.zimon.toutoune@gmail.com
* gnu/packages/dlang.scm (dmd-bootstrap)[arguments]<phases>: Move git-manpages
origin from here...
[native-inputs]: ...to here.

Change-Id: I10cb5f628dad2fdbb01df58134996bdcd0b73d62
---
gnu/packages/dlang.scm | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

Toggle diff (42 lines)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 8bf0ee685e..d7a15f0214 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -456,15 +456,7 @@ (define dmd-bootstrap
(lambda _
(symlink "." "dmd") ;to please the build system expected layout
(copy-recursively
- #$(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")))
+ #$(this-package-native-input "phobos")
"phobos")
(chdir "phobos")))
(add-after 'copy-phobos-source-and-chdir 'adjust-phobos-install-dirs
@@ -519,7 +511,17 @@ (define dmd-bootstrap
"lib")
(("\\.\\./src/(phobos|druntime/import)")
"include/dmd")))))))
- (native-inputs (list gdmd which))
+ (native-inputs (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"))))))
(home-page "https://github.com/dlang/dmd")
(synopsis "Reference D Programming Language compiler")
(description "@acronym{DMD, Digital Mars D compiler} is the reference
--
2.45.2
S
S
Simon Tournier wrote on 6 Sep 17:54 +0200
[PATCH 3/6] gnu: smithforth: Move system.fs origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
7290803e3a6387b3497098030f08cf241d76dc8c.1725636992.git.zimon.toutoune@gmail.com
* gnu/packages/dlang.scm (smithforth)[arguments]<phases>: Move system.fs
origin from here...
[native-inputs]: ...to here.

Change-Id: I82ff81f72dbe2ecf70fbbd44674596e1a62cadcf
---
gnu/packages/forth.scm | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

Toggle diff (40 lines)
diff --git a/gnu/packages/forth.scm b/gnu/packages/forth.scm
index 6e8d8cdc4c..43b497b453 100644
--- a/gnu/packages/forth.scm
+++ b/gnu/packages/forth.scm
@@ -75,7 +75,16 @@ (define-public smithforth
(sha256
(base32 "0a39pv7529llsa3f48fmvwvlcp3f9v8qkn5ziw2l6kxf0qvli3lm"))))
(build-system trivial-build-system)
- (native-inputs (list xxd))
+ (native-inputs (list xxd
+ `("system.fs"
+ ,(origin
+ (method url-fetch)
+ (uri (string-append
+ "https://dacvs.neocities.org/SF/system"
+ version "fs.txt"))
+ (sha256
+ (base32
+ "17v1pp64s6n8q8w3kg48nd7zdcx2208y4svr5fpfms5lkyzg7z1m"))))))
(arguments
(list
#:modules '((guix build utils))
@@ -84,14 +93,7 @@ (define-public smithforth
(use-modules (guix build utils)
(ice-9 textual-ports))
(let* ((sforth.dmp #$(package-source this-package))
- (system.fs #$(origin
- (method url-fetch)
- (uri (string-append
- "https://dacvs.neocities.org/SF/system"
- version "fs.txt"))
- (sha256
- (base32
- "17v1pp64s6n8q8w3kg48nd7zdcx2208y4svr5fpfms5lkyzg7z1m"))))
+ (system.fs #$(this-package-native-input "system.fs"))
(xxd (string-append (assoc-ref %build-inputs "xxd")
"/bin/xxd"))
(bin (string-append (assoc-ref %outputs "out") "/bin")))
--
2.45.2
S
S
Simon Tournier wrote on 6 Sep 17:54 +0200
[PATCH 4/6] gnu: gnome-recipes: Move libgd origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
4b84954a845391197ebbdbb7f5c9d04eb3ecdc7f.1725636992.git.zimon.toutoune@gmail.com
* gnu/packages/dlang.scm (gnome-recipes)[arguments]<phases>: Move libgd
origin from here...
[native-inputs]: ...to here.

Change-Id: I137dc41819a680fdf1f5c0bea9778b2bceae3fad
---
gnu/packages/gnome.scm | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)

Toggle diff (42 lines)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 7339000436..8ae9fb0656 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -799,15 +799,7 @@ (define-public gnome-recipes
(add-after 'unpack 'unpack-libgd
(lambda _
(copy-recursively
- #$(origin
- (method git-fetch)
- (uri (git-reference
- (url "https://gitlab.gnome.org/GNOME/libgd")
- (commit "c7c7ff4e05d3fe82854219091cf116cce6b19de0")))
- (file-name (git-file-name "libgd" version))
- (sha256
- (base32
- "16yld0ap7qj1n96h4f2sqkjmibg7xx5xwkqxdfzam2nmyfdlrrrs")))
+ #$(this-package-native-input "libgd")
"subprojects/libgd"))))))
(inputs (list glib
gnome-autoar
@@ -823,7 +815,17 @@ (define-public gnome-recipes
`(,glib "bin")
itstool
pkg-config
- python))
+ python
+ `("libgd"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://gitlab.gnome.org/GNOME/libgd")
+ (commit "c7c7ff4e05d3fe82854219091cf116cce6b19de0")))
+ (file-name (git-file-name "libgd" version))
+ (sha256
+ (base32
+ "16yld0ap7qj1n96h4f2sqkjmibg7xx5xwkqxdfzam2nmyfdlrrrs"))))))
(home-page "https://wiki.gnome.org/Apps/Recipes")
(synopsis "Discover recipes for preparing food")
(description "GNOME Recipes helps you discover what to cook today,
--
2.45.2
S
S
Simon Tournier wrote on 6 Sep 17:54 +0200
[PATCH 5/6] gnu: farstream: Move common origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
ffffc568cebbd4dc5f66234346287c61023ec1ea.1725636992.git.zimon.toutoune@gmail.com
* gnu/packages/dlang.scm (farstream)[arguments]<phases>: Move common
origin from here...
[native-inputs]: ...to here.

Change-Id: I0023bca2fc021b82875b1ec7329c7e37116df0b3
---
gnu/packages/freedesktop.scm | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)

Toggle diff (44 lines)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index cb1d625d24..cf4ccadfd0 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -263,16 +263,7 @@ (define-public farstream
(lambda _
(delete-file "autogen.sh")
(copy-recursively
- #$(origin
- (method git-fetch)
- (uri
- (git-reference
- (url "https://gitlab.freedesktop.org/gstreamer/common.git")
- (commit "52adcdb89a9eb527df38c569539d95c1c7aeda6e")))
- (file-name (git-file-name "common" "latest.52adcdb"))
- (sha256
- (base32
- "1zlm1q1lgcb76gi82rial5bwy2j9sz1x6x48ijhiz89cml7xxd1r")))
+ #$(this-package-native-input "common")
"common")))
(add-after 'unpack 'disable-problematic-tests
(lambda _
@@ -296,7 +287,18 @@ (define-public farstream
libxslt
perl
pkg-config
- python-wrapper))
+ python-wrapper
+ `("common"
+ ,(origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://gitlab.freedesktop.org/gstreamer/common.git")
+ (commit "52adcdb89a9eb527df38c569539d95c1c7aeda6e")))
+ (file-name (git-file-name "common" "latest.52adcdb"))
+ (sha256
+ (base32
+ "1zlm1q1lgcb76gi82rial5bwy2j9sz1x6x48ijhiz89cml7xxd1r"))))))
(inputs
(list glib
gtk+
--
2.45.2
S
S
Simon Tournier wrote on 6 Sep 17:54 +0200
[PATCH 6/6] gnu: gnulib: Move phobos origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
653e94eac23daf6df64ca4ef2bf5f417182dfef1.1725636992.git.zimon.toutoune@gmail.com
* gnu/packages/dlang.scm (gnulib-checkout)[arguments]<phases>: Move PropList
origin from here...
[native-inputs]: ...to here.

Change-Id: I3576a169837039bc6beaae0d68ab459ed642e3c8
---
gnu/packages/build-tools.scm | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

Toggle diff (38 lines)
diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
index 21df25e4f5..f9e51e6408 100644
--- a/gnu/packages/build-tools.scm
+++ b/gnu/packages/build-tools.scm
@@ -942,14 +942,7 @@ (define*-public (gnulib-checkout #:key
"Scripts.txt"
"Blocks.txt")
(list
- #$(origin
- (method url-fetch)
- (uri (string-append
- "https://www.unicode.org/Public/"
- "3.0-Update1/PropList-3.0.1.txt"))
- (sha256
- (base32
- "0k6wyijyzdl5g3nibcwfm898kfydx1pqaz28v7fdvnzdvd5fz7lh"))))
+ #$(this-package-native-input "proplist"))
(find-ucd-files "BidiMirroring.txt"
"EastAsianWidth.txt"
"LineBreak.txt"
@@ -982,6 +975,15 @@ (define*-public (gnulib-checkout #:key
bash-minimal python perl clisp
;; Unicode data:
ucd
+ `("proplist"
+ ,(origin
+ (method url-fetch)
+ (uri (string-append
+ "https://www.unicode.org/Public/"
+ "3.0-Update1/PropList-3.0.1.txt"))
+ (sha256
+ (base32
+ "0k6wyijyzdl5g3nibcwfm898kfydx1pqaz28v7fdvnzdvd5fz7lh"))))
;; Programs for the tests:
cppi indent git-minimal/pinned autoconf))
(home-page "https://www.gnu.org/software/gnulib/")
--
2.45.2
L
L
Liliana Marie Prikler wrote on 6 Sep 19:33 +0200
Re: [bug#73073] [PATCH 4/6] gnu: gnome-recipes: Move libgd origin from phases to native-inputs.
f1357ec8c534073231b92e7d4c455e2fce6f2db4.camel@gmail.com
Am Freitag, dem 06.09.2024 um 17:54 +0200 schrieb Simon Tournier:
Toggle quote (52 lines)
> * gnu/packages/dlang.scm (gnome-recipes)[arguments]<phases>: Move
> libgd
> origin from here...
> [native-inputs]: ...to here.
>
> Change-Id: I137dc41819a680fdf1f5c0bea9778b2bceae3fad
> ---
>  gnu/packages/gnome.scm | 22 ++++++++++++----------
>  1 file changed, 12 insertions(+), 10 deletions(-)
>
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index 7339000436..8ae9fb0656 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -799,15 +799,7 @@ (define-public gnome-recipes
>            (add-after 'unpack 'unpack-libgd
>              (lambda _
>                (copy-recursively
> -               #$(origin
> -                   (method git-fetch)
> -                   (uri (git-reference
> -                         (url
> "https://gitlab.gnome.org/GNOME/libgd")
> -                         (commit
> "c7c7ff4e05d3fe82854219091cf116cce6b19de0")))
> -                   (file-name (git-file-name "libgd" version))
> -                   (sha256
> -                    (base32
> -                    
> "16yld0ap7qj1n96h4f2sqkjmibg7xx5xwkqxdfzam2nmyfdlrrrs")))
> +               #$(this-package-native-input "libgd")
>                 "subprojects/libgd"))))))
>      (inputs (list glib
>                    gnome-autoar
> @@ -823,7 +815,17 @@ (define-public gnome-recipes
>                           `(,glib "bin")
>                           itstool
>                           pkg-config
> -                         python))
> +                         python
> +                         `("libgd"
> +                           ,(origin
> +                              (method git-fetch)
> +                              (uri (git-reference
> +                                    (url
> "https://gitlab.gnome.org/GNOME/libgd")
> +                                    (commit
> "c7c7ff4e05d3fe82854219091cf116cce6b19de0")))
> +                              (file-name (git-file-name "libgd"
> version))
> +                              (sha256
> +                               (base32
I can see why you're doing that, but I'm not really convinced it helps
the package. Particularly, we're now even adding a labeled input,
which makes for a cursed situation where all but one inputs are
unlabeled¹.

IMHO, G-Expressions in phases serve in part to facilitate uses like
this. They may not be nice, but those are upstream conditions we have
to cope with. I'd rather do a proper unbundling of libgd.

Another "proper" solution could be as easy as using an unlabeled origin
and search-input-file. However, this doesn't really work all that well
if you have to unpack the entire origin, hence what I've done here for
gnome-recipes.

Cheers

¹ Let's not even mention the necessity of 1/6 to enable that. Back in
the day, there was a decision against giving origins labels because it
would add to the further propagation of label use throughout Guix,
while we want to drop them.
S
S
Simon Tournier wrote on 6 Sep 20:11 +0200
8734mcire8.fsf@gmail.com
Hi Liliana,

My aim is not to mix, under ’inputs’ record field, the old style (label)
with the new style (no label) but to have the ’origin’ inside ’inputs’
and not inside ’arguments’.


On Fri, 06 Sep 2024 at 19:33, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:

Toggle quote (3 lines)
> I can see why you're doing that, but I'm not really convinced it helps
> the package.

As I wrote in the cover letter:

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

So it helps the package. ;-)

Please note that the docstring of ’package-direct-sources’ is currently
lying. ;-) Well, the situation is a bug, IMHO.

Toggle snippet (5 lines)
"Return all source origins associated with PACKAGE; including origins in
PACKAGE's inputs and patches."


Toggle quote (3 lines)
> IMHO, G-Expressions in phases serve in part to facilitate uses like
> this.

I agree that G-exps facilitate manipulation of store paths. But using
’origin’ inside arguments appears to me as an abuse of the feature. As
I wrote in the cover letter:

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.

Therefore, I strongly think ’origin’ should not be inside arguments.

Somehow, my submission is a proposal for dealing with the case. And
it’s not really if it needs to, or should, be done. :-)


Toggle quote (4 lines)
> Particularly, we're now even adding a labeled input,
> which makes for a cursed situation where all but one inputs are
> unlabeled¹.

Please note it’s a specific inputs: it’s an ’origin’. This can be
checked by the pattern matching, e.g.,

(((? string? label) (? origin? o) ;Allow old style as sometimes requires by origin in inputs
`(,label ,o))

Other said, it would not be a “cursed situation”; only a situation using
a locally defined input.


Cheers,
simon
L
L
Liliana Marie Prikler wrote on 6 Sep 22:14 +0200
7618cf89ae284480e97374a13b288a6dc209fb81.camel@gmail.com
Am Freitag, dem 06.09.2024 um 20:11 +0200 schrieb Simon Tournier:
Toggle quote (5 lines)
> Hi Liliana,
>
> My aim is not to mix, under ’inputs’ record field, the old style
> (label) with the new style (no label) but to have the ’origin’ inside
> ’inputs’ and not inside ’arguments’.
Sure, but you do introduce a label to make that work is what I'm
saying.

Toggle quote (9 lines)
> As I wrote in the cover letter:
>
>         This is annoying because these origins are hidden from
>         ’package-direct-sources’; see module (guix packages).
>
> So it helps the package. ;-)
>
> Please note that the docstring of ’package-direct-sources’ is
> currently lying. ;-)  Well, the situation is a bug, IMHO.
I think we should fix ‘package-direct-sources’ then. The derivation
obviously knows about this input, otherwise the package wouldn't be
built, so the information is there. I'd also hazard a guess that Rust
being Rust, no useful information for Rust packages comes with package-
direct-inputs if arguments aren't being handled.

Toggle quote (24 lines)
> --8<---------------cut here---------------start------------->8---
>   "Return all source origins associated with PACKAGE; including
> origins in PACKAGE's inputs and patches."
> --8<---------------cut here---------------end--------------->8---
>
>
> > IMHO, G-Expressions in phases serve in part to facilitate uses like
> > this.
>
> I agree that G-exps facilitate manipulation of store paths.  But
> using ’origin’ inside arguments appears to me as an abuse of the
> feature.  As I wrote in the cover letter:
>
>         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.
>
> Therefore, I strongly think ’origin’ should not be inside arguments.
We could handle it in source at the cost of similar anti-patterns, or
in inputs at the cost of the anti-pattern you suggest. The Right
Thing™ would be to unbundle these dependencies correctly.

Also note that your argument would apply to #$this-package-input just
as well: it still is magic that pulls in data from the impure outside
world, and you can trivially trick it into doing silly things. (Just
add inheritance.)

Toggle quote (2 lines)
> Somehow, my submission is a proposal for dealing with the case.  And
> it’s not really if it needs to, or should, be done. :-)
You are working on the implicit assumption that everyone agrees that it
needs to be done, then.

Toggle quote (13 lines)
> >               Particularly, we're now even adding a labeled input,
> > which makes for a cursed situation where all but one inputs are
> > unlabeled¹.
>
> Please note it’s a specific inputs: it’s an ’origin’.  This can be
> checked by the pattern matching, e.g.,
>
>     (((? string? label) (? origin? o) ;Allow old style as sometimes
> requires by origin in inputs
>      `(,label ,o))
>
> Other said, it would not be a “cursed situation”; only a situation
> using a locally defined input.
It *is* a cursed situation for the person reading the inputs field.
Apart from proper unbundling, some other workarounds would be:
- hacking around search-input-file
- making dummy data packages
- named origins (this one requires similar support code to be written
and has already been rejected once IIRC)
- computed origins
And yes, I label them as workarounds, since they don't address the root
cause of why origins are introduced in arguments.

Sometimes, practicality beats purity: Consider the ungoogled-chromium
recipe if you hadn't had a good scare today. The fact that this
pattern shows up as rarely as it does is a testament to how well Guix
functions otherwise – but there might still be a need for it in some
fringe circumstances. I'd rather we don't change code unless the
result is clearly better™, and I don't see that here.

Cheers
L
L
Ludovic Courtès wrote on 6 Sep 23:45 +0200
Re: [bug#73073] [PATCH 0/6] Allow origin with label as inputs.
(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
87o750wj6n.fsf@gnu.org
Hello,

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

Toggle quote (7 lines)
> The reason is because ’sanitize-inputs’; see module (guix packages).
>
> ((_ (list args ...))
> (add-input-labels args ...))
> ((_ inputs)
> (maybe-add-input-labels inputs))))

[...]

Toggle quote (5 lines)
> 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:
Toggle diff (22 lines)
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."
? (Currently we can’t because ‘gexp-inputs’ is private.)

Or, alternatively, we’d have origins without labels in inputs, with
this:
Toggle diff (12 lines)
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))))
… 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’.
S
S
Simon Tournier wrote on 7 Sep 13:37 +0200
Re: [bug#73073] [PATCH 4/6] gnu: gnome-recipes: Move libgd origin from phases to native-inputs.
87le03r8xh.fsf@gmail.com
Hi Liliana,

I get your points. In order to avoid duplicate discussion, please
consider the Ludo’s thread.

On Fri, 06 Sep 2024 at 22:14, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:

Toggle quote (4 lines)
> I'd also hazard a guess that Rust
> being Rust, no useful information for Rust packages comes with package-
> direct-inputs if arguments aren't being handled.

Yes, I am aware of the Rust package case. :-)

It’s similar as the Haskell
package, as I pointed years ago [1]. I still think that’s something
which needs to be improved.

Cheers,
simon


1: Re: Cabal mismatch in ghc-lucid; long-term archiving Haskell?
zimoun <zimon.toutoune@gmail.com>
Mon, 22 Aug 2022 16:04:21 +0200
id:87ilmk5q8q.fsf@gmail.com
S
S
Simon Tournier wrote on 7 Sep 15:40 +0200
Re: [bug#73073] [PATCH 0/6] Allow origin with label as inputs.
(name . Ludovic Courtès)(address . ludo@gnu.org)
875xr7r38x.fsf@gmail.com
Hi Ludo,

On Fri, 06 Sep 2024 at 23:45, Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (5 lines)
> 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.

This is inaccurate: inputs are already polymorphic lists. For example,

(native-inputs (list desktop-file-utils ;for update-desktop-database
gettext-minimal
`(,glib "bin")
itstool
pkg-config
python))

And “bin” is a label, AFAIU. That’s said…

Toggle quote (4 lines)
> 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.

…I agree: my aim is not to revive the “old style”. Aside, from my
perspective, the main issue with the “old style” is not the labels but
instead it’s the redundancy.

In other words, labels are not the evil since they are still used for
dealing with “outputs”.

Anyway, let avoid the Walder’s law trap [1]. ;-)

So let do not rely on explicit labels.

Toggle quote (3 lines)
> The main issue we want to address here is origins being hidden from
> ‘package-direct-sources’, right?

Yes… And also I think that’s a bad pattern to not have all “inputs“ in
the same place. From my point of view, the current situation defeats my
understanding of declarative programming.


Toggle quote (18 lines)
> 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))))
>
>
> … 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.)

This solution appears to me the best approach. Somehow, it uses
’file-name’ as internal “label”. When internal “labels” will completely
removed, e.g., using package name or else, we will adapt.

Well, ’origin-actual-file-name’ returns for example
"libgd-2.0.4-checkout", i.e. the version would be required when calling
’this-package-input’. Therefore, it would mean something like:

#$(this-package-native-input (git-file-name "libgd" version))

This appears to me a good solution.

However, how is it possible to avoid a full rebuild because ’tzdata’ or
else? It means the package definition cannot be modified, right?
Therefore, the only way would to special case ’maybe-add-input-labels’,
e.g.,

Toggle snippet (12 lines)
@@ -441,6 +441,9 @@ (define (maybe-add-input-labels inputs)
"Add labels to INPUTS unless it already has them."
(cond ((null? inputs)
inputs)
+ ((and (pair? (car inputs))
+ (origin? (cdar inputs)) )
+ inputs)
((and (pair? (car inputs))
(string? (caar inputs)))
inputs)

Would it be ok performance-wise? Or what could the another option?

Moreover, as you said some other packages deep in the graph seem in the
picture.

Well, I am going to explore this in order to send a v2.


Cheers,
simon


L
L
Liliana Marie Prikler wrote on 7 Sep 16:49 +0200
be90ee374740f7fe6d06f3a31d559e5d11240143.camel@gmail.com
Hi Simon,

since you pointed me here, I will chime in a little :)

Am Samstag, dem 07.09.2024 um 15:40 +0200 schrieb Simon Tournier:
Toggle quote (22 lines)
> Hi Ludo,
>
> On Fri, 06 Sep 2024 at 23:45, Ludovic Courtès <ludo@gnu.org> wrote:
>
> > 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.
>
> This is inaccurate: inputs are already polymorphic lists.  For
> example,
>
>     (native-inputs (list desktop-file-utils ;for update-desktop-
> database
>                          gettext-minimal
>                          `(,glib "bin")
>                          itstool
>                          pkg-config
>                          python))
>
> And “bin” is a label, AFAIU.  That’s said…
Not in the sense that you are addressing inputs with it, no. "bin" is
an output selector (output "label" if you will) – its purpose it to
choose an output that isn't "out".

Toggle quote (14 lines)
> > 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.
>
> …I agree: my aim is not to revive the “old style”.  Aside, from my
> perspective, the main issue with the “old style” is not the labels
> but instead it’s the redundancy.
>
> In other words, labels are not the evil since they are still used for
> dealing with “outputs”.
>
> Anyway, let avoid the Walder’s law trap [1]. ;-)
>
> So let do not rely on explicit labels.
But you are adding explicit labels here. A solution that doesn't would
be much preferred.

Toggle quote (6 lines)
> > The main issue we want to address here is origins being hidden from
> > ‘package-direct-sources’, right?
>
> Yes…  And also I think that’s a bad pattern to not have all “inputs“
> in the same place. From my point of view, the current situation
> defeats my understanding of declarative programming.
I agree with you that inputs outside of inputs should be avoided, but I
disagree with your point on declarative programming. Packages, even
written in that style, are still declarative.

Toggle quote (30 lines)
> > 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))))
> >  
> >
> > … 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.)
>
> This solution appears to me the best approach.  Somehow, it uses
> ’file-name’ as internal “label”.  When internal “labels” will
> completely removed, e.g., using package name or else, we will adapt.
>
> Well, ’origin-actual-file-name’ returns for example
> "libgd-2.0.4-checkout", i.e. the version would be required when
> calling ’this-package-input’.  Therefore, it would mean something
> like:
>
>     #$(this-package-native-input (git-file-name "libgd" version))
>
> This appears to me a good solution.
It doesn't to me. What do you do if the libgd version changes? To
arrive at a proper label, you would have to strip the versioning and
packaging metadata – otherwise you're left with a situation, where you
can't replace the package by tweaking inputs anyway.

Toggle quote (19 lines)
> However, how is it possible to avoid a full rebuild because ’tzdata’
> or else?  It means the package definition cannot be modified, right?
> Therefore, the only way would to special case ’maybe-add-input-
> labels’, e.g.,
>
> --8<---------------cut here---------------start------------->8---
> @@ -441,6 +441,9 @@ (define (maybe-add-input-labels inputs)
>    "Add labels to INPUTS unless it already has them."
>    (cond ((null? inputs)
>           inputs)
> +        ((and (pair? (car inputs))
> +              (origin? (cdar inputs)) )
> +         inputs)
>          ((and (pair? (car inputs))
>                (string? (caar inputs)))
>           inputs)
> --8<---------------cut here---------------end--------------->8---
>
> Would it be ok performance-wise?  Or what could the another option?
I don't think this does what you think it does.
It returns inputs as-is if the tail of the first input is an origin…
which I don't think would be the case even if we do implement your v1.


Cheers
S
S
Simon Tournier wrote on 10 Sep 03:27 +0200
[PATCH v2 0/8] Allow origin inside inputs with "new style".
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
cover.1725930587.git.zimon.toutoune@gmail.com
Hi,

Following Ludo's advice [1], here the v2.

Packages use ’package-name’ as internal labels so the first patch of the serie
adds ’origin-actual-file-name’ as internal labels for the origins. Then, the
’origin’ is found back via ’this-package-input’ as for the packages.

For instance, without the patch, we have somewhere in the phase:

#$(origin
(method url-fetch)
(uri (string-append
"mirror://kernel.org/software/scm/git/"
"git-manpages-" (package-version this-package) ".tar.xz"))
(sha256
(base32
"1lvvhzypllbyd8j6m0p9qgd3gqg10gch9s7lqif8vr9n80fqn4fw"))))))))))))

then with the patch, this origin is moved to the ’native-inputs’ field and the
snippet above is replaced by:

#$(this-package-native-input
(string-append
"git-manpages-" (package-version this-package) ".tar.xz")))))))))))


Please note the two special cases: tzdata and texlive-hyphen-complete. They
are considered in order to avoid a world rebuild. The final adjusment can be
addressed with some “build train” (or “merge train”) as discussed elsewhere.


The other patches of the series provide more examples of the usage.

WDYT?

Cheers,
simon


1: [bug#73073] [PATCH 0/6] Allow origin with label as inputs.
Ludovic Courtès <ludo@gnu.org>
Fri, 06 Sep 2024 23:45:04 +0200
id:87o750wj6n.fsf@gnu.org


Simon Tournier (8):
guix: packages: Allow origin inside inputs with "new style".
gnu: gnome-recipes: Move libgd origin from phases to native-inputs.
gnu: dmd-bootstrap: Move phobos origin from phases to native-inputs.
gnu: smithforth: Move system.fs 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: git: Move git-manpages origin from phases to native-inputs.
gnu: cgit: Remove input labels.

gnu/packages/build-tools.scm | 18 ++++----
gnu/packages/dlang.scm | 21 ++++-----
gnu/packages/forth.scm | 20 +++++----
gnu/packages/freedesktop.scm | 24 +++++-----
gnu/packages/gnome.scm | 19 ++++----
gnu/packages/version-control.scm | 75 +++++++++++++++++---------------
guix/packages.scm | 10 +++++
7 files changed, 106 insertions(+), 81 deletions(-)


base-commit: 85a603f58b9b6fef86984a3b2cfc27bd13314ba1
--
2.45.2
S
S
Simon Tournier wrote on 10 Sep 03:27 +0200
[PATCH v2 1/8] guix: packages: Allow origin inside inputs with "new style".
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
a6b14210f78ccc3b2d0b9d28c5ba3a4c05c28316.1725930587.git.zimon.toutoune@gmail.com
* guix/packages.scm (add-input-label): Rely on 'origin-actual-file-name' for
internal inputs labels.
(maybe-add-input-labels): Special case to avoid world rebuild.

Change-Id: I6ba5352b1b1b8ab810da3730b09cb9db61d6429c
---
guix/packages.scm | 10 ++++++++++
1 file changed, 10 insertions(+)

Toggle diff (30 lines)
diff --git a/guix/packages.scm b/guix/packages.scm
index f373136d22..35dba6adc3 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -444,6 +444,9 @@ (define (maybe-add-input-labels inputs)
((and (pair? (car inputs))
(string? (caar inputs)))
inputs)
+ ((and (origin? (car inputs)) ;XXXX: Remove next world rebuild
+ (null? (cdr inputs))) ;special case tzdata
+ (list (list "_" (car inputs))))
(else (map add-input-label inputs))))
(define (add-input-labels . inputs)
@@ -676,6 +679,13 @@ (define (add-input-label input)
"_")
,obj
,@(if (string=? output "out") '() (list output)))))
+ ((? origin? origin) ;XXXX: Remove next world rebuild
+ (let ((texlive (package-source
+ (module-ref (resolve-interface '(gnu packages tex))
+ 'texlive-latex))))
+ (if (eq? input texlive)
+ (list "_" origin)
+ (list (or (origin-actual-file-name origin) "_") origin))))
(x
`("_" ,x))))
--
2.45.2
S
S
Simon Tournier wrote on 10 Sep 03:27 +0200
[PATCH v2 2/8] gnu: gnome-recipes: Move libgd origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
718328743b18d6a8b5f60bf40c8bdc14cf5ad1bc.1725930587.git.zimon.toutoune@gmail.com
* gnu/packages/dlang.scm (gnome-recipes)[arguments]<phases>: Move libgd
origin from here...
[native-inputs]: ...to here.

Change-Id: Ic1775a66608e114b5b31058386c8b739c155b7a5
---
gnu/packages/gnome.scm | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

Toggle diff (39 lines)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 7339000436..d80d8cf33f 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -799,15 +799,7 @@ (define-public gnome-recipes
(add-after 'unpack 'unpack-libgd
(lambda _
(copy-recursively
- #$(origin
- (method git-fetch)
- (uri (git-reference
- (url "https://gitlab.gnome.org/GNOME/libgd")
- (commit "c7c7ff4e05d3fe82854219091cf116cce6b19de0")))
- (file-name (git-file-name "libgd" version))
- (sha256
- (base32
- "16yld0ap7qj1n96h4f2sqkjmibg7xx5xwkqxdfzam2nmyfdlrrrs")))
+ #$(this-package-native-input (git-file-name "libgd" version))
"subprojects/libgd"))))))
(inputs (list glib
gnome-autoar
@@ -821,6 +813,15 @@ (define-public gnome-recipes
(native-inputs (list desktop-file-utils ;for update-desktop-database
gettext-minimal
`(,glib "bin")
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://gitlab.gnome.org/GNOME/libgd")
+ (commit "c7c7ff4e05d3fe82854219091cf116cce6b19de0")))
+ (file-name (git-file-name "libgd" version))
+ (sha256
+ (base32
+ "16yld0ap7qj1n96h4f2sqkjmibg7xx5xwkqxdfzam2nmyfdlrrrs")))
itstool
pkg-config
python))
--
2.45.2
S
S
Simon Tournier wrote on 10 Sep 03:27 +0200
[PATCH v2 3/8] gnu: dmd-bootstrap: Move phobos origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
7d8122f6519b77f5accf4f83ee03169ad03ad7b1.1725930587.git.zimon.toutoune@gmail.com
* gnu/packages/dlang.scm (dmd-bootstrap)[arguments]<phases>: Move phobos
origin from here...
[native-inputs]: ...to here.

Change-Id: I10cb5f628dad2fdbb01df58134996bdcd0b73d62
---
gnu/packages/dlang.scm | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

Toggle diff (41 lines)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 8bf0ee685e..1fd1c8d58c 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -456,15 +456,7 @@ (define dmd-bootstrap
(lambda _
(symlink "." "dmd") ;to please the build system expected layout
(copy-recursively
- #$(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")))
+ #$(this-package-native-input (git-file-name "phobos" version))
"phobos")
(chdir "phobos")))
(add-after 'copy-phobos-source-and-chdir 'adjust-phobos-install-dirs
@@ -519,7 +511,16 @@ (define dmd-bootstrap
"lib")
(("\\.\\./src/(phobos|druntime/import)")
"include/dmd")))))))
- (native-inputs (list gdmd which))
+ (native-inputs (list gdmd which
+ (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")))))
(home-page "https://github.com/dlang/dmd")
(synopsis "Reference D Programming Language compiler")
(description "@acronym{DMD, Digital Mars D compiler} is the reference
--
2.45.2
S
S
Simon Tournier wrote on 10 Sep 03:27 +0200
[PATCH v2 4/8] gnu: smithforth: Move system.fs origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
e3d9fdc9bf1d097376a275064ae90559f2cda599.1725930587.git.zimon.toutoune@gmail.com
* gnu/packages/dlang.scm (smithforth)[arguments]<phases>: Move system.fs
origin from here...
[native-inputs]: ...to here.

Change-Id: I82ff81f72dbe2ecf70fbbd44674596e1a62cadcf
---
gnu/packages/forth.scm | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)

Toggle diff (40 lines)
diff --git a/gnu/packages/forth.scm b/gnu/packages/forth.scm
index 6e8d8cdc4c..c523887871 100644
--- a/gnu/packages/forth.scm
+++ b/gnu/packages/forth.scm
@@ -75,7 +75,15 @@ (define-public smithforth
(sha256
(base32 "0a39pv7529llsa3f48fmvwvlcp3f9v8qkn5ziw2l6kxf0qvli3lm"))))
(build-system trivial-build-system)
- (native-inputs (list xxd))
+ (native-inputs (list xxd
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://dacvs.neocities.org/SF/system"
+ version "fs.txt"))
+ (sha256
+ (base32
+ "17v1pp64s6n8q8w3kg48nd7zdcx2208y4svr5fpfms5lkyzg7z1m")))))
(arguments
(list
#:modules '((guix build utils))
@@ -84,14 +92,8 @@ (define-public smithforth
(use-modules (guix build utils)
(ice-9 textual-ports))
(let* ((sforth.dmp #$(package-source this-package))
- (system.fs #$(origin
- (method url-fetch)
- (uri (string-append
- "https://dacvs.neocities.org/SF/system"
- version "fs.txt"))
- (sha256
- (base32
- "17v1pp64s6n8q8w3kg48nd7zdcx2208y4svr5fpfms5lkyzg7z1m"))))
+ (system.fs #$(this-package-native-input
+ (string-append "system" version "fs.txt")))
(xxd (string-append (assoc-ref %build-inputs "xxd")
"/bin/xxd"))
(bin (string-append (assoc-ref %outputs "out") "/bin")))
--
2.45.2
S
S
Simon Tournier wrote on 10 Sep 03:27 +0200
[PATCH v2 5/8] gnu: farstream: Move common origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
cf1a4f504158eab92bf066ed83cb0953baa4c62a.1725930587.git.zimon.toutoune@gmail.com
* gnu/packages/dlang.scm (farstream)[arguments]<phases>: Move common
origin from here...
[native-inputs]: ...to here.

Change-Id: I0023bca2fc021b82875b1ec7329c7e37116df0b3
---
gnu/packages/freedesktop.scm | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)

Toggle diff (44 lines)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index cb1d625d24..56bd54a27f 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -263,16 +263,8 @@ (define-public farstream
(lambda _
(delete-file "autogen.sh")
(copy-recursively
- #$(origin
- (method git-fetch)
- (uri
- (git-reference
- (url "https://gitlab.freedesktop.org/gstreamer/common.git")
- (commit "52adcdb89a9eb527df38c569539d95c1c7aeda6e")))
- (file-name (git-file-name "common" "latest.52adcdb"))
- (sha256
- (base32
- "1zlm1q1lgcb76gi82rial5bwy2j9sz1x6x48ijhiz89cml7xxd1r")))
+ #$(this-package-native-input
+ (git-file-name "common" "latest.52adcdb"))
"common")))
(add-after 'unpack 'disable-problematic-tests
(lambda _
@@ -296,7 +288,17 @@ (define-public farstream
libxslt
perl
pkg-config
- python-wrapper))
+ python-wrapper
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://gitlab.freedesktop.org/gstreamer/common.git")
+ (commit "52adcdb89a9eb527df38c569539d95c1c7aeda6e")))
+ (file-name (git-file-name "common" "latest.52adcdb"))
+ (sha256
+ (base32
+ "1zlm1q1lgcb76gi82rial5bwy2j9sz1x6x48ijhiz89cml7xxd1r")))))
(inputs
(list glib
gtk+
--
2.45.2
S
S
Simon Tournier wrote on 10 Sep 03:27 +0200
[PATCH v2 6/8] gnu: gnulib: Move phobos origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
9396e6ba9704f53b8123b0e712b5e9895719f63d.1725930587.git.zimon.toutoune@gmail.com
* gnu/packages/dlang.scm (gnulib-checkout)[arguments]<phases>: Move PropList
origin from here...
[native-inputs]: ...to here.

Change-Id: I3576a169837039bc6beaae0d68ab459ed642e3c8
---
gnu/packages/build-tools.scm | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

Toggle diff (38 lines)
diff --git a/gnu/packages/build-tools.scm b/gnu/packages/build-tools.scm
index 21df25e4f5..61901c0bbb 100644
--- a/gnu/packages/build-tools.scm
+++ b/gnu/packages/build-tools.scm
@@ -942,14 +942,7 @@ (define*-public (gnulib-checkout #:key
"Scripts.txt"
"Blocks.txt")
(list
- #$(origin
- (method url-fetch)
- (uri (string-append
- "https://www.unicode.org/Public/"
- "3.0-Update1/PropList-3.0.1.txt"))
- (sha256
- (base32
- "0k6wyijyzdl5g3nibcwfm898kfydx1pqaz28v7fdvnzdvd5fz7lh"))))
+ #$(this-package-native-input "PropList.txt"))
(find-ucd-files "BidiMirroring.txt"
"EastAsianWidth.txt"
"LineBreak.txt"
@@ -982,6 +975,15 @@ (define*-public (gnulib-checkout #:key
bash-minimal python perl clisp
;; Unicode data:
ucd
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://www.unicode.org/Public/"
+ "3.0-Update1/PropList-3.0.1.txt"))
+ (file-name "PropList.txt")
+ (sha256
+ (base32
+ "0k6wyijyzdl5g3nibcwfm898kfydx1pqaz28v7fdvnzdvd5fz7lh")))
;; Programs for the tests:
cppi indent git-minimal/pinned autoconf))
(home-page "https://www.gnu.org/software/gnulib/")
--
2.45.2
S
S
Simon Tournier wrote on 10 Sep 03:27 +0200
[PATCH v2 7/8] gnu: git: Move git-manpages origin from phases to native-inputs.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
dba7d7fd98d739aba96559f5d6acf461a03e34d8.1725930587.git.zimon.toutoune@gmail.com
* gnu/packages/version-control.scm (git)[arguments]<phases>: Move git-manpages
origin from here...
[native-inputs]: ...to here.

Change-Id: I4affbb032523e634b82c7e33343d0dc0797cb393
---
gnu/packages/version-control.scm | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)

Toggle diff (45 lines)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index 0c4cdedce8..a0fdcb0da9 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -693,15 +693,9 @@ (define-public git
(with-directory-excursion man
(invoke
"tar" "xvf"
- #$(origin
- (method url-fetch)
- (uri (string-append
- "mirror://kernel.org/software/scm/git/"
- "git-manpages-" (package-version this-package)
- ".tar.xz"))
- (sha256
- (base32
- "1lvvhzypllbyd8j6m0p9qgd3gqg10gch9s7lqif8vr9n80fqn4fw"))))))))))))
+ #$(this-package-native-input
+ (string-append
+ "git-manpages-" (package-version this-package) ".tar.xz")))))))))))
(native-inputs
(modify-inputs (package-native-inputs git-minimal)
;; For subtree documentation.
@@ -712,7 +706,18 @@ (define-public git
libxslt
pkg-config
texinfo
- xmlto)))
+ xmlto
+ ;; To build the man pages from the git sources, we would need a dependency
+ ;; on a full XML tool chain, and building it actually takes ages. So we
+ ;; use this lazy approach and use released tarball.
+ (origin
+ (method url-fetch)
+ (uri (string-append
+ "mirror://kernel.org/software/scm/git/git-manpages-"
+ (package-version this-package) ".tar.xz"))
+ (sha256
+ (base32
+ "1pqrp46kwbxycqld39027ph1cvkq9am156y3sswn6w2khsg30f09"))))))
(inputs
(modify-inputs (package-inputs git-minimal)
(append bash-minimal ;for wrap-program
--
2.45.2
S
S
Simon Tournier wrote on 10 Sep 03:27 +0200
[PATCH v2 8/8] gnu: cgit: Remove input labels.
(address . 73073@debbugs.gnu.org)(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
19f279c682308ff8bf719c8073e8c3d10856e08e.1725930587.git.zimon.toutoune@gmail.com
* gnu/packages/version-control.scm (cgit)
[inputs]: Remove labels.
[arguments]<phases>: Adjust.

Change-Id: Iff479fa636f7a4c4fef5137ae22934d4e213223b
---
gnu/packages/version-control.scm | 50 +++++++++++++++++---------------
1 file changed, 26 insertions(+), 24 deletions(-)

Toggle diff (70 lines)
diff --git a/gnu/packages/version-control.scm b/gnu/packages/version-control.scm
index a0fdcb0da9..5b28eeaa9e 100644
--- a/gnu/packages/version-control.scm
+++ b/gnu/packages/version-control.scm
@@ -1315,7 +1315,7 @@ (define-public cgit
(lambda* (#:key inputs #:allow-other-keys)
;; Unpack the source of git into the 'git' directory.
(invoke "tar" "--strip-components=1" "-C" "git" "-xf"
- (assoc-ref inputs "git-source"))))
+ #$(this-package-input "git-source"))))
(add-after 'unpack 'patch-absolute-file-names
(lambda* (#:key inputs outputs #:allow-other-keys)
(define (quoted-file-name input path)
@@ -1370,29 +1370,31 @@ (define-public cgit
;; For building manpage.
(list asciidoc))
(inputs
- `( ;; Building cgit requires a Git source tree.
- ("git-source"
- ,(origin
- (method url-fetch)
- ;; cgit is tightly bound to git. Use GIT_VER from the Makefile,
- ;; which may not match the current (package-version git).
- (uri "mirror://kernel.org/software/scm/git/git-2.46.0.tar.xz")
- (sha256
- (base32 "15bzq9m6c033qiz5q5gw1nqw4m452vvqax30wbms6z4bl9i384kz"))))
- ("bash-minimal" ,bash-minimal)
- ("openssl" ,openssl)
- ("python" ,python)
- ("python-docutils" ,python-docutils)
- ("python-markdown" ,python-markdown)
- ("python-pygments" ,python-pygments)
- ("zlib" ,zlib)
- ;; bzip2, groff, gzip and xz are inputs (not native inputs)
- ;; since they are actually substituted into cgit source and
- ;; referenced by the built package output.
- ("bzip2" ,bzip2)
- ("groff" ,groff)
- ("gzip" ,gzip)
- ("xz" ,xz)))
+ (list
+ ;; Building cgit requires a Git source tree.
+ (origin
+ (method url-fetch)
+ ;; cgit is tightly bound to git. Use GIT_VER from the Makefile,
+ ;; which may not match the current (package-version git).
+ (uri "mirror://kernel.org/software/scm/git/git-2.46.0.tar.xz")
+ (sha256
+ (base32 "15bzq9m6c033qiz5q5gw1nqw4m452vvqax30wbms6z4bl9i384kz"))
+ (file-name "git-source"))
+ bash-minimal
+ openssl
+ python
+ python-docutils
+ python-markdown
+ python-pygments
+ zlib
+ ;; bzip2, groff, gzip and xz are inputs (not native inputs)
+ ;; since they are actually substituted into cgit source and
+ ;; referenced by the built package output.
+
+ bzip2
+ groff
+ gzip
+ xz))
(home-page "https://git.zx2c4.com/cgit/")
(synopsis "Web frontend for git repositories")
(description
--
2.45.2
L
L
Liliana Marie Prikler wrote on 10 Sep 06:30 +0200
Re: [bug#73073] [PATCH v2 2/8] gnu: gnome-recipes: Move libgd origin from phases to native-inputs.
b5bcf8572a41e41038c51700f4ccfc42e5b3200d.camel@gmail.com
Am Dienstag, dem 10.09.2024 um 03:27 +0200 schrieb Simon Tournier:
Toggle quote (49 lines)
> * gnu/packages/dlang.scm (gnome-recipes)[arguments]<phases>: Move
> libgd
> origin from here...
> [native-inputs]: ...to here.
>
> Change-Id: Ic1775a66608e114b5b31058386c8b739c155b7a5
> ---
>  gnu/packages/gnome.scm | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index 7339000436..d80d8cf33f 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -799,15 +799,7 @@ (define-public gnome-recipes
>            (add-after 'unpack 'unpack-libgd
>              (lambda _
>                (copy-recursively
> -               #$(origin
> -                   (method git-fetch)
> -                   (uri (git-reference
> -                         (url
> "https://gitlab.gnome.org/GNOME/libgd")
> -                         (commit
> "c7c7ff4e05d3fe82854219091cf116cce6b19de0")))
> -                   (file-name (git-file-name "libgd" version))
> -                   (sha256
> -                    (base32
> -                    
> "16yld0ap7qj1n96h4f2sqkjmibg7xx5xwkqxdfzam2nmyfdlrrrs")))
> +               #$(this-package-native-input (git-file-name "libgd"
> version))
>                 "subprojects/libgd"))))))
>      (inputs (list glib
>                    gnome-autoar
> @@ -821,6 +813,15 @@ (define-public gnome-recipes
>      (native-inputs (list desktop-file-utils ;for update-desktop-
> database
>                           gettext-minimal
>                           `(,glib "bin")
> +                         (origin
> +                           (method git-fetch)
> +                           (uri (git-reference
> +                                 (url
> "https://gitlab.gnome.org/GNOME/libgd")
> +                                 (commit
> "c7c7ff4e05d3fe82854219091cf116cce6b19de0")))
> +                           (file-name (git-file-name "libgd"
> version))
"libgd-checkout" would be both more honest and easier to get right.


Cheers
S
S
Simon Tournier wrote on 10 Sep 09:58 +0200
87wmjkj5yh.fsf@gmail.com
Hi Liliana,

On Tue, 10 Sep 2024 at 06:30, Liliana Marie Prikler <liliana.prikler@gmail.com> wrote:

Toggle quote (2 lines)
>> + #$(this-package-native-input (git-file-name "libgd" version))

[...]

Toggle quote (9 lines)
>> + (origin
>> + (method git-fetch)
>> + (uri (git-reference
>> + (url "https://gitlab.gnome.org/GNOME/libgd")
>> + (commit "c7c7ff4e05d3fe82854219091cf116cce6b19de0")))
>> + (file-name (git-file-name "libgd" version))
>
> "libgd-checkout" would be both more honest and easier to get right.

Thanks for the feedback.

Cheers,
simon
L
L
Ludovic Courtès wrote on 16 Sep 22:13 +0200
Re: [bug#73073] [PATCH 0/6] Allow origin with label as inputs.
(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
878qvrbbmj.fsf@gnu.org
Hi,

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

Toggle quote (12 lines)
> This solution appears to me the best approach. Somehow, it uses
> ’file-name’ as internal “label”. When internal “labels” will completely
> removed, e.g., using package name or else, we will adapt.
>
> Well, ’origin-actual-file-name’ returns for example
> "libgd-2.0.4-checkout", i.e. the version would be required when calling
> ’this-package-input’. Therefore, it would mean something like:
>
> #$(this-package-native-input (git-file-name "libgd" version))
>
> This appears to me a good solution.

Yes, agreed.

Toggle quote (3 lines)
> However, how is it possible to avoid a full rebuild because ’tzdata’ or
> else? It means the package definition cannot be modified, right?

When I looked the other day I came up with this:
modified gnu/packages/base.scm
@@ -1716,14 +1716,15 @@ (define-public tzdata
(delete-file-recursively
(string-append out "/share/zoneinfo-leaps")))))
(delete 'configure))))
- (inputs (list (origin
- (method url-fetch)
- (uri (string-append
- version ".tar.gz"))
- (sha256
- (base32
- "07hn7hn2klw4dfyr673ril2nrk18198hbfv25gljsvc833hzk9g9")))))
+ (inputs `(("_" ;<- avoid a rebuild
+ ,(origin
+ (method url-fetch)
+ (uri (string-append
+ version ".tar.gz"))
+ (sha256
+ (base32
+ "07hn7hn2klw4dfyr673ril2nrk18198hbfv25gljsvc833hzk9g9"))))))
(synopsis "Database of current and historical time zones")
Of course this is ugly, but it’s IMO okay if we only have to do it for a
few packages (and for a limited amount of time).

Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 16 Sep 22:19 +0200
Re: [bug#73073] [PATCH v2 1/8] guix: packages: Allow origin inside inputs with "new style".
(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
874j6fbbc6.fsf@gnu.org
Simon Tournier <zimon.toutoune@gmail.com> skribis:

Toggle quote (6 lines)
> * guix/packages.scm (add-input-label): Rely on 'origin-actual-file-name' for
> internal inputs labels.
> (maybe-add-input-labels): Special case to avoid world rebuild.
>
> Change-Id: I6ba5352b1b1b8ab810da3730b09cb9db61d6429c

[...]

Toggle quote (8 lines)
> @@ -444,6 +444,9 @@ (define (maybe-add-input-labels inputs)
> ((and (pair? (car inputs))
> (string? (caar inputs)))
> inputs)
> + ((and (origin? (car inputs)) ;XXXX: Remove next world rebuild
> + (null? (cdr inputs))) ;special case tzdata
> + (list (list "_" (car inputs))))

I would rather have this hack in ‘tzdata’ itself, along the lines of
what I sent in a previous message.

Toggle quote (12 lines)
> @@ -676,6 +679,13 @@ (define (add-input-label input)
> "_")
> ,obj
> ,@(if (string=? output "out") '() (list output)))))
> + ((? origin? origin) ;XXXX: Remove next world rebuild
> + (let ((texlive (package-source
> + (module-ref (resolve-interface '(gnu packages tex))
> + 'texlive-latex))))
> + (if (eq? input texlive)
> + (list "_" origin)
> + (list (or (origin-actual-file-name origin) "_") origin))))

I think this should be avoided, but what is it that causes a rebuild in
this case?

Thanks,
Ludo’.
S
S
Simon Tournier wrote on 16 Sep 22:42 +0200
(name . Ludovic Courtès)(address . ludo@gnu.org)
87ed5j2uus.fsf@gmail.com
Hi Ludo,

On Mon, 16 Sep 2024 at 22:19, Ludovic Courtès <ludo@gnu.org> wrote:
Toggle quote (21 lines)
> Simon Tournier <zimon.toutoune@gmail.com> skribis:
>
>> * guix/packages.scm (add-input-label): Rely on 'origin-actual-file-name' for
>> internal inputs labels.
>> (maybe-add-input-labels): Special case to avoid world rebuild.
>>
>> Change-Id: I6ba5352b1b1b8ab810da3730b09cb9db61d6429c
>
> [...]
>
>> @@ -444,6 +444,9 @@ (define (maybe-add-input-labels inputs)
>> ((and (pair? (car inputs))
>> (string? (caar inputs)))
>> inputs)
>> + ((and (origin? (car inputs)) ;XXXX: Remove next world rebuild
>> + (null? (cdr inputs))) ;special case tzdata
>> + (list (list "_" (car inputs))))
>
> I would rather have this hack in ‘tzdata’ itself, along the lines of
> what I sent in a previous message.

Yes, indeed tzdata can temporarily transformed into the old style. It
avoids the world rebuild and it’s a modification easier to change than
the one about maybe-add-input-labels. I agree that’s better.


Toggle quote (15 lines)
>> @@ -676,6 +679,13 @@ (define (add-input-label input)
>> "_")
>> ,obj
>> ,@(if (string=? output "out") '() (list output)))))
>> + ((? origin? origin) ;XXXX: Remove next world rebuild
>> + (let ((texlive (package-source
>> + (module-ref (resolve-interface '(gnu packages tex))
>> + 'texlive-latex))))
>> + (if (eq? input texlive)
>> + (list "_" origin)
>> + (list (or (origin-actual-file-name origin) "_") origin))))
>
> I think this should be avoided, but what is it that causes a rebuild in
> this case?

It’s about the package texlive-hyphen-complete; it leads to a world
rebuild – as pointed in the cover letter of v2 ;-)

It reads:

(native-inputs
(list ruby-2.7
ruby-hydra-minimal/pinned
;; Build phase requires "docstrip.tex" from TEXLIVE-LATEX.
;; However, adding this package to native inputs would initiate
;; a circular dependency. To work around this, use TEXLIVE-LATEX
;; source, then add "docstrip.tex" to TEXINPUTS before build.
(package-source texlive-latex)
texlive-tex))

then:

(add-before 'build 'include-docstrip.tex
(lambda* (#:key inputs native-inputs #:allow-other-keys)
(let ((docstrip.tex
(search-input-file (or native-inputs inputs)
"tex/latex/base/docstrip.tex")))


Well, we can apply the same hack as tzdata: temporarily revert to the
old style.

Cheers,
simon
M
M
Maxim Cournoyer wrote on 26 Sep 15:30 +0200
(name . Simon Tournier)(address . zimon.toutoune@gmail.com)
87v7yiee3y.fsf@gmail.com
Hi Simon,

That's an interesting series!

Simon Tournier <zimon.toutoune@gmail.com> writes:

[...]

Toggle quote (50 lines)
>> I would rather have this hack in ‘tzdata’ itself, along the lines of
>> what I sent in a previous message.
>
> Yes, indeed tzdata can temporarily transformed into the old style. It
> avoids the world rebuild and it’s a modification easier to change than
> the one about maybe-add-input-labels. I agree that’s better.
>
>
>>> @@ -676,6 +679,13 @@ (define (add-input-label input)
>>> "_")
>>> ,obj
>>> ,@(if (string=? output "out") '() (list output)))))
>>> + ((? origin? origin) ;XXXX: Remove next world rebuild
>>> + (let ((texlive (package-source
>>> + (module-ref (resolve-interface '(gnu packages tex))
>>> + 'texlive-latex))))
>>> + (if (eq? input texlive)
>>> + (list "_" origin)
>>> + (list (or (origin-actual-file-name origin) "_") origin))))
>>
>> I think this should be avoided, but what is it that causes a rebuild in
>> this case?
>
> It’s about the package texlive-hyphen-complete; it leads to a world
> rebuild – as pointed in the cover letter of v2 ;-)
>
> It reads:
>
> (native-inputs
> (list ruby-2.7
> ruby-hydra-minimal/pinned
> ;; Build phase requires "docstrip.tex" from TEXLIVE-LATEX.
> ;; However, adding this package to native inputs would initiate
> ;; a circular dependency. To work around this, use TEXLIVE-LATEX
> ;; source, then add "docstrip.tex" to TEXINPUTS before build.
> (package-source texlive-latex)
> texlive-tex))
>
> then:
>
> (add-before 'build 'include-docstrip.tex
> (lambda* (#:key inputs native-inputs #:allow-other-keys)
> (let ((docstrip.tex
> (search-input-file (or native-inputs inputs)
> "tex/latex/base/docstrip.tex")))
>
>
> Well, we can apply the same hack as tzdata: temporarily revert to the
> old style.

Would you please send a v3 with the above implemented? Then we could
move forward, I think.

--
Thanks,
Maxim
L
L
Ludovic Courtès wrote on 4 Oct 21:35 +0200
control message for bug #73073
(address . control@debbugs.gnu.org)
87v7y7psp4.fsf@gnu.org
tags 73073 + moreinfo
quit
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 73073@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 73073
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch