mirror of
git://git.savannah.gnu.org/guix.git
synced 2023-12-14 03:33:07 +01:00
import: utils: 'recursive-import' returns a list rather than a stream.
* guix/import/utils.scm (recursive-import): Remove 'list->stream' call. * guix/scripts/import/cran.scm (guix-import-cran): Remove 'stream->list' call. * guix/scripts/import/crate.scm (guix-import-crate): Likewise. * guix/scripts/import/elpa.scm (guix-import-elpa): Likewise. * guix/scripts/import/gem.scm (guix-import-gem): Likewise. * guix/scripts/import/hackage.scm (guix-import-hackage): Likewise. * guix/scripts/import/opam.scm (guix-import-opam): Likewise. * guix/scripts/import/pypi.scm (guix-import-pypi): Likewise. * guix/scripts/import/stackage.scm (guix-import-stackage): Likewise. * tests/gem.scm ("gem-recursive-import"): Likewise. * tests/import-utils.scm ("recursive-import"): Likewise. Co-authored-by: Brian Leung <bkleung89@gmail.com>
This commit is contained in:
parent
ddd5915900
commit
70a8e13277
11 changed files with 31 additions and 52 deletions
|
@ -44,7 +44,6 @@
|
|||
#:use-module (srfi srfi-9)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-26)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:export (factorize-uri
|
||||
|
||||
flatten
|
||||
|
@ -422,11 +421,10 @@ name corresponding to the upstream name."
|
|||
(receive (package dependencies) (repo->guix-package name repo)
|
||||
(make-node name package dependencies)))
|
||||
|
||||
(list->stream ;TODO: remove streams
|
||||
(map node-package
|
||||
(topological-sort (list (lookup-node package-name))
|
||||
(lambda (node)
|
||||
(map lookup-node
|
||||
(remove exists?
|
||||
(node-dependencies node))))
|
||||
node-name))))
|
||||
(map node-package
|
||||
(topological-sort (list (lookup-node package-name))
|
||||
(lambda (node)
|
||||
(map lookup-node
|
||||
(remove exists?
|
||||
(node-dependencies node))))
|
||||
node-name)))
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (guix-import-cran))
|
||||
|
@ -98,9 +97,8 @@ Import and convert the CRAN package for PACKAGE-NAME.\n"))
|
|||
(if (assoc-ref opts 'recursive)
|
||||
;; Recursive import
|
||||
(map package->definition
|
||||
(stream->list
|
||||
(cran-recursive-import package-name
|
||||
(or (assoc-ref opts 'repo) 'cran))))
|
||||
(cran-recursive-import package-name
|
||||
(or (assoc-ref opts 'repo) 'cran)))
|
||||
;; Single import
|
||||
(let ((sexp (cran->guix-package package-name
|
||||
(or (assoc-ref opts 'repo) 'cran))))
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (guix-import-crate))
|
||||
|
@ -101,8 +100,7 @@ Import and convert the crate.io package for PACKAGE-NAME.\n"))
|
|||
`(define-public ,(string->symbol name)
|
||||
,pkg))
|
||||
(_ #f))
|
||||
(stream->list
|
||||
(crate-recursive-import name)))
|
||||
(crate-recursive-import name))
|
||||
(let ((sexp (crate->guix-package name version)))
|
||||
(unless sexp
|
||||
(leave (G_ "failed to download meta-data for package '~a'~%")
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (guix-import-elpa))
|
||||
|
@ -101,9 +100,8 @@ Import the latest package named PACKAGE-NAME from an ELPA repository.\n"))
|
|||
`(define-public ,(string->symbol name)
|
||||
,pkg))
|
||||
(_ #f))
|
||||
(stream->list
|
||||
(elpa-recursive-import package-name
|
||||
(or (assoc-ref opts 'repo) 'gnu))))
|
||||
(elpa-recursive-import package-name
|
||||
(or (assoc-ref opts 'repo) 'gnu)))
|
||||
(let ((sexp (elpa->guix-package package-name (assoc-ref opts 'repo))))
|
||||
(unless sexp
|
||||
(leave (G_ "failed to download package '~a'~%") package-name))
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (guix-import-gem))
|
||||
|
@ -95,8 +94,7 @@ Import and convert the RubyGems package for PACKAGE-NAME.\n"))
|
|||
`(define-public ,(string->symbol name)
|
||||
,pkg))
|
||||
(_ #f))
|
||||
(stream->list
|
||||
(gem-recursive-import package-name 'rubygems)))
|
||||
(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'~%")
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (guix-import-hackage))
|
||||
|
@ -130,8 +129,7 @@ version.\n"))
|
|||
`(define-public ,(string->symbol name)
|
||||
,pkg))
|
||||
(_ #f))
|
||||
(stream->list
|
||||
(apply hackage-recursive-import arguments)))
|
||||
(apply hackage-recursive-import arguments))
|
||||
;; Single import
|
||||
(apply hackage->guix-package arguments))))
|
||||
(unless sexp (error-fn))
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (guix-import-opam))
|
||||
|
@ -94,8 +93,7 @@ Import and convert the opam package for PACKAGE-NAME.\n"))
|
|||
`(define-public ,(string->symbol name)
|
||||
,pkg))
|
||||
(_ #f))
|
||||
(stream->list
|
||||
(opam-recursive-import package-name)))
|
||||
(opam-recursive-import package-name))
|
||||
;; Single import
|
||||
(let ((sexp (opam->guix-package package-name)))
|
||||
(unless sexp
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (guix-import-pypi))
|
||||
|
@ -95,8 +94,7 @@ Import and convert the PyPI package for PACKAGE-NAME.\n"))
|
|||
`(define-public ,(string->symbol name)
|
||||
,pkg))
|
||||
(_ #f))
|
||||
(stream->list
|
||||
(pypi-recursive-import package-name)))
|
||||
(pypi-recursive-import package-name))
|
||||
;; Single import
|
||||
(let ((sexp (pypi->guix-package package-name)))
|
||||
(unless sexp
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#:use-module (srfi srfi-1)
|
||||
#:use-module (srfi srfi-11)
|
||||
#:use-module (srfi srfi-37)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (ice-9 format)
|
||||
#:export (guix-import-stackage))
|
||||
|
@ -110,8 +109,7 @@ Import and convert the LTS Stackage package for PACKAGE-NAME.\n"))
|
|||
`(define-public ,(string->symbol name)
|
||||
,pkg))
|
||||
(_ #f))
|
||||
(stream->list
|
||||
(apply stackage-recursive-import arguments)))
|
||||
(apply stackage-recursive-import arguments))
|
||||
;; Single import
|
||||
(apply stackage->guix-package arguments))))
|
||||
(unless sexp (error-fn))
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#:use-module (gcrypt hash)
|
||||
#:use-module (guix tests)
|
||||
#:use-module ((guix build utils) #:select (delete-file-recursively))
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (srfi srfi-64)
|
||||
#:use-module (ice-9 match))
|
||||
|
||||
|
@ -121,7 +120,7 @@
|
|||
(values (open-input-string test-bundler-json)
|
||||
(string-length test-bundler-json)))
|
||||
(_ (error "Unexpected URL: " url)))))
|
||||
(match (stream->list (gem-recursive-import "foo"))
|
||||
(match (gem-recursive-import "foo")
|
||||
((('package
|
||||
('name "ruby-bar")
|
||||
('version "1.0.0")
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#:use-module (guix packages)
|
||||
#:use-module (guix build-system)
|
||||
#:use-module (gnu packages)
|
||||
#:use-module (srfi srfi-41)
|
||||
#:use-module (srfi srfi-64)
|
||||
#:use-module (ice-9 match))
|
||||
|
||||
|
@ -49,20 +48,19 @@
|
|||
(package
|
||||
(name "foo")
|
||||
(inputs `(("bar" ,bar)))))
|
||||
(stream->list
|
||||
(recursive-import "foo" 'repo
|
||||
#:repo->guix-package
|
||||
(match-lambda*
|
||||
(("foo" 'repo)
|
||||
(values '(package
|
||||
(name "foo")
|
||||
(inputs `(("bar" ,bar))))
|
||||
'("bar")))
|
||||
(("bar" 'repo)
|
||||
(values '(package
|
||||
(name "bar"))
|
||||
'())))
|
||||
#:guix-name identity)))
|
||||
(recursive-import "foo" 'repo
|
||||
#:repo->guix-package
|
||||
(match-lambda*
|
||||
(("foo" 'repo)
|
||||
(values '(package
|
||||
(name "foo")
|
||||
(inputs `(("bar" ,bar))))
|
||||
'("bar")))
|
||||
(("bar" 'repo)
|
||||
(values '(package
|
||||
(name "bar"))
|
||||
'())))
|
||||
#:guix-name identity))
|
||||
|
||||
(test-assert "alist->package with simple source"
|
||||
(let* ((meta '(("name" . "hello")
|
||||
|
|
Loading…
Reference in a new issue