[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26346: [PATCH 13/17] build-system/asdf: Handle unusually-named syste
From: |
Andy Patterson |
Subject: |
bug#26346: [PATCH 13/17] build-system/asdf: Handle unusually-named systems. |
Date: |
Mon, 3 Apr 2017 09:01:30 -0400 |
* guix/build/lisp-utils.scm (valid-char-set, normalize-string): New
variables.
(compiled-system): Truncate the name of a system which contains slashes.
(generate-system-definition, make-asd-file): Use `normalize-string' to alter
the names of the created system and its dependencies.
* guix/build/asdf-build-system.scm (create-asd-file): Normalize the name of
the asd file being created.
---
guix/build/asdf-build-system.scm | 6 ++++--
guix/build/lisp-utils.scm | 36 ++++++++++++++++++++++++------------
2 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/guix/build/asdf-build-system.scm b/guix/build/asdf-build-system.scm
index cea7b87e8..38365cdec 100644
--- a/guix/build/asdf-build-system.scm
+++ b/guix/build/asdf-build-system.scm
@@ -150,8 +150,10 @@ valid."
(let*-values (((out) (library-output outputs))
((_ version) (package-name->name+version
(strip-store-file-name out)))
- ((new-asd-file) (string-append (library-directory out)
- "/" asd-system-name ".asd")))
+ ((new-asd-file) (string-append
+ (library-directory out)
+ "/" (normalize-string asd-system-name)
+ ".asd")))
(make-asd-file new-asd-file
#:system asd-system-name
diff --git a/guix/build/lisp-utils.scm b/guix/build/lisp-utils.scm
index 3f7a6f77c..c48f51c98 100644
--- a/guix/build/lisp-utils.scm
+++ b/guix/build/lisp-utils.scm
@@ -40,7 +40,9 @@
prepend-to-source-registry
build-program
build-image
- make-asd-file))
+ make-asd-file
+ valid-char-set
+ normalize-string))
;;; Commentary:
;;;
@@ -65,6 +67,15 @@
(define (%bundle-install-prefix)
(string-append %source-install-prefix "/" (%lisp-type) "-bundle-systems"))
+;; See nix/libstore/store-api.cc#checkStoreName.
+(define valid-char-set
+ (string->char-set
+ "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+-._?="))
+
+(define (normalize-string str)
+ "Replace invalid characters in STR with a hyphen."
+ (string-join (string-tokenize str valid-char-set) "-"))
+
(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."
@@ -161,14 +172,15 @@ asdf:system-depends-on. First load the system's
ASD-FILE."
(delete-file deps-file)))))
(define (compiled-system system)
- (match (%lisp-type)
- ("sbcl" (string-append system "--system"))
- (_ system)))
+ (let ((system (basename system))) ; this is how asdf handles slashes
+ (match (%lisp-type)
+ ("sbcl" (string-append system "--system"))
+ (_ system))))
(define* (generate-system-definition system
#:key version dependencies)
`(asdf:defsystem
- ,system
+ ,(normalize-string system)
:class asdf/bundle:prebuilt-system
:version ,version
:depends-on ,dependencies
@@ -261,20 +273,20 @@ to locate its dependent systems."
"Create an ASD-FILE for address@hidden, appending a program to allow the
system to find its dependencies, as described by GENERATE-DEPENDENCY-LINKS."
(define dependencies
- (system-dependencies system system-asd-file))
+ (let ((deps
+ (system-dependencies system system-asd-file)))
+ (if (eq? 'NIL deps)
+ '()
+ (map normalize-string deps))))
(define lisp-input-map
(inputs->asd-file-map inputs))
(define registry
(filter-map hash-get-handle
- (make-list (if (eq? 'NIL dependencies)
- 0
- (length dependencies))
+ (make-list (length dependencies)
lisp-input-map)
- (if (eq? 'NIL dependencies)
- '()
- dependencies)))
+ dependencies))
(call-with-output-file asd-file
(lambda (port)
--
2.11.1
- bug#26346: [PATCH] asdf-build-system improvements., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 01/17] gnu: cl-slynk: Clarify the description., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 09/17] build-system/asdf: Make #:lisp a package argument., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 14/17] gnu: Add cl-unicode., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 02/17] gnu: cl-slynk: Explain some naming choices., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 04/17] build-system/asdf: Make it possible to use "lib" as the build output., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 06/17] build-system/asdf: Use asdf to determine dependencies., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 07/17] build-system/asdf: Don't rename inputs., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 13/17] build-system/asdf: Handle unusually-named systems.,
Andy Patterson <=
- bug#26346: [PATCH 17/17] gnu: sbcl-slynk-boot0: Give the package an appropriate name., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 03/17] build-system/asdf: Rename %install-prefix to %source-install-prefix., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 08/17] build-system/asdf: Keep ecl's generated archive files., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 15/17] build-system/asdf: Simplify the use of lisp-eval-program., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 16/17] build-system/asdf: Retain references to source files for binary outputs., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 11/17] build-system/asdf: Pass the system name as an argument to the builder., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 10/17] build-system/asdf: Parameterize the lisp type and implementation globally., Andy Patterson, 2017/04/03
- bug#26346: [PATCH 12/17] build-system/asdf: Always pre-load the system's definition file., Andy Patterson, 2017/04/03