Toggle diff (81 lines)
diff --git a/tests/guix-build.sh b/tests/guix-build.sh
index 6dbb53206e..1cfff329f1 100644
--- a/tests/guix-build.sh
+++ b/tests/guix-build.sh
@@ -262,6 +262,12 @@ drv1=`guix build glib -d`
drv2=`guix build glib -d --with-input=libreoffice=inkscape`
test "$drv1" = "$drv2"
+# '--with-graft' should have no effect when using '--no-grafts'.
+# See <https://bugs.gnu.org/43890>.
+drv1=`guix build inkscape -d --no-grafts`
+drv2=`guix build inkscape -d --no-grafts --with-graft=glib=glib-networking`
+test "$drv1" = "$drv2"
+
# Rewriting implicit inputs.
drv1=`guix build hello -d`
drv2=`guix build hello -d --with-input=gcc=gcc-toolchain`
diff --git a/tests/packages.scm b/tests/packages.scm
index 5d5abcbd76..e7c43b8939 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -1419,7 +1419,8 @@
(build-system trivial-build-system)
(inputs `(("dep" ,dep1)))))
(rewrite (package-input-rewriting/spec
- `(("coreutils" . ,(const sed)))))
+ `(("coreutils" . ,(const sed)))
+ #:deep? #f)) ;avoid creating circular deps
(p1 (rewrite p0)))
(match (package-inputs p1)
((("dep" dep))
@@ -1430,6 +1431,49 @@
(derivation-file-name
(package-derivation %store coreutils))))))))
+(test-assert "package-input-rewriting/spec, identity"
+ ;; Make sure that 'package-input-rewriting/spec' doesn't gratuitously
+ ;; introduce variants. In this case, the LIBFFI propagated input should not
+ ;; be duplicated when passing GOBJECT through REWRITE.
+ ;; See <https://issues.guix.gnu.org/43890>.
+ (let* ((libffi (dummy-package "libffi"
+ (build-system trivial-build-system)))
+ (glib (dummy-package "glib"
+ (build-system trivial-build-system)
+ (propagated-inputs `(("libffi" ,libffi)))))
+ (gobject (dummy-package "gobject-introspection"
+ (build-system trivial-build-system)
+ (inputs `(("glib" ,glib)))
+ (propagated-inputs `(("libffi" ,libffi)))))
+ (rewrite (package-input-rewriting/spec
+ `(("glib" . ,identity)))))
+ (and (= (length (package-transitive-inputs gobject))
+ (length (package-transitive-inputs (rewrite gobject))))
+ (string=? (derivation-file-name
+ (package-derivation %store (rewrite gobject)))
+ (derivation-file-name
+ (package-derivation %store gobject))))))
+
+(test-assert "package-input-rewriting, identity"
+ ;; Similar to the test above, but with 'package-input-rewriting'.
+ ;; See <https://issues.guix.gnu.org/43890>.
+ (let* ((libffi (dummy-package "libffi"
+ (build-system trivial-build-system)))
+ (glib (dummy-package "glib"
+ (build-system trivial-build-system)
+ (propagated-inputs `(("libffi" ,libffi)))))
+ (gobject (dummy-package "gobject-introspection"
+ (build-system trivial-build-system)
+ (inputs `(("glib" ,glib)))
+ (propagated-inputs `(("libffi" ,libffi)))))
+ (rewrite (package-input-rewriting `((,glib . ,glib)))))
+ (and (= (length (package-transitive-inputs gobject))
+ (length (package-transitive-inputs (rewrite gobject))))
+ (string=? (derivation-file-name
+ (package-derivation %store (rewrite gobject)))
+ (derivation-file-name
+ (package-derivation %store gobject))))))
+
(test-equal "package-patched-vulnerabilities"
'(("CVE-2015-1234")
("CVE-2016-1234" "CVE-2018-4567")