all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 44321@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#44321] [PATCH 5/6] transformations: Raise '&formatted-message' exceptions instead of 'leave'.
Date: Fri, 30 Oct 2020 00:09:59 +0100	[thread overview]
Message-ID: <20201029231000.14568-5-ludo@gnu.org> (raw)
In-Reply-To: <20201029231000.14568-1-ludo@gnu.org>

* 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'.
---
 guix/transformations.scm | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/guix/transformations.scm b/guix/transformations.scm
index 126a9a69d3..30142dd059 100644
--- a/guix/transformations.scm
+++ b/guix/transformations.scm
@@ -38,6 +38,7 @@
   #: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 @@ package it refers to could not be found."
                     (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 @@ the source of PACKAGE is not fetched from a Git repository."
           ((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 @@ syntax, or if a package it refers to could not be found."
 
             (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 @@ a checkout of the Git repository at the given URL."
                         (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 @@ the equal sign."
              ((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)
-- 
2.28.0





  parent reply	other threads:[~2020-10-29 23:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-29 23:08 [bug#44321] [PATCH 0/6] Adding a (guix transformations) module Ludovic Courtès
2020-10-29 23:09 ` [bug#44321] [PATCH 1/6] guix build: 'package-with-source' no longer takes a 'store' parameter Ludovic Courtès
2020-10-29 23:09   ` [bug#44321] [PATCH 2/6] guix build: Remove unnecessary (replacement #f) Ludovic Courtès
2020-10-29 23:09   ` [bug#44321] [PATCH 3/6] guix build: 'options->transformation' no longer takes a 'store' parameter Ludovic Courtès
2020-10-30 22:27     ` Miguel Ángel Arruga Vivas
2020-10-31 10:03       ` Ludovic Courtès
2020-10-29 23:09   ` [bug#44321] [PATCH 4/6] guix build: Move transformation options to (guix transformations) Ludovic Courtès
2020-10-30 23:03     ` Miguel Ángel Arruga Vivas
2020-10-31 10:04       ` Ludovic Courtès
2020-10-29 23:09   ` Ludovic Courtès [this message]
2020-10-30 10:59     ` [bug#44321] [PATCH 5/6] transformations: Raise '&formatted-message' exceptions instead of 'leave' zimoun
2020-10-30 22:39       ` Miguel Ángel Arruga Vivas
2020-10-31 10:06         ` Ludovic Courtès
2020-10-31 22:18           ` bug#44321: " Ludovic Courtès
2020-11-02 12:25           ` [bug#44321] " zimoun
2020-11-02 15:48             ` Ludovic Courtès
2020-10-29 23:10   ` [bug#44321] [PATCH 6/6] doc: Add "Defining Package Variants" section Ludovic Courtès
2020-10-30 11:20     ` zimoun
2020-10-31 10:14       ` Ludovic Courtès
2020-10-30 23:27   ` [bug#44321] [PATCH 1/6] guix build: 'package-with-source' no longer takes a 'store' parameter Miguel Ángel Arruga Vivas
2020-10-31 10:17     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201029231000.14568-5-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=44321@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.