[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44115: [PATCH] import: Make failed recursive imports yield an error
From: |
Lulu |
Subject: |
bug#44115: [PATCH] import: Make failed recursive imports yield an error instead of backtrace. |
Date: |
Fri, 30 Oct 2020 01:39:22 +0300 (TRT) |
* guix/import/utils.scm (recursive-import): Move error handling of recursive
imports to a single point.
* guix/import/gem.scm (gem->guix-package): Fix the `values' hack and make the
procedure return #f on failure.
* guix/import/pypi.scm (pypi->guix-package): Fix the condition hack and make
the procedure return #f on failure.
---
guix/import/gem.scm | 2 +-
guix/import/pypi.scm | 5 +----
guix/import/utils.scm | 9 +++++++--
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/guix/import/gem.scm b/guix/import/gem.scm
index 3fe240f36a..c97df149ab 100644
--- a/guix/import/gem.scm
+++ b/guix/import/gem.scm
@@ -143,7 +143,7 @@ VERSION, HASH, HOME-PAGE, DESCRIPTION, DEPENDENCIES, and
LICENSES."
dependencies
licenses)
dependencies-names))
- (values #f '()))))
+ #f)))
(define (guix-package->gem-name package)
"Given a PACKAGE built from rubygems.org, return the name of the
diff --git a/guix/import/pypi.scm b/guix/import/pypi.scm
index 15116e349d..9c6a825243 100644
--- a/guix/import/pypi.scm
+++ b/guix/import/pypi.scm
@@ -478,10 +478,7 @@ VERSION, SOURCE-URL, HOME-PAGE, SYNOPSIS, DESCRIPTION, and
LICENSE."
(info (and project (pypi-project-info project))))
(and project
(guard (c ((missing-source-error? c)
- (let ((package (missing-source-error-package c)))
- (leave (G_ "no source release for pypi package ~a
~a~%")
- (project-info-name info)
- (project-info-version info)))))
+ #f))
(make-pypi-sexp (project-info-name info)
(project-info-version info)
(and=> (latest-source-release project)
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index 145515c489..815a05988e 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -36,6 +36,7 @@
#:use-module (guix store)
#:use-module (guix download)
#:use-module (guix sets)
+ #:use-module (guix ui)
#:use-module (gnu packages)
#:use-module (ice-9 match)
#:use-module (ice-9 rdelim)
@@ -428,8 +429,12 @@ name corresponding to the upstream name."
(not (null? (find-packages-by-name (guix-name name)))))
(define (lookup-node name)
- (receive (package dependencies) (repo->guix-package name repo)
- (make-node name package dependencies)))
+ (call-with-values (lambda () (repo->guix-package name repo))
+ (match-lambda*
+ ((#f)
+ (leave (G_ "failed to download package '~a' during recursive
import~%") name))
+ ((package dependencies)
+ (make-node name package dependencies)))))
(map node-package
(topological-sort (list (lookup-node package-name))
--
2.29.1