mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-17 04:07:10 -05:00
scripts: import: gem: Fix recursive error handling.
Partly fixes <https://bugs.gnu.org/44115>. * guix/scripts/import/gem.scm (guix-import-gem): Handle error. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
7229b0e858
commit
5278cab3dc
1 changed files with 18 additions and 15 deletions
|
@ -3,6 +3,7 @@
|
|||
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
|
||||
;;; Copyright © 2021 Sarah Morgensen <iskarian@mgsn.dev>
|
||||
;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
|
||||
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -80,24 +81,26 @@ (define (parse-options)
|
|||
|
||||
(let* ((opts (parse-options))
|
||||
(args (filter-map (match-lambda
|
||||
(('argument . value)
|
||||
value)
|
||||
(_ #f))
|
||||
(('argument . value)
|
||||
value)
|
||||
(_ #f))
|
||||
(reverse opts))))
|
||||
(match args
|
||||
((package-name)
|
||||
(if (assoc-ref opts 'recursive)
|
||||
(map (match-lambda
|
||||
((and ('package ('name name) . rest) pkg)
|
||||
`(define-public ,(string->symbol name)
|
||||
,pkg))
|
||||
(_ #f))
|
||||
(gem-recursive-import package-name 'rubygems))
|
||||
(let ((sexp (gem->guix-package package-name)))
|
||||
(unless sexp
|
||||
(leave (G_ "failed to download meta-data for package '~a'~%")
|
||||
package-name))
|
||||
sexp)))
|
||||
(let ((code (if (assoc-ref opts 'recursive)
|
||||
(map (match-lambda
|
||||
((and ('package ('name name) . rest) pkg)
|
||||
`(define-public ,(string->symbol name)
|
||||
,pkg))
|
||||
(_ #f))
|
||||
(gem-recursive-import package-name 'rubygems))
|
||||
(let ((sexp (gem->guix-package package-name)))
|
||||
(if sexp sexp #f)))))
|
||||
(match code
|
||||
((or #f '(#f))
|
||||
(leave (G_ "failed to download meta-data for package '~a'~%")
|
||||
package-name))
|
||||
(_ code))))
|
||||
(()
|
||||
(leave (G_ "too few arguments~%")))
|
||||
((many ...)
|
||||
|
|
Loading…
Reference in a new issue