From 445f1b6197c0e266027ac033c52629d990137171 Mon Sep 17 00:00:00 2001 From: Federico Beffa Date: Wed, 11 Nov 2015 11:22:42 +0100 Subject: [PATCH 2/6] import: hackage: Imporve parsing of tests. * guix/import/cabal.scm (lex-word): Add support for tests with no spaces. (impl): Fix handling of operator "==". --- guix/import/cabal.scm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/guix/import/cabal.scm b/guix/import/cabal.scm index 8d84e09..615eca2 100644 --- a/guix/import/cabal.scm +++ b/guix/import/cabal.scm @@ -496,7 +496,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)) @@ -688,7 +688,11 @@ the ordering operation and the version." (cut match:substring <> 2))) (version (and=> (with-ver-matcher-fn spec) (cut match:substring <> 3)))) - (values name operator version))) + (values name + (if (and (string? operator) (string= operator "==")) + "=" + operator) + version))) (define (impl haskell) (let*-values (((comp-name comp-ver) @@ -697,7 +701,7 @@ the ordering operation and the version." (comp-spec-name+op+version haskell))) (if (and spec-ver comp-ver) (eval-string - (string-append "(string" spec-op " \"" comp-name "\"" + (string-append "(string" spec-op " \"" comp-name "-" comp-ver "\"" " \"" spec-name "-" spec-ver "\")")) (string-match spec-name comp-name)))) -- 2.4.3