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.
This commit is contained in:
Ludovic Courtès 2023-06-05 23:41:37 +02:00
parent 35c27ec5ee
commit e4259d4e9e
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
3 changed files with 56 additions and 11 deletions

View file

@ -722,6 +722,15 @@ evaluating the tests and bodies of CLAUSES."
(leave (G_ "~a:~a:~a: package `~a' has an invalid input: ~s~%")
file line column
(package-full-name package) input)))
((package-cyclic-dependency-error? c)
(let ((package (package-error-package c)))
(leave (package-location package)
(G_ "~a: dependency cycle detected:
~a~{ -> ~a~}~%")
(package-full-name package)
(package-full-name package)
(map package-full-name
(package-error-dependency-cycle c)))))
((package-cross-build-system-error? c)
(let* ((package (package-error-package c))
(loc (package-location package))