guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/10: packages: 'modify-inputs' preserves outputs in 'replace' clauses.


From: guix-commits
Subject: 03/10: packages: 'modify-inputs' preserves outputs in 'replace' clauses.
Date: Wed, 16 Mar 2022 10:50:21 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 00dfff84c66c5c6aa4853684419a92befe55d4b4
Author: Ludovic Court├Ęs <ludo@gnu.org>
AuthorDate: Tue Mar 15 15:17:49 2022 +0100

    packages: 'modify-inputs' preserves outputs in 'replace' clauses.
    
    Fixes <https://issues.guix.gnu.org/53915>.
    Reported by Gordon Quad <gordon@niflheim.info>.
    
    * guix/packages.scm (replace-input): Preserve the outputs of INPUT by
    default.
    * tests/packages.scm ("modify-inputs, replace, extra output"): New test.
---
 guix/packages.scm  |  4 ++--
 tests/packages.scm | 15 +++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

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 @@ otherwise."
   "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))
 
diff --git a/tests/packages.scm b/tests/packages.scm
index 2cb90d3145..710eace6dc 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -1982,6 +1982,21 @@
       ((("coreutils" input "out"))
        input))))
 
+(test-eq "modify-inputs, replace, extra output"
+  guile-3.0
+  ;; Replace an input; notice that its output is preserved.
+  ;; See <https://issues.guix.gnu.org/53915>.
+  (let* ((p1 (dummy-package "p"
+               (inputs (list `(,coreutils "debug")))))
+         (p2 (package
+               (inherit p1)
+               (version "1")
+               (inputs (modify-inputs (package-inputs p1)
+                         (replace "coreutils" guile-3.0))))))
+    (match (package-inputs p2)
+      ((("coreutils" input "debug"))
+       input))))
+
 (test-end "packages")
 
 ;;; Local Variables:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]