mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
transformations: Raise '&formatted-message' exceptions instead of 'leave'.
* guix/transformations.scm (evaluate-replacement-specs) (package-git-url, evaluate-git-replacement-specs) (transform-package-source-git-url) (transform-package-toolchain): Use 'raise' and 'formatted-message' instead of 'leave'.
This commit is contained in:
parent
f68b3ba12d
commit
31726f32ac
1 changed files with 18 additions and 8 deletions
|
@ -38,6 +38,7 @@ (define-module (guix transformations)
|
|||
#:use-module (srfi srfi-9)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (srfi srfi-34)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (ice-9 match)
|
||||
#:export (options->transformation
|
||||
|
@ -169,7 +170,9 @@ (define not-equal
|
|||
(lambda (old)
|
||||
(proc old new)))))
|
||||
(x
|
||||
(leave (G_ "invalid replacement specification: ~s~%") spec))))
|
||||
(raise (formatted-message
|
||||
(G_ "invalid replacement specification: ~s")
|
||||
spec)))))
|
||||
specs))
|
||||
|
||||
(define (transform-package-inputs replacement-specs)
|
||||
|
@ -216,8 +219,9 @@ (define (package-git-url package)
|
|||
((git-checkout? source)
|
||||
(git-checkout-url source))
|
||||
(else
|
||||
(leave (G_ "the source of ~a is not a Git reference~%")
|
||||
(package-full-name package))))))
|
||||
(raise
|
||||
(formatted-message (G_ "the source of ~a is not a Git reference")
|
||||
(package-full-name package)))))))
|
||||
|
||||
(define (evaluate-git-replacement-specs specs proc)
|
||||
"Parse SPECS, a list of strings like \"guile=stable-2.2\", and return a list
|
||||
|
@ -234,7 +238,9 @@ (define (replace old)
|
|||
|
||||
(cons spec replace))
|
||||
(_
|
||||
(leave (G_ "invalid replacement specification: ~s~%") spec))))
|
||||
(raise
|
||||
(formatted-message (G_ "invalid replacement specification: ~s")
|
||||
spec)))))
|
||||
specs))
|
||||
|
||||
(define (transform-package-source-branch replacement-specs)
|
||||
|
@ -304,8 +310,10 @@ (define replacements
|
|||
(source (git-checkout (url url)
|
||||
(recursive? #t)))))))
|
||||
(_
|
||||
(leave (G_ "~a: invalid Git URL replacement specification~%")
|
||||
spec))))
|
||||
(raise
|
||||
(formatted-message
|
||||
(G_ "~a: invalid Git URL replacement specification")
|
||||
spec)))))
|
||||
replacement-specs))
|
||||
|
||||
(define rewrite
|
||||
|
@ -380,8 +388,10 @@ (define replacements
|
|||
((spec (= split-on-commas toolchain))
|
||||
(cons spec (map specification->input toolchain)))
|
||||
(_
|
||||
(leave (G_ "~a: invalid toolchain replacement specification~%")
|
||||
spec))))
|
||||
(raise
|
||||
(formatted-message
|
||||
(G_ "~a: invalid toolchain replacement specification")
|
||||
spec)))))
|
||||
replacement-specs))
|
||||
|
||||
(lambda (obj)
|
||||
|
|
Loading…
Reference in a new issue