all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#53915: No way of replacing an input in modify-input syntax structure but keep all the outputs
@ 2022-02-10 10:09 Gordon Quad via Bug reports for GNU Guix
  2022-02-10 20:03 ` Liliana Marie Prikler
  2022-03-08 16:11 ` Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: Gordon Quad via Bug reports for GNU Guix @ 2022-02-10 10:09 UTC (permalink / raw)
  To: 53915

poppler package include glib as a native-input with "bin" output.

If I am doing the following:

(package/inherit poppler
    (native-inputs
        (modify-inputs (package-native-inputs poppler)
            (replace "glib" my-glib))))

poppler's build will fail becuase replace syntax will replace "glib"
package erasing its outputs. I can specify output explicitly by doing
(replace "glib" (my-glib "bin")) in this case, but that makes mass input
modification difficult (e.g. if i want to replace all instances of glib
to my-glib).

That said there is a value in having such behaviour for replace syntax
in case for example if I replace package with my own version that has no
extra outputs, so it would be nice to have both options available.




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

* bug#53915: No way of replacing an input in modify-input syntax structure but keep all the outputs
  2022-02-10 10:09 bug#53915: No way of replacing an input in modify-input syntax structure but keep all the outputs Gordon Quad via Bug reports for GNU Guix
@ 2022-02-10 20:03 ` Liliana Marie Prikler
  2022-02-11 10:26   ` Gordon Quad via Bug reports for GNU Guix
  2022-03-08 16:11 ` Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Liliana Marie Prikler @ 2022-02-10 20:03 UTC (permalink / raw)
  To: Gordon Quad, 53915

Am Donnerstag, dem 10.02.2022 um 10:09 +0000 schrieb Gordon Quad:
> poppler package include glib as a native-input with "bin" output.
> 
> If I am doing the following:
> 
> (package/inherit poppler
>     (native-inputs
>         (modify-inputs (package-native-inputs poppler)
>             (replace "glib" my-glib))))
> 
> poppler's build will fail becuase replace syntax will replace "glib"
> package erasing its outputs. I can specify output explicitly by doing
> (replace "glib" (my-glib "bin")) in this case, but that makes mass
> input modification difficult (e.g. if i want to replace all instances
> of glib to my-glib).
I think the problem here is that "glib" serves double duty as both
"glib:out" and "glib:bin".  IMHO we should probably add the output
argument to the label (with a colon separator, of course) if one is
given.

I'm CC'ing Ludo because he implemented the feature and might know more
than me regarding its design.

Cheers




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

* bug#53915: No way of replacing an input in modify-input syntax structure but keep all the outputs
  2022-02-10 20:03 ` Liliana Marie Prikler
@ 2022-02-11 10:26   ` Gordon Quad via Bug reports for GNU Guix
  0 siblings, 0 replies; 6+ messages in thread
From: Gordon Quad via Bug reports for GNU Guix @ 2022-02-11 10:26 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 53915, ludo

On Thu, Feb 10, 2022 at 09:03:56PM +0100, Liliana Marie Prikler wrote:
> Am Donnerstag, dem 10.02.2022 um 10:09 +0000 schrieb Gordon Quad:
> > poppler package include glib as a native-input with "bin" output.
> > 
> > If I am doing the following:
> > 
> > (package/inherit poppler
> >     (native-inputs
> >         (modify-inputs (package-native-inputs poppler)
> >             (replace "glib" my-glib))))
> > 
> > poppler's build will fail becuase replace syntax will replace "glib"
> > package erasing its outputs. I can specify output explicitly by doing
> > (replace "glib" (my-glib "bin")) in this case, but that makes mass
> > input modification difficult (e.g. if i want to replace all instances
> > of glib to my-glib).
> I think the problem here is that "glib" serves double duty as both
> "glib:out" and "glib:bin".  IMHO we should probably add the output
> argument to the label (with a colon separator, of course) if one is
> given.
> 
> I'm CC'ing Ludo because he implemented the feature and might know more
> than me regarding its design.
Well, just grepping the code for glib I found plenty of places where it
is specified as ("glib" ,glib "bin"), and glib is the only package that
I checked so far. So what you telling me that official policy is to use
labeling convesion as "package:output" but not all the old code converted
to that yet?




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

* bug#53915: No way of replacing an input in modify-input syntax structure but keep all the outputs
  2022-02-10 10:09 bug#53915: No way of replacing an input in modify-input syntax structure but keep all the outputs Gordon Quad via Bug reports for GNU Guix
  2022-02-10 20:03 ` Liliana Marie Prikler
@ 2022-03-08 16:11 ` Ludovic Courtès
  2022-03-08 20:28   ` Liliana Marie Prikler
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2022-03-08 16:11 UTC (permalink / raw)
  To: Gordon Quad; +Cc: 53915, Liliana Marie Prikler

[-- Attachment #1: Type: text/plain, Size: 2424 bytes --]

Hi,

Gordon Quad <gordon@niflheim.info> skribis:

> poppler package include glib as a native-input with "bin" output.
>
> If I am doing the following:
>
> (package/inherit poppler
>     (native-inputs
>         (modify-inputs (package-native-inputs poppler)
>             (replace "glib" my-glib))))
>
> poppler's build will fail becuase replace syntax will replace "glib"
> package erasing its outputs.

Indeed:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(gnu packages pdf)
scheme@(guile-user)> ,use(guix)
scheme@(guile-user)> (package-native-inputs poppler)
$4 = (("pkg-config" #<package pkg-config@0.29.2 gnu/packages/pkg-config.scm:36 7f9b13a30580>) ("glib" #<package glib@2.70.2 gnu/packages/glib.scm:180 7f9b12990000> "bin") ("gobject-introspection" #<package gobject-introspection@1.66.1 gnu/packages/glib.scm:428 7f9b12994e70>))
scheme@(guile-user)> (package-propagated-inputs poppler)
$5 = (("glib" #<package glib@2.70.2 gnu/packages/glib.scm:180 7f9b12990000>))
scheme@(guile-user)> (modify-inputs (append $5 $4)
		       (replace "glib" xpdf))
$6 = (("glib" #<package xpdf@4.03 gnu/packages/pdf.scm:395 7f9b1457c9a0>) ("pkg-config" #<package pkg-config@0.29.2 gnu/packages/pkg-config.scm:36 7f9b13a30580>) ("glib" #<package xpdf@4.03 gnu/packages/pdf.scm:395 7f9b1457c9a0>) ("gobject-introspection" #<package gobject-introspection@1.66.1 gnu/packages/glib.scm:428 7f9b12994e70>))
--8<---------------cut here---------------end--------------->8---

We see that both ‘glib’ packages have been replaced, but the “bin” part
has been removed from the second one.

With the patch below, we get more sensible behavior:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (modify-inputs (append $5 $4)
		       (replace "glib" xpdf))
$8 = (("glib" #<package xpdf@4.03 gnu/packages/pdf.scm:395 7f9b1457c9a0>) ("pkg-config" #<package pkg-config@0.29.2 gnu/packages/pkg-config.scm:36 7f9b13a30580>) ("glib" #<package xpdf@4.03 gnu/packages/pdf.scm:395 7f9b1457c9a0> "bin") ("gobject-introspection" #<package gobject-introspection@1.66.1 gnu/packages/glib.scm:428 7f9b12994e70>))
--8<---------------cut here---------------end--------------->8---

If that makes sense to you, I’ll go ahead with this change and adjust
documentation accordingly.

Thanks for bringing it up!

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 722 bytes --]

diff --git a/guix/packages.scm b/guix/packages.scm
index 3f0262602d..288ae37523 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -1091,11 +1091,11 @@ (define (replace-input name replacement inputs)
   "Replace input NAME by REPLACEMENT within INPUTS."
   (map (lambda (input)
          (match input
-           (((? string? label) . _)
+           (((? string? label) _ . outputs)
             (if (string=? label name)
                 (match replacement        ;does REPLACEMENT specify an output?
                   ((_ _) (cons label replacement))
-                  (_     (list label replacement)))
+                  (_     (cons* label replacement outputs)))
                 input))))
        inputs))
 

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

* bug#53915: No way of replacing an input in modify-input syntax structure but keep all the outputs
  2022-03-08 16:11 ` Ludovic Courtès
@ 2022-03-08 20:28   ` Liliana Marie Prikler
  2022-03-16 14:53     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Liliana Marie Prikler @ 2022-03-08 20:28 UTC (permalink / raw)
  To: Ludovic Courtès, Gordon Quad; +Cc: 53915

Am Dienstag, dem 08.03.2022 um 17:11 +0100 schrieb Ludovic Courtès:
> [...]
> With the patch below, we get more sensible behavior:
> 
> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> (modify-inputs (append $5 $4)
>                        (replace "glib" xpdf))
> $8 = (("glib" #<package xpdf@4.03 gnu/packages/pdf.scm:395
> 7f9b1457c9a0>) ("pkg-config" #<package
> pkg-config@0.29.2 gnu/packages/pkg-config.scm:36 7f9b13a30580>)
> ("glib" #<package xpdf@4.03 gnu/packages/pdf.scm:395 7f9b1457c9a0>
> "bin") ("gobject-introspection" #<package
> gobject-introspection@1.66.1 gnu/packages/glib.scm:428
> 7f9b12994e70>))
> --8<---------------cut here---------------end--------------->8---
> 
> If that makes sense to you, I’ll go ahead with this change and adjust
> documentation accordingly.
Sounds better than my own suggestion, since it'll keep working the way
it did even when labels are eventually dropped.  If more control is
needed, we can always later extend it to support (replace ("label"
"output") (package output)).  WDYT?

Cheers




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

* bug#53915: No way of replacing an input in modify-input syntax structure but keep all the outputs
  2022-03-08 20:28   ` Liliana Marie Prikler
@ 2022-03-16 14:53     ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2022-03-16 14:53 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 53915-done, Gordon Quad

Hi,

Liliana Marie Prikler <liliana.prikler@gmail.com> skribis:

> Am Dienstag, dem 08.03.2022 um 17:11 +0100 schrieb Ludovic Courtès:
>> [...]
>> With the patch below, we get more sensible behavior:
>> 
>> --8<---------------cut here---------------start------------->8---
>> scheme@(guile-user)> (modify-inputs (append $5 $4)
>>                        (replace "glib" xpdf))
>> $8 = (("glib" #<package xpdf@4.03 gnu/packages/pdf.scm:395
>> 7f9b1457c9a0>) ("pkg-config" #<package
>> pkg-config@0.29.2 gnu/packages/pkg-config.scm:36 7f9b13a30580>)
>> ("glib" #<package xpdf@4.03 gnu/packages/pdf.scm:395 7f9b1457c9a0>
>> "bin") ("gobject-introspection" #<package
>> gobject-introspection@1.66.1 gnu/packages/glib.scm:428
>> 7f9b12994e70>))
>> --8<---------------cut here---------------end--------------->8---
>> 
>> If that makes sense to you, I’ll go ahead with this change and adjust
>> documentation accordingly.
> Sounds better than my own suggestion, since it'll keep working the way
> it did even when labels are eventually dropped.

Pushed with tests in 00dfff84c66c5c6aa4853684419a92befe55d4b4.

> If more control is needed, we can always later extend it to support
> (replace ("label" "output") (package output)).  WDYT?

I’d rather not: the goal of ‘modify-inputs’ is to provide an interface
that works as if input labels didn’t exist, with an eye on removing them
entirely in the future:

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

Regardless, we’ll have to keep an eye on all these corner cases and to
adjust the plan accordingly.

Thanks!

Ludo’.




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

end of thread, other threads:[~2022-03-16 15:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 10:09 bug#53915: No way of replacing an input in modify-input syntax structure but keep all the outputs Gordon Quad via Bug reports for GNU Guix
2022-02-10 20:03 ` Liliana Marie Prikler
2022-02-11 10:26   ` Gordon Quad via Bug reports for GNU Guix
2022-03-08 16:11 ` Ludovic Courtès
2022-03-08 20:28   ` Liliana Marie Prikler
2022-03-16 14:53     ` Ludovic Courtès

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.