transformations: '--tune' prints supported micro-architectures upon error.

* guix/transformations.scm (build-system-with-tuning-compiler): Add
&fix-hint condition when asked for an unsupported micro-architecture.
This commit is contained in:
Ludovic Courtès 2022-03-14 09:39:33 +01:00 committed by Ludovic Courtès
parent 15bb35d0c4
commit 3b80e79f21
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -46,6 +46,7 @@ (define-module (guix transformations)
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (srfi srfi-37)
#:use-module (ice-9 match)
#:use-module (ice-9 vlist)
@ -526,10 +527,29 @@ (define (lower* . args)
micro-architecture)))
(unless (member micro-architecture
(or (assoc-ref lst architecture) '()))
(raise (formatted-message
(G_ "compiler ~a does not support micro-architecture ~a")
(package-full-name compiler)
micro-architecture))))
(raise
(make-compound-condition
(formatted-message
(G_ "compiler ~a does not support micro-architecture ~a")
(package-full-name compiler)
micro-architecture)
(condition
(&fix-hint
(hint (match (assoc-ref lst architecture)
(#f (format #f (G_ "Compiler ~a does not support
micro-architectures of ~a.")
(package-full-name compiler "@@")
architecture))
(lst
(format #f (G_ "Compiler ~a supports the following ~a
micro-architectures:
@quotation
~a
@end quotation")
(package-full-name compiler "@@")
architecture
(string-join lst ", ")))))))))))
(bag
(inherit lowered)