import/cran: Abort with error message when recursive import fails.

Previously, after a failed recursive import "guix import" would signal
success.

* guix/import/cran.scm (cran->guix-package): Raise a condition when all
repositories have been exhausted.
* guix/scripts/import/cran.scm (guix-import-cran): Handle errors.
This commit is contained in:
Ricardo Wurmus 2020-12-12 00:06:18 +01:00
parent 7eb920351a
commit 482b8ae2cd
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC
2 changed files with 10 additions and 5 deletions

View File

@ -29,6 +29,7 @@
#:use-module (srfi srfi-11)
#:use-module (srfi srfi-26)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:use-module (ice-9 receive)
#:use-module (web uri)
#:use-module (guix memoization)
@ -585,7 +586,10 @@ s-expression corresponding to that package, or #f on failure."
((bioconductor)
;; Retry import from CRAN
(cran->guix-package package-name #:repo 'cran))
(else (values #f '()))))))))
(else
(raise (condition
(&message
(message "couldn't find meta-data for R package")))))))))))
(define* (cran-recursive-import package-name #:key (repo 'cran))
(recursive-import package-name

View File

@ -97,10 +97,11 @@ Import and convert the CRAN package for PACKAGE-NAME.\n"))
((package-name)
(if (assoc-ref opts 'recursive)
;; Recursive import
(map package->definition
(filter identity
(cran-recursive-import package-name
#:repo (or (assoc-ref opts 'repo) 'cran))))
(with-error-handling
(map package->definition
(filter identity
(cran-recursive-import package-name
#:repo (or (assoc-ref opts 'repo) 'cran)))))
;; Single import
(let ((sexp (cran->guix-package package-name
#:repo (or (assoc-ref opts 'repo) 'cran))))