GNU bug report logs - #41135
[PATCH 1/3] build: asdf-build-system: Use SBCL source in CL packages.

Previous Next

Package: guix-patches;

Reported by: Pierre Neidhardt <mail <at> ambrevar.xyz>

Date: Fri, 8 May 2020 06:49:02 UTC

Severity: normal

Tags: patch

Done: Pierre Neidhardt <mail <at> ambrevar.xyz>

Bug is archived. No further changes may be made.

Full log


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

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: guix-patches <at> gnu.org
Subject: [PATCH 1/3] build: asdf-build-system: Use SBCL source in CL packages.
Date: Fri,  8 May 2020 08:48:27 +0200
* guix/build/asdf-build-system.scm (copy-files-to-output): Don't attempt to
  reset timestamps on files without write access.
  (install): When parent SBCL package is in the inputs, use its source.  This
  way we get possibly patched sources in CL packages as well (e.g. for FFI).
  This is also useful for sources that generate files on load-op, like cl-unicode.

* guix/build-system/asdf.scm (package-with-build-system): Forward the SBCL
  parent as a native input so that it can be used in the install phase above.
---
 guix/build-system/asdf.scm       |  5 ++++-
 guix/build/asdf-build-system.scm | 34 ++++++++++++++++++++++++++------
 2 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/guix/build-system/asdf.scm b/guix/build-system/asdf.scm
index f794bf006b..630b99e2bf 100644
--- a/guix/build-system/asdf.scm
+++ b/guix/build-system/asdf.scm
@@ -230,7 +230,10 @@ set up using CL source package conventions."
              ((#:phases phases) (list phases-transformer phases))))
           (inputs (new-inputs package-inputs))
           (propagated-inputs (new-propagated-inputs))
-          (native-inputs (new-inputs package-native-inputs))
+          (native-inputs (append (if target-is-source?
+                                     (list (list (package-name pkg) pkg))
+                                     '())
+                                 (new-inputs package-native-inputs)))
           (outputs (if target-is-source?
                        '("out")
                        (package-outputs pkg)))))
diff --git a/guix/build/asdf-build-system.scm b/guix/build/asdf-build-system.scm
index f3f4b49bcf..5a512d5332 100644
--- a/guix/build/asdf-build-system.scm
+++ b/guix/build/asdf-build-system.scm
@@ -85,7 +85,8 @@ valid."
     ;; files before compiling.
     (for-each (lambda (file)
                 (let ((s (lstat file)))
-                  (unless (eq? (stat:type s) 'symlink)
+                  (unless (or (eq? (stat:type s) 'symlink)
+                              (not (access? file W_OK)))
                     (utime file 0 0 0 0))))
               (find-files source #:directories? #t))
     (copy-recursively source target #:keep-mtime? #t)
@@ -97,12 +98,33 @@ valid."
      (find-files target "\\.asd$"))
     #t))
 
-(define* (install #:key outputs #:allow-other-keys)
-  "Copy and symlink all the source files."
+(define* (install #:key inputs outputs #:allow-other-keys)
+  "Copy and symlink all the source files.
+The source files are taken from the corresponding SBCL package if it's present
+in the native-inputs."
   (define output (assoc-ref outputs "out"))
-  (copy-files-to-output output
-                        (package-name->name+version
-                         (strip-store-file-name output))))
+  (define package-name
+    (package-name->name+version
+     (strip-store-file-name output)))
+  (define no-prefix-name (string-drop package-name (string-length "cl-")))
+  (define sbcl-source (or (assoc-ref inputs (string-append "sbcl-" no-prefix-name))
+                          (assoc-ref inputs (string-append "sbcl-" package-name))))
+
+  (define source-directory
+    (if sbcl-source
+        (find file-exists?
+              (list (string-append sbcl-source
+                                   "/share/common-lisp/sbcl-source/"
+                                   no-prefix-name)
+                    (string-append sbcl-source
+                                   "/share/common-lisp/sbcl-source/"
+                                   package-name)
+                    "."))
+        "."))
+  (with-directory-excursion source-directory
+    (copy-files-to-output output
+                          (package-name->name+version
+                           (strip-store-file-name output)))))
 
 (define* (copy-source #:key outputs asd-system-name #:allow-other-keys)
   "Copy the source to the library output."
-- 
2.25.1





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

Previous Next


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