GNU bug report logs - #26346
[PATCH] asdf-build-system improvements.

Previous Next

Package: guix-patches;

Reported by: Andy Patterson <ajpatter <at> uwaterloo.ca>

Date: Mon, 3 Apr 2017 05:36:01 UTC

Severity: normal

Tags: patch

Done: Ricardo Wurmus <rekado <at> elephly.net>

Bug is archived. No further changes may be made.

Full log


Message #91 received at 26346 <at> debbugs.gnu.org (full text, mbox):

From: Andy Patterson <ajpatter <at> uwaterloo.ca>
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 26346 <at> debbugs.gnu.org
Subject: Re: bug#26346: [PATCH 19/20] build-system/asdf: Handle versioned
 asdf dependencies.
Date: Sun, 21 May 2017 22:35:03 -0400
On Tue, 16 May 2017 10:17:14 +0200
Ricardo Wurmus <rekado <at> elephly.net> wrote:

> Andy Patterson <ajpatter <at> uwaterloo.ca> writes:
> 
> > Add support for depencies of the form (:version <name> <version>).
> >
> > * 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.
> > ---  
> 
> Could you please explain how this is to be used and why it’s needed?
> Where would this be specified?
> 

Here's an updated patch. I've found the upstream documentation
describing how dependencies are defined and implemented the full
specification. Let me know if there are still concerns I need to
address. Thanks for taking a look at this series!

--
Andy

From 583c9e410594cd68a768edf0d00a787b9f77cd28 Mon Sep 17 00:00:00 2001
From: Andy Patterson <ajpatter <at> uwaterloo.ca>
Date: Sat, 8 Apr 2017 13:36:26 -0400
Subject: [PATCH] build-system/asdf: Handle all asdf dependency specifications.

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.13.0





This bug report was last modified 8 years and 5 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.