From patchwork Thu Nov 26 13:25:48 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: 25374 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 D0B8127BBF8; Thu, 26 Nov 2020 13:28: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 2A93927BBF9 for ; Thu, 26 Nov 2020 13:28:07 +0000 (GMT) Received: from localhost ([::1]:52472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kiHJe-00031H-3Z for patchwork@mira.cbaines.net; Thu, 26 Nov 2020 08:28:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiHHe-0001tc-Li for guix-patches@gnu.org; Thu, 26 Nov 2020 08:26:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:56855) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kiHHe-0002OY-D6 for guix-patches@gnu.org; Thu, 26 Nov 2020 08:26:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kiHHe-0000Q6-AH for guix-patches@gnu.org; Thu, 26 Nov 2020 08:26: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: Thu, 26 Nov 2020 13:26: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.16063971591604 (code B ref 42295); Thu, 26 Nov 2020 13:26:02 +0000 Received: (at 42295) by debbugs.gnu.org; 26 Nov 2020 13:25:59 +0000 Received: from localhost ([127.0.0.1]:40168 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiHHb-0000Po-7M for submit@debbugs.gnu.org; Thu, 26 Nov 2020 08:25:59 -0500 Received: from mail.ftbfs.org ([52.8.68.13]:26334 helo=aws.ftbfs.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kiHHX-0000PY-Q4 for 42295@debbugs.gnu.org; Thu, 26 Nov 2020 08:25:58 -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 1kiHHR-0007N7-Km; Thu, 26 Nov 2020 13:25:50 +0000 References: <20200709123256.7690-1-kraai@ftbfs.org> <87blfltrxp.fsf@asu.edu> From: Matthew Kraai Message-ID: <5407eb2f-b499-2520-e0e5-48ca7171e6bd@ftbfs.org> Date: Thu, 26 Nov 2020 05:25:48 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Icedove/78.4.0 MIME-Version: 1.0 In-Reply-To: <87blfltrxp.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/25/20 6:46 AM, John Soo wrote: > Hi Matthew, > > Thanks! I had packaged rustfmt-nightly but this is much better. > > Matthew Kraai writes: > >> + (replace 'check >> + (lambda* _ >> + ;; Enable parallel execution. >> + (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")))) > Nice! > >> + (outputs '("out" "doc" "cargo" "rustfmt")) > Perhaps we should make anything that can be installed as a rustup > component an output (provided the source is in the rust tree). I think > rls can be added immediately in the same fashion. Is rls deprecated in favor of rust-analyzer? > Do you want to add a copyright line? Done. > Otherwise, this looks good to me. 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. diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 05404de1d8..d7a26d2f46 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. ;;; @@ -690,6 +691,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y"))) (package (inherit base-rust) + (outputs (cons "rustfmt" (package-outputs base-rust))) (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) @@ -701,7 +703,36 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" ;; This test is known to fail on aarch64 and powerpc64le: ;; https://github.com/rust-lang/rust/issues/45410 (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine")) - #t))))))))) + #t)) + (add-after 'configure 'enable-extended-build + (lambda* _ + (substitute* "config.toml" + (("[[]build[]]") "[build]\nextended = true")) + #t)) + (replace 'build + (lambda* _ + (invoke "./x.py" "build") + (invoke "./x.py" "build" "src/tools/cargo") + (invoke "./x.py" "build" "src/tools/rustfmt"))) + (replace 'check + (lambda* _ + (invoke "./x.py" "-j1" "test" "-vv") + (invoke "./x.py" "-j1" "test" "src/tools/cargo") + (invoke "./x.py" "-j1" "test" "src/tools/rustfmt") + #t)) + (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")))))))))) ;;; Rust 1.25 release support work with llvm 6--but build with llvm 6 is ;;; not determenistic due to . @@ -764,6 +795,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" `(modify-phases ,phases ;; binaryen was replaced with LLD project from LLVM (delete 'dont-build-native) + (delete 'enable-extended-build) (replace 'check (lambda* _ ;; Enable parallel execution. @@ -773,7 +805,9 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" (parallel-job-count)))))) (invoke "./x.py" parallel-job-spec "test" "-vv") (invoke "./x.py" parallel-job-spec "test" - "src/tools/cargo")))) + "src/tools/cargo") + (invoke "./x.py" parallel-job-spec "test" + "src/tools/rustfmt")))) (replace 'remove-unsupported-tests (lambda* _ ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH. @@ -844,6 +878,7 @@ jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" ;; `prefix' directory should exist before `install' call (mkdir-p (assoc-ref outputs "out")) (mkdir-p (assoc-ref outputs "cargo")) + (mkdir-p (assoc-ref outputs "rustfmt")) #t)) (add-after 'patch-cargo-tests 'disable-thinlto-test (lambda* _