all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andy Patterson <ajpatter@uwaterloo.ca>
To: 26346@debbugs.gnu.org
Subject: bug#26346: [PATCH 11/17] build-system/asdf: Pass the system name as an argument to the builder.
Date: Mon,  3 Apr 2017 09:01:28 -0400	[thread overview]
Message-ID: <20170403130134.18881-11-ajpatter@uwaterloo.ca> (raw)
In-Reply-To: <20170403130134.18881-1-ajpatter@uwaterloo.ca>
In-Reply-To: <20170403003732.1c3b8afb@uwaterloo.ca>

* guix/build-system/asdf.scm (asdf-build): Use the user-defined system name,
or calculate it from the package's full name.
[builder]: Pass the value along to the build procedure.
(package-with-build-system): Remove #:asd-system-name from source packages'
arguments.
* guix/build/asdf-build-system.scm: Adjust accordingly.
* guix/build/lisp-utils.scm (remove-lisp-from-name): Delete variable.
---
 guix/build-system/asdf.scm       | 14 ++++++++++++-
 guix/build/asdf-build-system.scm | 44 ++++++++++++++++------------------------
 guix/build/lisp-utils.scm        |  4 ----
 3 files changed, 30 insertions(+), 32 deletions(-)

diff --git a/guix/build-system/asdf.scm b/guix/build-system/asdf.scm
index 4afc6ef1a..ab571c9b4 100644
--- a/guix/build-system/asdf.scm
+++ b/guix/build-system/asdf.scm
@@ -22,6 +22,9 @@
   #:use-module (guix packages)
   #:use-module (guix derivations)
   #:use-module (guix search-paths)
+  #:use-module ((guix build utils)
+                #:select ((package-name->name+version
+                           . hyphen-separated-name->name+version)))
   #:use-module (guix build-system)
   #:use-module (guix build-system gnu)
   #:use-module (ice-9 match)
@@ -196,7 +199,7 @@ set up using CL source package conventions."
        (define base-arguments
          (if target-is-source?
              (strip-keyword-arguments
-              '(#:tests? #:asd-file #:lisp)
+              '(#:tests? #:asd-file #:lisp #:asd-system-name)
               (package-arguments pkg))
              (package-arguments pkg)))
 
@@ -262,6 +265,7 @@ set up using CL source package conventions."
                   #:key source outputs
                   (tests? #t)
                   (asd-file #f)
+                  (asd-system-name #f)
                   (phases '(@ (guix build asdf-build-system)
                               %standard-phases))
                   (search-paths '())
@@ -270,6 +274,13 @@ set up using CL source package conventions."
                   (imported-modules %asdf-build-system-modules)
                   (modules %asdf-build-modules))
 
+    (define system-name
+      (or asd-system-name
+          (string-drop
+           ;; NAME is the value returned from `package-full-name'.
+           (hyphen-separated-name->name+version name)
+           (1+ (string-length lisp-type))))) ; drop the "<lisp>-" prefixa
+
     (define builder
       `(begin
          (use-modules ,@modules)
@@ -284,6 +295,7 @@ set up using CL source package conventions."
                                    ((source) source)
                                    (source source))
                        #:asd-file ,asd-file
+                       #:asd-system-name ,system-name
                        #:system ,system
                        #:tests? ,tests?
                        #:phases ,phases
diff --git a/guix/build/asdf-build-system.scm b/guix/build/asdf-build-system.scm
index 4305a86af..0fe01bd6b 100644
--- a/guix/build/asdf-build-system.scm
+++ b/guix/build/asdf-build-system.scm
@@ -49,13 +49,6 @@
 (define %system-install-prefix
   (string-append %source-install-prefix "/systems"))
 
-(define (output-path->package-name path)
-  (package-name->name+version (strip-store-file-name path)))
-
-(define (outputs->name outputs)
-  (output-path->package-name
-   (assoc-ref outputs "out")))
-
 (define (lisp-source-directory output name)
   (string-append output (%lisp-source-install-prefix) "/" name))
 
@@ -99,33 +92,31 @@ valid."
      (find-files target "\\.asd$"))
     #t))
 
-(define* (install #:key outputs #:allow-other-keys)
+(define* (install #:key outputs asd-system-name #:allow-other-keys)
   "Copy and symlink all the source files."
-  (copy-files-to-output (assoc-ref outputs "out") (outputs->name outputs)))
+  (copy-files-to-output (assoc-ref outputs "out") asd-system-name))
 
-(define* (copy-source #:key outputs #:allow-other-keys)
+(define* (copy-source #:key outputs asd-system-name #:allow-other-keys)
   "Copy the source to the library output."
   (let* ((out (library-output outputs))
-         (name (remove-lisp-from-name (output-path->package-name out)))
          (install-path (string-append out %source-install-prefix)))
-    (copy-files-to-output out name)
+    (copy-files-to-output out asd-system-name)
     ;; Hide the files from asdf
     (with-directory-excursion install-path
       (rename-file "source" (string-append (%lisp-type) "-source"))
       (delete-file-recursively "systems")))
   #t)
 
-(define* (build #:key outputs inputs asd-file
+(define* (build #:key outputs inputs asd-file asd-system-name
                 #:allow-other-keys)
   "Compile the system."
   (let* ((out (library-output outputs))
-         (name (remove-lisp-from-name (output-path->package-name out)))
-         (source-path (lisp-source-directory out name))
+         (source-path (lisp-source-directory out asd-system-name))
          (translations (wrap-output-translations
                         `(,(output-translation source-path
                                                out))))
          (asd-file (and=> asd-file
-                          (cut source-asd-file out name <>))))
+                          (cut source-asd-file out asd-system-name <>))))
 
     (setenv "ASDF_OUTPUT_TRANSLATIONS"
             (replace-escaped-macros (format #f "~S" translations)))
@@ -137,7 +128,7 @@ valid."
 
     (setenv "HOME" out) ; ecl's asdf sometimes wants to create $HOME/.cache
 
-    (compile-system name asd-file)
+    (compile-system asd-system-name asd-file)
 
     ;; As above, ecl will sometimes create this even though it doesn't use it
 
@@ -146,32 +137,31 @@ valid."
         (delete-file-recursively cache-directory))))
   #t)
 
-(define* (check #:key tests? outputs inputs asd-file
+(define* (check #:key tests? outputs inputs asd-file asd-system-name
                 #:allow-other-keys)
   "Test the system."
-  (let* ((name (remove-lisp-from-name (outputs->name outputs)))
-         (out (library-output outputs))
+  (let* ((out (library-output outputs))
          (asd-file (and=> asd-file
-                          (cut source-asd-file out name <>))))
+                          (cut source-asd-file out asd-system-name <>))))
     (if tests?
-        (test-system name asd-file)
+        (test-system asd-system-name asd-file)
         (format #t "test suite not run~%")))
   #t)
 
 (define* (create-asd-file #:key outputs
                           inputs
                           asd-file
+                          asd-system-name
                           #:allow-other-keys)
   "Create a system definition file for the built system."
   (let*-values (((out) (library-output outputs))
-                ((full-name version) (package-name->name+version
-                                      (strip-store-file-name out)))
-                ((name) (remove-lisp-from-name full-name))
+                ((_ version) (package-name->name+version
+                              (strip-store-file-name out)))
                 ((new-asd-file) (string-append (library-directory out)
-                                               "/" name ".asd")))
+                                               "/" asd-system-name ".asd")))
 
     (make-asd-file new-asd-file
-                   #:system name
+                   #:system asd-system-name
                    #:version version
                    #:inputs inputs
                    #:system-asd-file asd-file))
diff --git a/guix/build/lisp-utils.scm b/guix/build/lisp-utils.scm
index 148357bf0..2d730570a 100644
--- a/guix/build/lisp-utils.scm
+++ b/guix/build/lisp-utils.scm
@@ -36,7 +36,6 @@
             generate-executable-for-system
             %bundle-install-prefix
             bundle-asd-file
-            remove-lisp-from-name
             wrap-output-translations
             prepend-to-source-registry
             build-program
@@ -66,9 +65,6 @@
 (define (%bundle-install-prefix)
   (string-append %source-install-prefix "/" (%lisp-type) "-bundle-systems"))
 
-(define (remove-lisp-from-name name lisp)
-  (string-drop name (1+ (string-length lisp))))
-
 (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."
-- 
2.11.1

  parent reply	other threads:[~2017-04-03 13:03 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03  4:37 bug#26346: [PATCH] asdf-build-system improvements Andy Patterson
2017-04-03 13:01 ` bug#26346: [PATCH 01/17] gnu: cl-slynk: Clarify the description Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 02/17] gnu: cl-slynk: Explain some naming choices Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 03/17] build-system/asdf: Rename %install-prefix to %source-install-prefix Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 04/17] build-system/asdf: Make it possible to use "lib" as the build output Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 05/17] gnu: cl-stumpwm: Build the library in "lib" and the program in "bin" Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 06/17] build-system/asdf: Use asdf to determine dependencies Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 07/17] build-system/asdf: Don't rename inputs Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 08/17] build-system/asdf: Keep ecl's generated archive files Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 09/17] build-system/asdf: Make #:lisp a package argument Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 10/17] build-system/asdf: Parameterize the lisp type and implementation globally Andy Patterson
2017-04-03 13:01   ` Andy Patterson [this message]
2017-04-09  3:48     ` bug#26346: [PATCH v2 11/20] build-system/asdf: Pass the system name as an argument to the builder Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 12/17] build-system/asdf: Always pre-load the system's definition file Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 13/17] build-system/asdf: Handle unusually-named systems Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 14/17] gnu: Add cl-unicode Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 15/17] build-system/asdf: Simplify the use of lisp-eval-program Andy Patterson
2017-04-03 13:01   ` bug#26346: [PATCH 16/17] build-system/asdf: Retain references to source files for binary outputs Andy Patterson
2017-05-16  7:02     ` Ricardo Wurmus
2017-04-03 13:01   ` bug#26346: [PATCH 17/17] gnu: sbcl-slynk-boot0: Give the package an appropriate name Andy Patterson
2017-04-09  3:50     ` bug#26346: [PATCH v2 17/20] " Andy Patterson
2017-04-09  3:43 ` bug#26346: [PATCH 18/20] build-system/asdf: Handle tests defined in external systems Andy Patterson
2017-04-09  3:43   ` bug#26346: [PATCH 19/20] build-system/asdf: Handle versioned asdf dependencies Andy Patterson
2017-05-16  8:17     ` Ricardo Wurmus
2017-05-22  2:35       ` Andy Patterson
2017-04-09  3:43   ` bug#26346: [PATCH 20/20] doc: Update the documentation for the asdf build systems Andy Patterson
2017-04-09  3:58 ` bug#26346: [PATCH] asdf-build-system improvements Andy Patterson
2017-05-16 13:19 ` Ricardo Wurmus
2017-05-17 13:11   ` 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=20170403130134.18881-11-ajpatter@uwaterloo.ca \
    --to=ajpatter@uwaterloo.ca \
    --cc=26346@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.