all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andy Patterson <ajpatter@uwaterloo.ca>
To: 32582@debbugs.gnu.org
Subject: [bug#32582] [PATCH 1/5] build-system/asdf: Handle all asdf dependency specifications.
Date: Thu, 30 Aug 2018 01:36:28 -0400	[thread overview]
Message-ID: <20180830053632.26414-1-ajpatter@uwaterloo.ca> (raw)
In-Reply-To: <20180830012813.7830cfc6@uwaterloo.ca>

Add support for dependencies of the form (:version <name> <version>),
(:feature <feature> <dependency-specification>) and (:require <module-name>),
as defined by
<https://common-lisp.net/project/asdf/asdf.html#The-defsystem-grammar>.

* guix/build/lisp-utils.scm (normalize-dependency): New variable.
(make-asd-file)[dependencies]: Use it to generate dependencies with normalized
names.
[dependency-name]: New variable.
[registry]: Use it to flatten the normalized dependencies.
---
 guix/build/lisp-utils.scm | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/guix/build/lisp-utils.scm b/guix/build/lisp-utils.scm
index 21cb620d5..3a7afab43 100644
--- a/guix/build/lisp-utils.scm
+++ b/guix/build/lisp-utils.scm
@@ -81,6 +81,20 @@
   "Replace invalid characters in STR with a hyphen."
   (string-join (string-tokenize str valid-char-set) "-"))
 
+(define (normalize-dependency dependency)
+  "Normalize the name of DEPENDENCY.  Handles dependency definitions of the
+dependency-def form described by
+<https://common-lisp.net/project/asdf/asdf.html#The-defsystem-grammar>."
+  (match dependency
+    ((':version name rest ...)
+     `(:version ,(normalize-string name) ,@rest))
+    ((':feature feature-specification dependency-specification)
+     `(:feature
+       ,feature-specification
+       ,(normalize-dependency dependency-specification)))
+    ((? string? name) (normalize-string name))
+    (require-specification require-specification)))
+
 (define (inputs->asd-file-map inputs)
   "Produce a hash table of the form (system . asd-file), where system is the
 name of an ASD system, and asd-file is the full path to its definition."
@@ -273,16 +287,24 @@ system to find its dependencies, as described by GENERATE-DEPENDENCY-LINKS."
            (system-dependencies system system-asd-file)))
       (if (eq? 'NIL deps)
           '()
-          (map normalize-string deps))))
+          (map normalize-dependency deps))))
 
   (define lisp-input-map
     (inputs->asd-file-map inputs))
 
+  (define dependency-name
+    (match-lambda
+      ((':version name _ ...) name)
+      ((':feature _ dependency-specification)
+       (dependency-name dependency-specification))
+      ((? string? name) name)
+      (_ #f)))
+
   (define registry
     (filter-map hash-get-handle
                 (make-list (length dependencies)
                            lisp-input-map)
-                dependencies))
+                (map dependency-name dependencies)))
 
   (call-with-output-file asd-file
     (lambda (port)
-- 
2.18.0

  reply	other threads:[~2018-08-30  5:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30  5:28 [bug#32582] [PATCH 0/5] Fix slynk on sbcl Andy Patterson
2018-08-30  5:36 ` Andy Patterson [this message]
2018-08-30  5:36 ` [bug#32582] [PATCH 2/5] build-system/asdf: Log lisp system invocations Andy Patterson
2018-08-30  5:36 ` [bug#32582] [PATCH 3/5] build-system/asdf: Use invoke Andy Patterson
2018-08-30  5:36 ` [bug#32582] [PATCH 4/5] build-system/asdf: Adopt asdf conventions Andy Patterson
2018-08-30  5:36 ` [bug#32582] [PATCH 5/5] gnu: sbcl-slynk: Fix the build Andy Patterson
2018-09-19  5:14 ` [bug#32582] [PATCH 0/5] Fix slynk on sbcl Andy Patterson
2018-09-19 16:26   ` bug#32582: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180830053632.26414-1-ajpatter@uwaterloo.ca \
    --to=ajpatter@uwaterloo.ca \
    --cc=32582@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.