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.
This commit is contained in:
parent
d51bfe242f
commit
9a6322774d
|
@ -565,16 +565,14 @@ (define uuid
|
|||
(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 @@ (define (file-system-location* fs)
|
|||
(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 @@ (define (file-system-location* fs)
|
|||
(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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue