import: cabal: Allow properties without space between key and value.
* guix/import/cabal.scm (lex-word): Add colon to delimiters.
* tests/hackage.scm (test-cabal-property-no-space): New variable.
("hackage->guix-package test properties without space"): New test.
			
			
This commit is contained in:
		
							parent
							
								
									0972feaff1
								
							
						
					
					
						commit
						001e0bac99
					
				
					 2 changed files with 20 additions and 1 deletions
				
			
		| 
						 | 
					@ -573,7 +573,7 @@ location."
 | 
				
			||||||
(define (lex-word port loc)
 | 
					(define (lex-word port loc)
 | 
				
			||||||
  "Process tokens which can be recognized by reading the next word form PORT.
 | 
					  "Process tokens which can be recognized by reading the next word form PORT.
 | 
				
			||||||
LOC is the current port location."
 | 
					LOC is the current port location."
 | 
				
			||||||
  (let* ((w (read-delimited " <>=()\t\n" port 'peek)))
 | 
					  (let* ((w (read-delimited " <>=():\t\n" port 'peek)))
 | 
				
			||||||
    (cond ((is-if w) (lex-if loc))
 | 
					    (cond ((is-if w) (lex-if loc))
 | 
				
			||||||
          ((is-elif w) (lex-elif loc))
 | 
					          ((is-elif w) (lex-elif loc))
 | 
				
			||||||
          ((is-test w port) (lex-test w loc))
 | 
					          ((is-test w port) (lex-test w loc))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -315,6 +315,25 @@ executable cabal
 | 
				
			||||||
(test-assert "hackage->guix-package test flag executable"
 | 
					(test-assert "hackage->guix-package test flag executable"
 | 
				
			||||||
  (eval-test-with-cabal test-cabal-flag-executable match-ghc-foo))
 | 
					  (eval-test-with-cabal test-cabal-flag-executable match-ghc-foo))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; There is no mandatory space between property name and value.
 | 
				
			||||||
 | 
					(define test-cabal-property-no-space
 | 
				
			||||||
 | 
					  "name:foo
 | 
				
			||||||
 | 
					version:1.0.0
 | 
				
			||||||
 | 
					homepage:http://test.org
 | 
				
			||||||
 | 
					synopsis:synopsis
 | 
				
			||||||
 | 
					description:description
 | 
				
			||||||
 | 
					license:BSD3
 | 
				
			||||||
 | 
					common bench-defaults
 | 
				
			||||||
 | 
					  ghc-options:-Wall
 | 
				
			||||||
 | 
					executable cabal
 | 
				
			||||||
 | 
					  build-depends:
 | 
				
			||||||
 | 
					    HTTP       >= 4000.2.5 && < 4000.3,
 | 
				
			||||||
 | 
					    mtl        >= 2.0      && < 3
 | 
				
			||||||
 | 
					")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(test-assert "hackage->guix-package test properties without space"
 | 
				
			||||||
 | 
					  (eval-test-with-cabal test-cabal-property-no-space match-ghc-foo))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;; Check if-elif-else statements
 | 
					;; Check if-elif-else statements
 | 
				
			||||||
(define test-cabal-if
 | 
					(define test-cabal-if
 | 
				
			||||||
  "name: foo
 | 
					  "name: foo
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue