GNU bug report logs - #50922
[PATCH 0/2] (guix import stackage) cleanups

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Thu, 30 Sep 2021 20:56:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 50922 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: 50922 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [PATCH 2/2] import: stackage: Use the standard diagnostic procedures.
Date: Thu, 30 Sep 2021 23:01:44 +0200
* 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





This bug report was last modified 3 years and 233 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.