guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: guix: opam: Fix syntax.


From: guix-commits
Subject: branch master updated: guix: opam: Fix syntax.
Date: Thu, 01 Oct 2020 15:50:07 -0400

This is an automated email from the git hooks/post-receive script.

roptat pushed a commit to branch master
in repository guix.

The following commit(s) were added to refs/heads/master by this push:
     new f4390d3  guix: opam: Fix syntax.
f4390d3 is described below

commit f4390d391b5901735444cba21c94e1e23d3fc575
Author: Julien Lepiller <julien@lepiller.eu>
AuthorDate: Thu Oct 1 15:05:05 2020 +0200

    guix: opam: Fix syntax.
    
    * guix/import/opam.scm (STRCHR, comment, choice): Fix syntax.
    (group-pat): Add syntax.
    (opam->guix-package): Suppport "archive" keyword.
---
 guix/import/opam.scm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index 9cda3da..7327ab6 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -49,16 +49,19 @@
             condition))
 
 ;; Define a PEG parser for the opam format
-(define-peg-pattern comment none (and "#" (* STRCHR) "\n"))
+(define-peg-pattern comment none (and "#" (* COMMCHR) "\n"))
 (define-peg-pattern SP none (or " " "\n" comment))
 (define-peg-pattern SP2 body (or " " "\n"))
 (define-peg-pattern QUOTE none "\"")
 (define-peg-pattern QUOTE2 body "\"")
 (define-peg-pattern COLON none ":")
 ;; A string character is any character that is not a quote, or a quote 
preceded by a backslash.
+(define-peg-pattern COMMCHR none
+                    (or " " "!" "\\" "\"" (range #\# #\頋)))
 (define-peg-pattern STRCHR body
                     (or " " "!" "\n" (and (ignore "\\") "\"")
-                        (and (ignore "\\") "\\") (range #\# #\頋)))
+                        (ignore "\\\n") (and (ignore "\\") "\\")
+                        (range #\# #\頋)))
 (define-peg-pattern operator all (or "=" "!" "<" ">"))
 
 (define-peg-pattern records body (* (and (or record weird-record) (* SP))))
@@ -69,8 +72,12 @@
 (define-peg-pattern choice-pat all (and (ignore "(") (* SP) choice (* SP)  
(ignore ")")))
 (define-peg-pattern choice body
   (or (and (or conditional-value ground-value) (* SP) (ignore "|") (* SP) 
choice)
+      group-pat
       conditional-value
       ground-value))
+(define-peg-pattern group-pat body
+                    (and ground-value (* SP) (ignore "&") (* SP)
+                         (or group-pat conditional-value ground-value)))
 (define-peg-pattern ground-value body (and (or multiline-string string-pat 
choice-pat list-pat var) (* SP)))
 (define-peg-pattern conditional-value all (and ground-value (* SP) condition))
 (define-peg-pattern string-pat all (and QUOTE (* STRCHR) QUOTE))
@@ -258,7 +265,8 @@ or #f on failure."
              (version (assoc-ref opam-file "version"))
              (opam-content (assoc-ref opam-file "metadata"))
              (url-dict (metadata-ref opam-content "url"))
-             (source-url (metadata-ref url-dict "src"))
+             (source-url (or (metadata-ref url-dict "src")
+                             (metadata-ref url-dict "archive")))
              (requirements (metadata-ref opam-content "depends"))
              (dependencies (dependency-list->names requirements))
              (native-dependencies (depends->native-inputs requirements))
@@ -308,7 +316,7 @@ or #f on failure."
                     (filter
                       (lambda (name)
                         (not (member name '("dune" "jbuilder"))))
-                     dependencies))))))))
+                      dependencies))))))))
 
 (define (opam-recursive-import package-name)
   (recursive-import package-name #f



reply via email to

[Prev in Thread] Current Thread [Next in Thread]