unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 50922@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#50922] [PATCH 2/2] import: stackage: Use the standard diagnostic procedures.
Date: Thu, 30 Sep 2021 23:01:44 +0200	[thread overview]
Message-ID: <20210930210144.1798-2-ludo@gnu.org> (raw)
In-Reply-To: <20210930210144.1798-1-ludo@gnu.org>

* guix/import/stackage.scm (leave-with-message): Remove.
(stackage-lts-info-fetch): Use 'raise' and 'formatted-message'.
(stackage->guix-package): Likewise.
(latest-lts-release): Use 'warning' instead of 'format'.
---
 guix/import/stackage.scm | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm
index 4eff09ad01..b4b20ebcf0 100644
--- a/guix/import/stackage.scm
+++ b/guix/import/stackage.scm
@@ -32,6 +32,8 @@
   #:use-module (guix memoization)
   #:use-module (guix packages)
   #:use-module (guix upstream)
+  #:use-module (guix diagnostics)
+  #:use-module (guix i18n)
   #:export (%stackage-url
             stackage->guix-package
             stackage-recursive-import
@@ -71,9 +73,6 @@
   (version     stackage-package-version)
   (synopsis    stackage-package-synopsis))
 
-(define (leave-with-message fmt . args)
-  (raise (condition (&message (message (apply format #f fmt args))))))
-
 (define stackage-lts-info-fetch
   ;; "Retrieve the information about the LTS Stackage release VERSION."
   (memoize
@@ -84,7 +83,8 @@
                                             version)))
             (lts-info (and=> (json-fetch url) json->stackage-lts)))
        (or lts-info
-           (leave-with-message "LTS release version not found: ~a" version))))))
+           (raise (formatted-message (G_ "LTS release version not found: ~a")
+                                     version)))))))
 
 (define (lts-package-version packages name)
   "Return the version of the package with upstream NAME included in PACKAGES."
@@ -120,7 +120,8 @@ included in the Stackage LTS release."
            (hackage->guix-package name-version
                                   #:include-test-dependencies?
                                   include-test-dependencies?)
-           (leave-with-message "~a: Stackage package not found" package-name))))))
+           (raise (formatted-message (G_ "~a: Stackage package not found")
+                                     package-name)))))))
 
 (define (stackage-recursive-import package-name . args)
   (recursive-import package-name
@@ -145,10 +146,10 @@ PACKAGE or #f if the package is not included in the Stackage LTS release."
              (version (lts-package-version (packages) hackage-name))
              (name-version (hackage-name-version hackage-name version)))
         (match (and=> name-version hackage-fetch)
-          (#f (format (current-error-port)
-                      "warning: failed to parse ~a~%"
-                      (hackage-cabal-url hackage-name))
-              #f)
+          (#f
+           (warning (G_ "failed to parse ~a~%")
+                    (hackage-cabal-url hackage-name))
+           #f)
           (_ (let ((url (hackage-source-url hackage-name version)))
                (upstream-source
                 (package (package-name package))
-- 
2.33.0





  reply	other threads:[~2021-09-30 21:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 20:54 [bug#50922] [PATCH 0/2] (guix import stackage) cleanups Ludovic Courtès
2021-09-30 21:01 ` [bug#50922] [PATCH 1/2] import: stackage: Use 'define-json-mapping' Ludovic Courtès
2021-09-30 21:01   ` Ludovic Courtès [this message]
2021-10-02 15:29 ` bug#50922: [PATCH 0/2] (guix import stackage) cleanups 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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=20210930210144.1798-2-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=50922@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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).