summaryrefslogtreecommitdiff
path: root/tests/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-10-20 09:18:07 +0200
committerLudovic Courtès <ludo@gnu.org>2020-10-20 16:30:15 +0200
commit8db4ebb0cd9bfdcf1aea63eb8d20eb6af0c87c93 (patch)
tree8510a314aad6e64e3709ba231ecb13d7959549cf /tests/packages.scm
parent2bd60ca1fb1b3a830ee644369b9a7f8c8b5d0404 (diff)
packages: Better preserve object identity when rewriting.
Fixes a bug whereby the presence of propagated inputs could lead to two non-eq? but actually equal packages in a bag's inputs. The problem would manifest itself when running, for instance: guix build inkscape -d --with-graft=glib=glib-networking --no-grafts The resulting derivation would differ due from that without '--with-graft'. This was due to the fact that glib propagates libffi; this instance of libffi was not rewritten even though other instances in the graph were rewritten. Thus, glib would end up with two non-eq? libffi instances, which in turn would lead to duplicate entries in its '%build-inputs' variable. Fixes <https://bugs.gnu.org/43890>. * guix/packages.scm (package-mapping)[rewrite]: Remove call to 'cut?' and call 'replace' unconditionally. [replace]: Add 'cut?' case. * tests/guix-build.sh: Add test combining '--no-grafts' and '--with-graft'. * tests/packages.scm ("package-input-rewriting/spec, identity") ("package-input-rewriting, identity"): New tests.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r--tests/packages.scm43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 2d13d913442..18e8e16e745 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -1450,6 +1450,49 @@
1450 (eq? foo grep) 1450 (eq? foo grep)
1451 (eq? bar dep)))))) 1451 (eq? bar dep))))))
1452 1452
1453(test-assert "package-input-rewriting/spec, identity"
1454 ;; Make sure that 'package-input-rewriting/spec' doesn't gratuitously
1455 ;; introduce variants. In this case, the LIBFFI propagated input should not
1456 ;; be duplicated when passing GOBJECT through REWRITE.
1457 ;; See <https://issues.guix.gnu.org/43890>.
1458 (let* ((libffi (dummy-package "libffi"
1459 (build-system trivial-build-system)))
1460 (glib (dummy-package "glib"
1461 (build-system trivial-build-system)
1462 (propagated-inputs `(("libffi" ,libffi)))))
1463 (gobject (dummy-package "gobject-introspection"
1464 (build-system trivial-build-system)
1465 (inputs `(("glib" ,glib)))
1466 (propagated-inputs `(("libffi" ,libffi)))))
1467 (rewrite (package-input-rewriting/spec
1468 `(("glib" . ,identity)))))
1469 (and (= (length (package-transitive-inputs gobject))
1470 (length (package-transitive-inputs (rewrite gobject))))
1471 (string=? (derivation-file-name
1472 (package-derivation %store (rewrite gobject)))
1473 (derivation-file-name
1474 (package-derivation %store gobject))))))
1475
1476(test-assert "package-input-rewriting, identity"
1477 ;; Similar to the test above, but with 'package-input-rewriting'.
1478 ;; See <https://issues.guix.gnu.org/43890>.
1479 (let* ((libffi (dummy-package "libffi"
1480 (build-system trivial-build-system)))
1481 (glib (dummy-package "glib"
1482 (build-system trivial-build-system)
1483 (propagated-inputs `(("libffi" ,libffi)))))
1484 (gobject (dummy-package "gobject-introspection"
1485 (build-system trivial-build-system)
1486 (inputs `(("glib" ,glib)))
1487 (propagated-inputs `(("libffi" ,libffi)))))
1488 (rewrite (package-input-rewriting `((,glib . ,glib)))))
1489 (and (= (length (package-transitive-inputs gobject))
1490 (length (package-transitive-inputs (rewrite gobject))))
1491 (string=? (derivation-file-name
1492 (package-derivation %store (rewrite gobject)))
1493 (derivation-file-name
1494 (package-derivation %store gobject))))))
1495
1453(test-equal "package-patched-vulnerabilities" 1496(test-equal "package-patched-vulnerabilities"
1454 '(("CVE-2015-1234") 1497 '(("CVE-2015-1234")
1455 ("CVE-2016-1234" "CVE-2018-4567") 1498 ("CVE-2016-1234" "CVE-2018-4567")