From 70a8e13277d4a44b89dd9ee2290b98105f0235f1 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 11 Dec 2019 10:52:58 +0100 Subject: 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 --- guix/import/utils.scm | 16 +++++++--------- guix/scripts/import/cran.scm | 6 ++---- guix/scripts/import/crate.scm | 4 +--- guix/scripts/import/elpa.scm | 6 ++---- guix/scripts/import/gem.scm | 4 +--- guix/scripts/import/hackage.scm | 4 +--- guix/scripts/import/opam.scm | 4 +--- guix/scripts/import/pypi.scm | 4 +--- guix/scripts/import/stackage.scm | 4 +--- tests/gem.scm | 3 +-- tests/import-utils.scm | 28 +++++++++++++--------------- 11 files changed, 31 insertions(+), 52 deletions(-) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index ef7c13259d..47fc8276a9 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -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))) diff --git a/guix/scripts/import/cran.scm b/guix/scripts/import/cran.scm index d47be584ae..d6f371ef3a 100644 --- a/guix/scripts/import/cran.scm +++ b/guix/scripts/import/cran.scm @@ -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)))) diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm index a388dc368d..92034dab3c 100644 --- a/guix/scripts/import/crate.scm +++ b/guix/scripts/import/crate.scm @@ -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'~%") diff --git a/guix/scripts/import/elpa.scm b/guix/scripts/import/elpa.scm index 3cdb49eae4..d270d2b4bc 100644 --- a/guix/scripts/import/elpa.scm +++ b/guix/scripts/import/elpa.scm @@ -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)) diff --git a/guix/scripts/import/gem.scm b/guix/scripts/import/gem.scm index afd7bf6d3e..c64596b514 100644 --- a/guix/scripts/import/gem.scm +++ b/guix/scripts/import/gem.scm @@ -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'~%") diff --git a/guix/scripts/import/hackage.scm b/guix/scripts/import/hackage.scm index 023cc1e700..710e786a79 100644 --- a/guix/scripts/import/hackage.scm +++ b/guix/scripts/import/hackage.scm @@ -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)) diff --git a/guix/scripts/import/opam.scm b/guix/scripts/import/opam.scm index 10410f714d..20da1437fe 100644 --- a/guix/scripts/import/opam.scm +++ b/guix/scripts/import/opam.scm @@ -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 diff --git a/guix/scripts/import/pypi.scm b/guix/scripts/import/pypi.scm index f5f34b3c1b..33167174e2 100644 --- a/guix/scripts/import/pypi.scm +++ b/guix/scripts/import/pypi.scm @@ -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 diff --git a/guix/scripts/import/stackage.scm b/guix/scripts/import/stackage.scm index 9325341c84..d77328dcbf 100644 --- a/guix/scripts/import/stackage.scm +++ b/guix/scripts/import/stackage.scm @@ -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)) diff --git a/tests/gem.scm b/tests/gem.scm index 82b2c3cea1..5158238d18 100644 --- a/tests/gem.scm +++ b/tests/gem.scm @@ -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") diff --git a/tests/import-utils.scm b/tests/import-utils.scm index 3400433bbb..87dda3238f 100644 --- a/tests/import-utils.scm +++ b/tests/import-utils.scm @@ -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") -- cgit 1.4.1