From: "Ludovic Courtès" <ludo@gnu.org>
To: Gordon Quad <gordon@niflheim.info>
Cc: 53915@debbugs.gnu.org, Liliana Marie Prikler <liliana.prikler@gmail.com>
Subject: bug#53915: No way of replacing an input in modify-input syntax structure but keep all the outputs
Date: Tue, 08 Mar 2022 17:11:36 +0100 [thread overview]
Message-ID: <87zgm04e6f.fsf@gnu.org> (raw)
In-Reply-To: <20220210100941.nwmrbgm7qt34dv3v@citadel.info> (Gordon Quad's message of "Thu, 10 Feb 2022 10:09:41 +0000")
[-- 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))
next prev parent reply other threads:[~2022-03-08 16:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2022-03-08 20:28 ` Liliana Marie Prikler
2022-03-16 14:53 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zgm04e6f.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=53915@debbugs.gnu.org \
--cc=gordon@niflheim.info \
--cc=liliana.prikler@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.