From patchwork Wed Dec 2 13:29:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew James Kraai X-Patchwork-Id: 25542 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 508AA27BBFA; Wed, 2 Dec 2020 13:31:08 +0000 (GMT) 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, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 66D5727BBF9 for ; Wed, 2 Dec 2020 13:31:07 +0000 (GMT) Received: from localhost ([::1]:47824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkSDq-0000Xa-Ee for patchwork@mira.cbaines.net; Wed, 02 Dec 2020 08:31:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkSCq-0000Vb-QL for guix-patches@gnu.org; Wed, 02 Dec 2020 08:30:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:51424) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kkSCo-00055z-7d for guix-patches@gnu.org; Wed, 02 Dec 2020 08:30:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kkSCo-0006JD-39 for guix-patches@gnu.org; Wed, 02 Dec 2020 08:30:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#42295] [PATCH] gnu: rust-1.44: Add rustfmt output. Resent-From: Matthew Kraai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 02 Dec 2020 13:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42295 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: John Soo Cc: 42295@debbugs.gnu.org Received: via spool by 42295-submit@debbugs.gnu.org id=B42295.160691577424188 (code B ref 42295); Wed, 02 Dec 2020 13:30:02 +0000 Received: (at 42295) by debbugs.gnu.org; 2 Dec 2020 13:29:34 +0000 Received: from localhost ([127.0.0.1]:34737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkSCM-0006I3-H5 for submit@debbugs.gnu.org; Wed, 02 Dec 2020 08:29:34 -0500 Received: from mail.ftbfs.org ([52.8.68.13]:62680 helo=aws.ftbfs.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkSCK-0006Hl-FW for 42295@debbugs.gnu.org; Wed, 02 Dec 2020 08:29:33 -0500 Received: from ip68-5-94-190.oc.oc.cox.net ([68.5.94.190] helo=[192.168.1.12]) by aws.ftbfs.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kkSCE-0005Fw-8I; Wed, 02 Dec 2020 13:29:26 +0000 References: <20200709123256.7690-1-kraai@ftbfs.org> <87blfltrxp.fsf@asu.edu> <5407eb2f-b499-2520-e0e5-48ca7171e6bd@ftbfs.org> <871rggt62e.fsf@asu.edu> From: Matthew Kraai Message-ID: <977d1171-d1af-5705-3852-1bee82047445@ftbfs.org> Date: Wed, 2 Dec 2020 05:29:25 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Icedove/78.5.0 MIME-Version: 1.0 In-Reply-To: <871rggt62e.fsf@asu.edu> Content-Language: en-US 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 Hi John, On 11/26/20 8:51 AM, John Soo wrote: > Matthew Kraai writes: >> According to https://github.com/rust-lang/rustfmt, rustfmt was made a >> component in 1.24.0.  Would it be better to add this support to the >> rust-1.24 package instead?  I've attached the patch I'm currently testing. > Keep it on rust@1.44. Even though guix refresh --list-dependent will > report not many dependents, changing a current rust version would > trigger many rebuilds. There would be enough rebuilds to require it to > be applied to staging. > > I've also attached a work in progress patch to add rls as an output, > too. I would love if all the "extended" tools can be included. Some > tools like clippy and the rust-src component would be very helpful. > > One other thing: > >> + (outputs '("out" "doc" "cargo" "rustfmt")) > should probably be: (cons "rustfmt" (package-outputs base-rust)) > > to be more resistant to changes to older packages. Here is an updated patch.  I modified the rust-1.46 package, used your suggestion to add rustfmt to the list of outputs, did not modify the mkdir-prefix-paths phase (which doesn't seem to be necessary), and updated the delete-install-logs phase. From 600cc3f1f4a38847aea48edb0e1e7e365bd00d8c Mon Sep 17 00:00:00 2001 From: Matthew Kraai Date: Wed, 2 Dec 2020 05:18:35 -0800 Subject: [PATCH] gnu: rust-1.46: Add rustfmt output * gnu/packages/rust.scm (rust-1.46): Add a rustfmt output. --- gnu/packages/rust.scm | 67 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 35a96b5754..749d1f031f 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2019 Ivan Petkov ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2020 Pierre Langlois +;;; Copyright © 2020 Matthew Kraai ;;; ;;; This file is part of GNU Guix. ;;; @@ -1315,8 +1316,70 @@ move around." #t))))))))) (define-public rust-1.46 - (rust-bootstrapped-package rust-1.45 "1.46.0" - "0a17jby2pd050s24cy4dfc0gzvgcl585v3vvyfilniyvjrqknsid")) + (let ((base-rust + (rust-bootstrapped-package rust-1.45 "1.46.0" + "0a17jby2pd050s24cy4dfc0gzvgcl585v3vvyfilniyvjrqknsid"))) + (package + (inherit base-rust) + (outputs (cons "rustfmt" (package-outputs base-rust))) + (arguments + (substitute-keyword-arguments (package-arguments base-rust) + ((#:phases phases) + `(modify-phases ,phases + (replace 'build + (lambda* _ + (invoke "./x.py" "build") + (invoke "./x.py" "build" "src/tools/cargo") + (invoke "./x.py" "build" "src/tools/rustfmt"))) + (replace 'check + (lambda* _ + ;; Test rustfmt. + (let ((parallel-job-spec + (string-append "-j" (number->string + (min 4 + (parallel-job-count)))))) + (invoke "./x.py" parallel-job-spec "test" "-vv") + (invoke "./x.py" parallel-job-spec "test" + "src/tools/cargo") + (invoke "./x.py" parallel-job-spec "test" + "src/tools/rustfmt")))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (invoke "./x.py" "install") + (substitute* "config.toml" + ;; replace prefix to specific output + (("prefix = \"[^\"]*\"") + (string-append "prefix = \"" (assoc-ref outputs "cargo") "\""))) + (invoke "./x.py" "install" "cargo") + (substitute* "config.toml" + ;; replace prefix to specific output + (("prefix = \"[^\"]*\"") + (string-append "prefix = \"" (assoc-ref outputs "rustfmt") "\""))) + (invoke "./x.py" "install" "rustfmt"))) + (replace 'delete-install-logs + (lambda* (#:key outputs #:allow-other-keys) + (define (delete-manifest-file out-path file) + (delete-file (string-append out-path "/lib/rustlib/" file))) + + (let ((out (assoc-ref outputs "out")) + (cargo-out (assoc-ref outputs "cargo")) + (rustfmt-out (assoc-ref outputs "rustfmt"))) + (for-each + (lambda (file) (delete-manifest-file out file)) + '("install.log" + "manifest-rust-docs" + ,(string-append "manifest-rust-std-" + (nix-system->gnu-triplet-for-rust)) + "manifest-rustc")) + (for-each + (lambda (file) (delete-manifest-file cargo-out file)) + '("install.log" + "manifest-cargo")) + (for-each + (lambda (file) (delete-manifest-file rustfmt-out file)) + '("install.log" + "manifest-rustfmt-preview")) + #t)))))))))) ;; TODO(staging): Bump this variable to the latest packaged rust. (define-public rust rust-1.45) -- 2.29.2