summaryrefslogtreecommitdiff
path: root/tests/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-06-05 23:41:37 +0200
committerLudovic Courtès <ludo@gnu.org>2023-06-14 22:54:30 +0200
commite4259d4e9e3251e4c4b45d1cce4008ac32b504c8 (patch)
tree7baa5cee009351303353cdd2b4b4183fa2501259 /tests/packages.scm
parent35c27ec5eedfe8ea4fc653bef0bf213c1a58e7a2 (diff)
packages: 'package-transitive-supported-systems' detects cycles.
With this change, commands such as 'guix build' or 'guix package' report obvious package-level cycles upfront. Derivation-level cycles are not detected. * guix/packages.scm (&package-cyclic-dependency-error): New condition type. (package-transitive-supported-systems): Define 'visited', check it, and parameterize it. * guix/ui.scm (call-with-error-handling): Handle '&package-cyclic-dependency-error'. * tests/packages.scm ("package-transitive-supported-systems detects cycles"): Add test.
Diffstat (limited to 'tests/packages.scm')
-rw-r--r--tests/packages.scm17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 5e8eac99dc4..2b7ab01f7dd 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -368,6 +368,23 @@
368 (package-transitive-supported-systems d) 368 (package-transitive-supported-systems d)
369 (package-transitive-supported-systems e)))) 369 (package-transitive-supported-systems e))))
370 370
371(test-equal "package-transitive-supported-systems detects cycles"
372 '("c" "a" "b" "c")
373 (letrec* ((a (dummy-package "a"
374 (build-system trivial-build-system)
375 (native-inputs (list c))))
376 (b (dummy-package "b"
377 (build-system trivial-build-system)
378 (inputs (list a))))
379 (c (dummy-package "c"
380 (build-system trivial-build-system)
381 (inputs (list b)))))
382 (guard (c ((package-cyclic-dependency-error? c)
383 (map package-name
384 (cons (package-error-package c)
385 (package-error-dependency-cycle c)))))
386 (package-transitive-supported-systems c))))
387
371(test-assert "package-development-inputs" 388(test-assert "package-development-inputs"
372 ;; Note: Due to propagated inputs, 'package-development-inputs' returns a 389 ;; Note: Due to propagated inputs, 'package-development-inputs' returns a
373 ;; couple more inputs, such as 'linux-libre-headers'. 390 ;; couple more inputs, such as 'linux-libre-headers'.