[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/08: import: hackage: Imporve parsing of tests.
From: |
Federico Beffa |
Subject: |
02/08: import: hackage: Imporve parsing of tests. |
Date: |
Thu, 26 Nov 2015 17:18:52 +0000 |
beffa pushed a commit to branch master
in repository guix.
commit 9be54eb1b1dab6a3e3ea11734f720a5ef703d76b
Author: Federico Beffa <address@hidden>
Date: Wed Nov 11 11:22:42 2015 +0100
import: hackage: Imporve parsing of tests.
* guix/import/cabal.scm (lex-word): Add support for tests with no spaces.
(impl): Rewrite.
---
guix/import/cabal.scm | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/guix/import/cabal.scm b/guix/import/cabal.scm
index 8d84e09..ed6394e 100644
--- a/guix/import/cabal.scm
+++ b/guix/import/cabal.scm
@@ -30,6 +30,7 @@
#:use-module (srfi srfi-9 gnu)
#:use-module (system base lalr)
#:use-module (rnrs enums)
+ #:use-module (guix utils)
#:export (read-cabal
eval-cabal
@@ -496,7 +497,7 @@ location."
(define (lex-word port loc)
"Process tokens which can be recognized by reading the next word form PORT.
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))
((is-test w port) (lex-test w loc))
((is-true w) (lex-true loc))
@@ -696,11 +697,18 @@ the ordering operation and the version."
((spec-name spec-op spec-ver)
(comp-spec-name+op+version haskell)))
(if (and spec-ver comp-ver)
- (eval-string
- (string-append "(string" spec-op " \"" comp-name "\""
- " \"" spec-name "-" spec-ver "\")"))
+ (cond
+ ((not (string= spec-name comp-name)) #f)
+ ((string= spec-op "==") (string= spec-ver comp-ver))
+ ((string= spec-op ">=") (version>=? comp-ver spec-ver))
+ ((string= spec-op ">") (version>? comp-ver spec-ver))
+ ((string= spec-op "<=") (not (version>? comp-ver spec-ver)))
+ ((string= spec-op "<") (not (version>=? comp-ver spec-ver)))
+ (else
+ (raise (condition
+ (&message (message "Failed to evaluate 'impl' test."))))))
(string-match spec-name comp-name))))
-
+
(define (cabal-flags)
(make-cabal-section cabal-sexp 'flag))
- branch master updated (b72a441 -> d8c66da), Federico Beffa, 2015/11/26
- 01/08: import: hackage: Add recognition of 'true' and 'false' symbols., Federico Beffa, 2015/11/26
- 02/08: import: hackage: Imporve parsing of tests.,
Federico Beffa <=
- 03/08: import: hackage: Make it resilient to missing final newline., Federico Beffa, 2015/11/26
- 04/08: import: hackage: Make parsing of tests and fields more flexible., Federico Beffa, 2015/11/26
- 08/08: import: hackage: Assume current 'ghc' package version., Federico Beffa, 2015/11/26
- 05/08: utils: Add 'canonical-newline-port'., Federico Beffa, 2015/11/26
- 06/08: import: hackage: Handle CRLF end of line style., Federico Beffa, 2015/11/26
- 07/08: import: hackage: Add new tests., Federico Beffa, 2015/11/26