From patchwork Fri May 8 10:37:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Neidhardt X-Patchwork-Id: 21929 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id C68D627BBE3; Fri, 8 May 2020 11:38:15 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) by mira.cbaines.net (Postfix) with ESMTP id 89F0527BBE1 for ; Fri, 8 May 2020 11:38:15 +0100 (BST) Received: from localhost ([::1]:58972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jX0OV-0006sS-4c for patchwork@mira.cbaines.net; Fri, 08 May 2020 06:38:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49414) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jX0OJ-0006hp-Eo for guix-patches@gnu.org; Fri, 08 May 2020 06:38:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33115) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jX0OJ-0002rc-5c for guix-patches@gnu.org; Fri, 08 May 2020 06:38:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jX0OJ-0003V8-3b for guix-patches@gnu.org; Fri, 08 May 2020 06:38:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41135] [Patch v2 1/4] build: asdf-build-system: Use SBCL source in CL packages. References: <20200508064827.1270-1-mail@ambrevar.xyz> In-Reply-To: <20200508064827.1270-1-mail@ambrevar.xyz> Resent-From: Pierre Neidhardt Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 08 May 2020 10:38:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41135 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41135@debbugs.gnu.org Received: via spool by 41135-submit@debbugs.gnu.org id=B41135.158893427413423 (code B ref 41135); Fri, 08 May 2020 10:38:03 +0000 Received: (at 41135) by debbugs.gnu.org; 8 May 2020 10:37:54 +0000 Received: from localhost ([127.0.0.1]:44658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jX0O9-0003UR-LY for submit@debbugs.gnu.org; Fri, 08 May 2020 06:37:54 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:44293) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jX0Ns-0003TN-8q for 41135@debbugs.gnu.org; Fri, 08 May 2020 06:37:52 -0400 X-Originating-IP: 78.199.129.170 Received: from localhost.localdomain (moi44-1-78-199-129-170.fbx.proxad.net [78.199.129.170]) (Authenticated sender: mail@ambrevar.xyz) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 61971E0004 for <41135@debbugs.gnu.org>; Fri, 8 May 2020 10:37:28 +0000 (UTC) From: Pierre Neidhardt Date: Fri, 8 May 2020 12:37:11 +0200 Message-Id: <20200508103714.17970-1-mail@ambrevar.xyz> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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 | 40 +++++++++++++++++++++++++++----- 2 files changed, 38 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..158d351d1a 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,39 @@ 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." + ;; TODO: Use lisp-type instead of hardcoding SBCL. (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 (first-subdirectory directory) ; From gnu-build-system. + "Return the file name of the first sub-directory of DIRECTORY." + (match (scandir directory + (lambda (file) + (and (not (member file '("." ".."))) + (file-is-directory? (string-append directory "/" + file))))) + ((first . _) first))) + + (define source-directory + (if (and sbcl-source + (file-exists? + (string-append sbcl-source "/share/common-lisp/sbcl-source/"))) + (let ((source (string-append sbcl-source "/share/common-lisp/sbcl-source/"))) + (string-append source (first-subdirectory source))) + ".")) + (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."