summaryrefslogtreecommitdiff
path: root/guix/import/opam.scm
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2020-10-02 00:27:24 +0200
committerJulien Lepiller <julien@lepiller.eu>2020-10-02 00:43:41 +0200
commita6816618fc1e48417a64c5f8ca67e3d64ebc5441 (patch)
tree4a6c7a1657263b2ad2e5756bc3c9d9a5577190a5 /guix/import/opam.scm
parentad05537e32173403d034a0d552092f566abd05a5 (diff)
downloadguix-patches-a6816618fc1e48417a64c5f8ca67e3d64ebc5441.tar
guix-patches-a6816618fc1e48417a64c5f8ca67e3d64ebc5441.tar.gz
import: opam: Report groups in syntax tree.
* guix/import/opam.scm (group-pat): Report in syntax tree. (dependency->input, dependency->native-input, dependency->name): consider the case of a group.
Diffstat (limited to 'guix/import/opam.scm')
-rw-r--r--guix/import/opam.scm13
1 files changed, 8 insertions, 5 deletions
diff --git a/guix/import/opam.scm b/guix/import/opam.scm
index 7327ab6e29..6d9eb0a092 100644
--- a/guix/import/opam.scm
+++ b/guix/import/opam.scm
@@ -75,8 +75,8 @@
group-pat
conditional-value
ground-value))
-(define-peg-pattern group-pat body
- (and ground-value (* SP) (ignore "&") (* SP)
+(define-peg-pattern group-pat all
+ (and (or conditional-value 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))
@@ -196,6 +196,7 @@ path to the repository."
(('string-pat str) str)
;; Arbitrary select the first dependency
(('choice-pat choice ...) (dependency->input (car choice)))
+ (('group-pat val ...) (map dependency->input val))
(('conditional-value val condition)
(if (native? condition) "" (dependency->input val)))))
@@ -203,7 +204,8 @@ path to the repository."
(match dependency
(('string-pat str) "")
;; Arbitrary select the first dependency
- (('choice-pat choice ...) (dependency->input (car choice)))
+ (('choice-pat choice ...) (dependency->native-input (car choice)))
+ (('group-pat val ...) (map dependency->native-input val))
(('conditional-value val condition)
(if (native? condition) (dependency->input val) ""))))
@@ -211,7 +213,8 @@ path to the repository."
(match dependency
(('string-pat str) str)
;; Arbitrary select the first dependency
- (('choice-pat choice ...) (dependency->input (car choice)))
+ (('choice-pat choice ...) (dependency->name (car choice)))
+ (('group-pat val ...) (map dependency->name val))
(('conditional-value val condition)
(dependency->name val))))
@@ -263,7 +266,7 @@ REPOSITORY is #f, from the official OPAM repository. Return a 'package' sexp
or #f on failure."
(and-let* ((opam-file (opam-fetch name repository))
(version (assoc-ref opam-file "version"))
- (opam-content (assoc-ref opam-file "metadata"))
+ (opam-content (pk (assoc-ref opam-file "metadata")))
(url-dict (metadata-ref opam-content "url"))
(source-url (or (metadata-ref url-dict "src")
(metadata-ref url-dict "archive")))