import/elpa: Abort early on failure to fetch meta data.
* guix/import/elpa.scm (elpa->guix-package): Raise condition instead of returning #FALSE. * guix/scripts/import/elpa.scm (guix-import-elpa): Handle conditions when importing recursively.
This commit is contained in:
parent
e3eea177c8
commit
f249af3086
2 changed files with 17 additions and 8 deletions
|
@ -3,6 +3,7 @@
|
||||||
;;; Copyright © 2015, 2016, 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2015, 2016, 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
|
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
|
||||||
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
|
;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net>
|
||||||
|
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -29,6 +30,8 @@
|
||||||
#:use-module (srfi srfi-9 gnu)
|
#:use-module (srfi srfi-9 gnu)
|
||||||
#:use-module (srfi srfi-11)
|
#:use-module (srfi srfi-11)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
|
#:use-module (srfi srfi-34)
|
||||||
|
#:use-module (srfi srfi-35)
|
||||||
#:use-module ((guix download) #:select (download-to-store))
|
#:use-module ((guix download) #:select (download-to-store))
|
||||||
#:use-module (guix import utils)
|
#:use-module (guix import utils)
|
||||||
#:use-module (guix http-client)
|
#:use-module (guix http-client)
|
||||||
|
@ -392,7 +395,12 @@ type '<elpa-package>'."
|
||||||
(define* (elpa->guix-package name #:key (repo 'gnu) version)
|
(define* (elpa->guix-package name #:key (repo 'gnu) version)
|
||||||
"Fetch the package NAME from REPO and produce a Guix package S-expression."
|
"Fetch the package NAME from REPO and produce a Guix package S-expression."
|
||||||
(match (fetch-elpa-package name repo)
|
(match (fetch-elpa-package name repo)
|
||||||
(#f #f)
|
(#false
|
||||||
|
(raise (condition
|
||||||
|
(&message
|
||||||
|
(message (format #false
|
||||||
|
"couldn't find meta-data for ELPA package `~a'."
|
||||||
|
name))))))
|
||||||
(package
|
(package
|
||||||
;; ELPA is known to contain only GPLv3+ code. Other repos may contain
|
;; ELPA is known to contain only GPLv3+ code. Other repos may contain
|
||||||
;; code under other license but there's no license metadata.
|
;; code under other license but there's no license metadata.
|
||||||
|
|
|
@ -96,13 +96,14 @@ Import the latest package named PACKAGE-NAME from an ELPA repository.\n"))
|
||||||
(match args
|
(match args
|
||||||
((package-name)
|
((package-name)
|
||||||
(if (assoc-ref opts 'recursive)
|
(if (assoc-ref opts 'recursive)
|
||||||
(map (match-lambda
|
(with-error-handling
|
||||||
((and ('package ('name name) . rest) pkg)
|
(map (match-lambda
|
||||||
`(define-public ,(string->symbol name)
|
((and ('package ('name name) . rest) pkg)
|
||||||
,pkg))
|
`(define-public ,(string->symbol name)
|
||||||
(_ #f))
|
,pkg))
|
||||||
(elpa-recursive-import package-name
|
(_ #f))
|
||||||
(or (assoc-ref opts 'repo) 'gnu)))
|
(elpa-recursive-import package-name
|
||||||
|
(or (assoc-ref opts 'repo) 'gnu))))
|
||||||
(let ((sexp (elpa->guix-package package-name
|
(let ((sexp (elpa->guix-package package-name
|
||||||
#:repo (assoc-ref opts 'repo))))
|
#:repo (assoc-ref opts 'repo))))
|
||||||
(unless sexp
|
(unless sexp
|
||||||
|
|
Reference in a new issue