[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/09: guix system: Report file system errors using 'report-error'.
From: |
guix-commits |
Subject: |
09/09: guix system: Report file system errors using 'report-error'. |
Date: |
Sat, 25 Jul 2020 13:13:55 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 9a6322774db5739f22342e22abc9385479b88ba5
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sat Jul 25 18:37:30 2020 +0200
guix system: Report file system errors using 'report-error'.
* guix/scripts/system.scm
(check-file-system-availability)[file-system-location*]:
Return a <location> record instead of a string.
[error]: Use 'report-error' instead of 'format'.
Change callers accordingly.
---
guix/scripts/system.scm | 23 +++++++++++------------
1 file changed, 11 insertions(+), 12 deletions(-)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 79bfcd7..bfd50c7 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -565,16 +565,14 @@ any, are available. Raise an error if they're not."
(define fail? #f)
(define (file-system-location* fs)
- (location->string
- (source-properties->location
- (file-system-location fs))))
+ (and=> (file-system-location fs)
+ source-properties->location))
(let-syntax ((error (syntax-rules ()
((_ args ...)
(begin
(set! fail? #t)
- (format (current-error-port)
- args ...))))))
+ (report-error args ...))))))
(for-each (lambda (fs)
(catch 'system-error
(lambda ()
@@ -582,9 +580,9 @@ any, are available. Raise an error if they're not."
(lambda args
(let ((errno (system-error-errno args))
(device (file-system-device fs)))
- (error (G_ "~a: error: device '~a' not found: ~a~%")
- (file-system-location* fs) device
- (strerror errno))
+ (error (file-system-location* fs)
+ (G_ "device '~a' not found: ~a~%")
+ device (strerror errno))
(unless (string-prefix? "/" device)
(display-hint (format #f (G_ "If '~a' is a file system
label, write @code{(file-system-label ~s)} in your @code{device} field.")
@@ -594,13 +592,14 @@ label, write @code{(file-system-label ~s)} in your
@code{device} field.")
(let ((label (file-system-label->string
(file-system-device fs))))
(unless (find-partition-by-label label)
- (error (G_ "~a: error: file system with label '~a' not
found~%")
- (file-system-location* fs) label))))
+ (error (file-system-location* fs)
+ (G_ "file system with label '~a' not found~%")
+ label))))
labeled)
(for-each (lambda (fs)
(unless (find-partition-by-uuid (file-system-device fs))
- (error (G_ "~a: error: file system with UUID '~a' not
found~%")
- (file-system-location* fs)
+ (error (file-system-location* fs)
+ (G_ "file system with UUID '~a' not found~%")
(uuid->string (file-system-device fs)))))
uuid)
- branch master updated (07dbdbd -> 9a63227), guix-commits, 2020/07/25
- 02/09: utils: Remove compatibility re-export of 'memoize'., guix-commits, 2020/07/25
- 03/09: utils: Move '&fix-hint' to (guix diagnostics)., guix-commits, 2020/07/25
- 01/09: utils: Move <location> and '&error-location' to (guix diagnostics)., guix-commits, 2020/07/25
- 05/09: ui: Factorize '&message' handling., guix-commits, 2020/07/25
- 06/09: diagnostics: Add a procedural variant of diagnostic procedures., guix-commits, 2020/07/25
- 04/09: file-systems: Convey hint via '&fix-hint'., guix-commits, 2020/07/25
- 07/09: diagnostics: Add '&formatted-message'., guix-commits, 2020/07/25
- 08/09: Use 'formatted-message' instead of '&message' where appropriate., guix-commits, 2020/07/25
- 09/09: guix system: Report file system errors using 'report-error'.,
guix-commits <=