mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
guix: import: Fix parsing Cabal files that import many stanzas
* guix/import/cabal.scm (eval-cabal)[eval]: Split imports to a normalized list before mapping over it. * tests/hackage.scm: Test it. Change-Id: I39ece019251b6a23a937c8562d2d4a545a6bc7df Signed-off-by: Lars-Dominik Braun <lars@6xq.net>
This commit is contained in:
parent
2c9ac9ab20
commit
ab8612d99e
2 changed files with 55 additions and 1 deletions
|
@ -865,7 +865,16 @@ (define (eval sexp)
|
|||
(((? string? name) values)
|
||||
(list name values))
|
||||
((("import" imports) rest ...)
|
||||
(eval (append (append-map (cut assoc-ref common-stanzas <>) imports)
|
||||
(eval (append (append-map
|
||||
;; The imports are (at least sometimes) a list with one string
|
||||
;; containing all the names separeted by commas. This splits
|
||||
;; those strings to a list of strings in the same format that is
|
||||
;; used in common-stanzas.
|
||||
(cut assoc-ref common-stanzas <>)
|
||||
(append-map (lambda (imports-string)
|
||||
(map (compose string-downcase string-trim-both)
|
||||
(string-split imports-string #\,)))
|
||||
imports))
|
||||
rest)))
|
||||
((element rest ...)
|
||||
(cons (eval element) (eval rest)))
|
||||
|
|
|
@ -622,4 +622,49 @@ (define-package-matcher match-ghc-foo-import
|
|||
(test-assert "hackage->guix-package test cabal import"
|
||||
(eval-test-with-cabal test-cabal-import match-ghc-foo-import))
|
||||
|
||||
(define test-cabal-multiple-imports
|
||||
"name: foo
|
||||
version: 1.0.0
|
||||
homepage: http://test.org
|
||||
synopsis: synopsis
|
||||
description: description
|
||||
license: BSD3
|
||||
common commons
|
||||
build-depends:
|
||||
HTTP >= 4000.2.5 && < 4000.3,
|
||||
mtl >= 2.0 && < 3
|
||||
|
||||
common others
|
||||
build-depends:
|
||||
base == 4.16.*,
|
||||
stm-chans == 3.0.*
|
||||
|
||||
executable cabal
|
||||
import:
|
||||
commons
|
||||
, others
|
||||
")
|
||||
|
||||
(define-package-matcher match-ghc-foo-multiple-imports
|
||||
('package
|
||||
('name "ghc-foo")
|
||||
('version "1.0.0")
|
||||
('source
|
||||
('origin
|
||||
('method 'url-fetch)
|
||||
('uri ('hackage-uri "foo" 'version))
|
||||
('sha256
|
||||
('base32
|
||||
(? string? hash)))))
|
||||
('build-system 'haskell-build-system)
|
||||
('properties '(quote ((upstream-name . "foo"))))
|
||||
('inputs ('list 'ghc-http 'ghc-stm-chans))
|
||||
('home-page "http://test.org")
|
||||
('synopsis (? string?))
|
||||
('description (? string?))
|
||||
('license 'license:bsd-3)))
|
||||
|
||||
(test-assert "hackage->guix-package test cabal multiple imports"
|
||||
(eval-test-with-cabal test-cabal-multiple-imports match-ghc-foo-multiple-imports))
|
||||
|
||||
(test-end "hackage")
|
||||
|
|
Loading…
Reference in a new issue