[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/45: guix build: Print hints when -s or --target is passed an invalid
From: |
guix-commits |
Subject: |
01/45: guix build: Print hints when -s or --target is passed an invalid string. |
Date: |
Thu, 4 Aug 2022 06:07:06 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit f44c13560885a8751fe59ba2e512a726c1674b1e
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Wed Aug 3 23:01:01 2022 +0200
guix build: Print hints when -s or --target is passed an invalid string.
* guix/scripts/build.scm (%standard-cross-build-options)
(%standard-native-build-options): Print hints when the target/system is
not found.
---
guix/scripts/build.scm | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 75bbb701ae..06d9ad1f0c 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -373,8 +373,19 @@ use '--no-offload' instead~%")))
(first (member arg (targets))))))
(if t
(apply values (alist-cons 'target t result) rest)
- (leave (G_ "'~a' is not a supported target~%")
- arg)))))))
+ (let ((closest (string-closest arg (targets)
+ #:threshold 5)))
+ (report-error
+ (G_ "'~a' is not a supported cross-compilation target~%")
+ arg)
+ (if closest
+ (display-hint
+ (format #f (G_ "Did you mean @code{~a}?
+Try @option{--list-targets} to view available targets.~%")
+ closest))
+ (display-hint (G_ "\
+Try @option{--list-targets} to view available targets.~%")))
+ (exit 1))))))))
(define %standard-native-build-options
;; Build options related to native builds.
@@ -389,8 +400,18 @@ use '--no-offload' instead~%")))
(first (member arg (systems))))))
(if s
(apply values (alist-cons 'system s result) rest)
- (leave (G_ "'~a' is not a supported system~%")
- arg)))))))
+ (let ((closest (string-closest arg (systems)
+ #:threshold 5)))
+ (report-error (G_ "'~a' is not a supported system~%")
+ arg)
+ (if closest
+ (display-hint
+ (format #f (G_ "Did you mean @code{~a}?
+Try @option{--list-systems} to view available system types.~%")
+ closest))
+ (display-hint (G_ "\
+Try @option{--list-systems} to view available system types.~%")))
+ (exit 1))))))))
;;;
- 18/45: gnu: clang-toolchain-8: Use libomp-8., (continued)
- 18/45: gnu: clang-toolchain-8: Use libomp-8., guix-commits, 2022/08/04
- 33/45: gnu: Add ruby-unicode-scripts., guix-commits, 2022/08/04
- 29/45: gnu: Add ruby-link-header., guix-commits, 2022/08/04
- 20/45: gnu: clang-toolchain-7: Use libomp-7., guix-commits, 2022/08/04
- 40/45: gnu: ruby-anystyle-data: Don't write to installed gem., guix-commits, 2022/08/04
- 45/45: gnu: Add python-h5netcdf., guix-commits, 2022/08/04
- 31/45: gnu: Add ruby-rdf-vocab., guix-commits, 2022/08/04
- 08/45: gnu: libomp-13: Reference llvm-13 version string., guix-commits, 2022/08/04
- 21/45: gnu: Add libomp-6., guix-commits, 2022/08/04
- 38/45: gnu: Add ruby-anystyle., guix-commits, 2022/08/04
- 01/45: guix build: Print hints when -s or --target is passed an invalid string.,
guix-commits <=
- 32/45: gnu: Add ruby-bibtex-ruby., guix-commits, 2022/08/04
- 28/45: gnu: Add ruby-latex-decode., guix-commits, 2022/08/04
- 04/45: gnu: Add barony., guix-commits, 2022/08/04
- 17/45: gnu: Add libomp-8., guix-commits, 2022/08/04
- 03/45: environment: Report "command not found" from the child process., guix-commits, 2022/08/04
- 27/45: gnu: Add ruby-ritex., guix-commits, 2022/08/04
- 42/45: gnu: anystyle: Add tests for dictionary adapters., guix-commits, 2022/08/04
- 30/45: gnu: Add ruby-rdf., guix-commits, 2022/08/04
- 22/45: gnu: clang-toolchain-6: Use libomp-6., guix-commits, 2022/08/04
- 14/45: gnu: clang-toolchain-10: Use libomp-10., guix-commits, 2022/08/04