aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Beffa <beffa@fbengineering.ch>2015-11-11 11:22:42 +0100
committerFederico Beffa <beffa@fbengineering.ch>2015-11-26 18:17:23 +0100
commit9be54eb1b1dab6a3e3ea11734f720a5ef703d76b (patch)
tree6bcd948bf3d49735f4013f51b5af304e3ac4f563
parent7716f55c8356da945261646b4d04864b6d8636aa (diff)
downloadpatches-9be54eb1b1dab6a3e3ea11734f720a5ef703d76b.tar
patches-9be54eb1b1dab6a3e3ea11734f720a5ef703d76b.tar.gz
import: hackage: Imporve parsing of tests.
* guix/import/cabal.scm (lex-word): Add support for tests with no spaces. (impl): Rewrite.
-rw-r--r--guix/import/cabal.scm18
1 files changed, 13 insertions, 5 deletions
diff --git a/guix/import/cabal.scm b/guix/import/cabal.scm
index 8d84e09077..ed6394ef6d 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))