mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 22:08:16 -05:00
import: stackage: Avoid using (guix ui) in importer code.
* guix/import/stackage.scm (stackage->guix-package, stackage-lts-info-fetch): Raise 'message' condition instead of using 'leave' from (guix ui). * guix/scripts/import/stackage.scm (guix-import-stackage): Handle conditions.
This commit is contained in:
parent
4fc282b32a
commit
57075ade97
2 changed files with 17 additions and 12 deletions
|
@ -21,12 +21,13 @@ (define-module (guix import stackage)
|
|||
#:use-module (ice-9 regex)
|
||||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (srfi srfi-34)
|
||||
#:use-module (srfi srfi-35)
|
||||
#:use-module (guix import json)
|
||||
#:use-module (guix import hackage)
|
||||
#:use-module (guix memoization)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix upstream)
|
||||
#:use-module (guix ui)
|
||||
#:export (stackage->guix-package
|
||||
%stackage-updater))
|
||||
|
||||
|
@ -49,6 +50,9 @@ (define (lts-info-packages lts-info)
|
|||
((_ ("packages" pkg ...)) pkg)
|
||||
(_ '())))
|
||||
|
||||
(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
|
||||
|
@ -59,7 +63,7 @@ (define stackage-lts-info-fetch
|
|||
(lts-info (json-fetch url)))
|
||||
(if lts-info
|
||||
(reverse lts-info)
|
||||
(leave (_ "LTS release version not found: ~A~%") version))))))
|
||||
(leave-with-message "LTS release version not found: ~a" version))))))
|
||||
|
||||
(define (stackage-package-name pkg-info)
|
||||
(assoc-ref pkg-info "name"))
|
||||
|
@ -99,7 +103,7 @@ (define* (stackage->guix-package package-name ; upstream name
|
|||
(hackage->guix-package name-version
|
||||
#:include-test-dependencies?
|
||||
include-test-dependencies?)
|
||||
(leave (_ "package not found: ~A~%") package-name))))
|
||||
(leave-with-message "~a: Stackage package not found" package-name))))
|
||||
|
||||
|
||||
;;;
|
||||
|
|
|
@ -98,6 +98,7 @@ (define (parse-options)
|
|||
(reverse opts))))
|
||||
(match args
|
||||
((package-name)
|
||||
(with-error-handling
|
||||
(let ((sexp (stackage->guix-package
|
||||
package-name
|
||||
#:include-test-dependencies?
|
||||
|
@ -106,7 +107,7 @@ (define (parse-options)
|
|||
(unless sexp
|
||||
(leave (_ "failed to download cabal file for package '~a'~%")
|
||||
package-name))
|
||||
sexp))
|
||||
sexp)))
|
||||
(()
|
||||
(leave (_ "too few arguments~%")))
|
||||
((many ...)
|
||||
|
|
Loading…
Reference in a new issue