Received: (at submit) by debbugs.gnu.org; 28 Jan 2021 22:00:46 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 28 17:00:46 2021 Received: from localhost ([127.0.0.1]:50474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1l5FLE-0005rh-NI for submit <at> debbugs.gnu.org; Thu, 28 Jan 2021 17:00:46 -0500 Received: from lists.gnu.org ([209.51.188.17]:43900) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <jsoo1@HIDDEN>) id 1l5FLA-0005rX-U7 for submit <at> debbugs.gnu.org; Thu, 28 Jan 2021 17:00:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52276) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <jsoo1@HIDDEN>) id 1l5FL7-0002KD-Oj for guix-patches@HIDDEN; Thu, 28 Jan 2021 17:00:35 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:45667) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <jsoo1@HIDDEN>) id 1l5FL0-0003XD-Bn for guix-patches@HIDDEN; Thu, 28 Jan 2021 17:00:31 -0500 Received: by mail-pf1-x434.google.com with SMTP id j12so4891694pfj.12 for <guix-patches@HIDDEN>; Thu, 28 Jan 2021 14:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=asu-edu.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version; bh=cnBJLO5DlVxpRSxyhVMDVu2l8kkjzbNZr96hoZO77ZE=; b=IaNn13peu0zQLwsnd9p73P6IbOUQjVdc0o5/5DybD76Y/QYgj15nx7lvAtOypl+Ac7 6aAxFTf/9g4OBQGFOs9IW1QIouh9BaixNESCzRVTplpsrZbyoVfnVtho7LKFxo6iaiPU tr0/b7c6Ud/CMwqb/U+WhbpWXGIkJCR94NA72bGtpIHZWrj3SqLtjQlkWn/2bJU554qn me3HVP3Iy9l2tl8rMhdbeDbnJHF//aXCdkefWQz57BPHgwx6bVGMkhfOzRC/O0m/zAdA maWT3HyBPvxRmv8FpjsB8MgFdP3MGVDWSu4+6j85M8Wmy3j2fcz3hHUbIzfMvw3rsbWz 0F4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=cnBJLO5DlVxpRSxyhVMDVu2l8kkjzbNZr96hoZO77ZE=; b=dpLU0WKpyOT07qPbtTBZ5U9MnxKAbNfn3OaRdVq09LkKam541h3ByhwAWVTCXejTjq WCcYGYT046YdkhVMl1QSKG9c0uP2Pz+aV86rBhwRCLpo82VQ6xw8aGvCKnPdSdZEityK qM0mGHclxCg1fQu7naZNtUOcXhgx4Ud6OONnHsqW+5rIwJTn8uXBWXKCHheNE6gsO72K 5OhD8dmM/rV5rPrs0p/gx6znMmKy8DbyEAlclxIOzgiw3AzDXJnKf9iaWQO3Mox54x6H Ggvt//4rpxloBy0HcP+AqFLnFf8Fktw2ULpSZ+Xw2OquvXv3D3HeX5+DZiNUV5+OwxHO 3gEw== X-Gm-Message-State: AOAM531emh1BSiiUh8bedBOSao41IsyHbwZi9g+V04GSUgkgFFICimEc XvOMmyAgk2DCFGTC+ESLb33mXbLuOrHlSg== X-Google-Smtp-Source: ABdhPJwGxahRc8utwuZ4DVU0DhDr4lnyEuyvMaVTHIZ5TMKdAZ+MI83iR6Q+L2TKCETwFhXhRQotmA== X-Received: by 2002:a62:7b8a:0:b029:1bb:4a06:bb57 with SMTP id w132-20020a627b8a0000b02901bb4a06bb57mr1237027pfc.47.1611871223335; Thu, 28 Jan 2021 14:00:23 -0800 (PST) Received: from ecenter ([2600:1700:83b0:8bd0::7a8]) by smtp.gmail.com with ESMTPSA id u12sm6179657pgi.91.2021.01.28.14.00.21 for <guix-patches@HIDDEN> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Jan 2021 14:00:22 -0800 (PST) From: John Soo <jsoo1@HIDDEN> To: guix-patches@HIDDEN Subject: [PATCH] staging gnu: Add more tools to rust outputs. Date: Thu, 28 Jan 2021 14:00:20 -0800 Message-ID: <87eei4k9hn.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=jsoo1@HIDDEN; helo=mail-pf1-x434.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hi Guix! I work with rust for my job and I would love to be able to use clippy and the other tools that are in the rustc tree. This patch installs those tools as other outputs in the same way we have cargo and rustfmt now. Thanks! All the best, John --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-gnu-Add-more-tools-to-rust-outputs.patch Content-Transfer-Encoding: quoted-printable From=202f381b5af04a2e487242b3661edf088fecb6c484 Mon Sep 17 00:00:00 2001 From: John Soo <jsoo1@HIDDEN> Date: Wed, 25 Nov 2020 06:25:43 -0800 Subject: [PATCH] gnu: Add more tools to rust outputs. The goal is to provide standard rust tools as outputs of rustc. The tools = we were missing were rls, clippy, src, and rust-analyzer. * gnu/packages/rust.scm (rust-1.46): [outputs] add rls, clippy, src, and rust-analyzer, [arguments] alter phases to build, test, and install each new output, [arguments] patch RUNPATHS of outputs that require it, [arguments] delete all uninstall scripts from outputs, [arguments] delete all the insta= ll logs and manifests. =2D-- gnu/packages/rust.scm | 133 +++++++++++++++++++++++++++++++----------- 1 file changed, 99 insertions(+), 34 deletions(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index e646cd0091..98ae770745 100644 =2D-- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -11,6 +11,7 @@ ;;; Copyright =C2=A9 2020, 2021 Jakub K=C4=85dzio=C5=82ka <kuba@kadziolka.= net> ;;; Copyright =C2=A9 2020 Pierre Langlois <pierre.langlois@HIDDEN> ;;; Copyright =C2=A9 2020 Matthew Kraai <kraai@HIDDEN> +;;; Copyright =C2=A9 2021 John Soo <jsoo1@HIDDEN> ;;; ;;; This file is part of GNU Guix. ;;; @@ -41,6 +42,7 @@ #:use-module (gnu packages jemalloc) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) + #:use-module (gnu packages node) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) #:use-module (gnu packages ssh) @@ -1322,19 +1324,42 @@ move around." "0a17jby2pd050s24cy4dfc0gzvgcl585v3vvyfilniyvjrqknsid"))) (package (inherit base-rust) =2D (outputs (cons "rustfmt" (package-outputs base-rust))) + (outputs (append '("rustfmt" "rls" "src" "clippy" "rust-analyzer") + (package-outputs base-rust))) + (inputs + `(("gcc-lib" ,gcc "lib") + ,@(package-inputs base-rust))) + (native-inputs + `(("node" ,node) + ("patchelf" ,patchelf) + ,@(package-native-inputs base-rust))) (arguments (substitute-keyword-arguments (package-arguments base-rust) ((#:phases phases) `(modify-phases ,phases + (replace 'patch-cargo-checksums + ;; Generate checksums after patching generated files (in + ;; particular, vendor/jemalloc/rep/Makefile). + (lambda* _ + (use-modules (guix build cargo-utils)) + (substitute* '("Cargo.lock" + "src/tools/rust-analyzer/Cargo.lock") + (("(checksum =3D )\".*\"" all name) + (string-append name "\"" ,%cargo-reference-hash "\""))) + (generate-all-checksums "vendor") + #t)) (replace 'build (lambda* _ (invoke "./x.py" "build") (invoke "./x.py" "build" "src/tools/cargo") =2D (invoke "./x.py" "build" "src/tools/rustfmt"))) + (invoke "./x.py" "build" "src/tools/rustfmt") + (invoke "./x.py" "build" "src/tools/clippy") + (invoke "./x.py" "build" "src/tools/rls") + (invoke "./x.py" "build" + "src/tools/rust-analyzer/crates/rust-analyzer"))) (replace 'check (lambda* _ =2D ;; Test rustfmt. + ;; Enable parallel execution. (let ((parallel-job-spec (string-append "-j" (number->string (min 4 @@ -1343,44 +1368,84 @@ move around." (invoke "./x.py" parallel-job-spec "test" "src/tools/cargo") (invoke "./x.py" parallel-job-spec "test" =2D "src/tools/rustfmt")))) + "src/tools/rustfmt") + ;; Clippy tests do not work. See + ;; https://github.com/rust-lang/rust/issues/78717 + ;; Even with --stage 1, they fail to compile + ;; (invoke "./x.py" parallel-job-spec "test" "--stage" = "1" + ;; "src/tools/clippy") + (substitute* "src/tools/rls/tests/client.rs" + (("fn client_dependency_typo_and_fix" all) + (string-append "#[ignore]\n" all))) + (invoke "./x.py" parallel-job-spec "test" + "src/tools/rls")))) (replace 'install (lambda* (#:key outputs #:allow-other-keys) (invoke "./x.py" "install") + (for-each delete-file-recursively + (find-files (assoc-ref outputs "out") + "^uninstall\\.sh$")) (substitute* "config.toml" ;; replace prefix to specific output =2D (("prefix =3D \"[^\"]*\"") =2D (string-append "prefix =3D \"" (assoc-ref outputs "c= argo") "\""))) =2D (invoke "./x.py" "install" "cargo") =2D (substitute* "config.toml" =2D ;; replace prefix to specific output =2D (("prefix =3D \"[^\"]*\"") =2D (string-append "prefix =3D \"" (assoc-ref outputs "r= ustfmt") "\""))) =2D (invoke "./x.py" "install" "rustfmt"))) + (("\\[build\\]" all) + (string-append all " +extended =3D true +tools =3D +"))) + (define (install-component component) + (substitute* "config.toml" + ;; replace prefix to specific output + (("(tools =3D).*" all tools) + (string-append tools " [\"" component "\"]\n")) + (("prefix =3D \"[^\"]*\"") + (string-append + "prefix =3D \"" (assoc-ref outputs component) "\"")= )) + (mkdir-p (assoc-ref outputs component)) + (invoke "./x.py" "install" component) + (for-each delete-file-recursively + (find-files (assoc-ref outputs component) + "uninstall\\.sh"))) + (for-each install-component + '("cargo" + "rustfmt" + "clippy" + "rls" + "src" + "rust-analyzer")) + #t)) + (add-after 'install 'patch-tools-runpaths + (lambda* (#:key outputs inputs #:allow-other-keys) + (use-modules (ice-9 popen) + (ice-9 textual-ports)) + (define (patch-path path) + (let* ((read-rpath + (string-append + "patchelf --print-rpath " path)) + (pipe (open-input-pipe read-rpath)) + (current-rpath (get-string-all pipe)) + (out (assoc-ref outputs "out")) + (libc (assoc-ref inputs "libc")) + (gcc-lib (assoc-ref inputs "gcc-lib"))) + (close-pipe pipe) + (invoke "patchelf" "--set-rpath" + (string-append current-rpath + ":" out "/lib" + ":" libc "/lib" + ":" gcc-lib "/lib") + path))) + (define (patch-component component) + (for-each patch-path + (find-files (assoc-ref outputs component) + (lambda (p s) (executable-file? p= ))))) + (for-each patch-component '("clippy" "rls")))) (replace 'delete-install-logs (lambda* (#:key outputs #:allow-other-keys) =2D (define (delete-manifest-file out-path file) =2D (delete-file (string-append out-path "/lib/rustlib/" = file))) =2D =2D (let ((out (assoc-ref outputs "out")) =2D (cargo-out (assoc-ref outputs "cargo")) =2D (rustfmt-out (assoc-ref outputs "rustfmt"))) =2D (for-each =2D (lambda (file) (delete-manifest-file out file)) =2D '("install.log" =2D "manifest-rust-docs" =2D ,(string-append "manifest-rust-std-" =2D (nix-system->gnu-triplet-for-rust= )) =2D "manifest-rustc")) =2D (for-each =2D (lambda (file) (delete-manifest-file cargo-out file= )) =2D '("install.log" =2D "manifest-cargo")) =2D (for-each =2D (lambda (file) (delete-manifest-file rustfmt-out fi= le)) =2D '("install.log" =2D "manifest-rustfmt-preview")) =2D #t)))))))))) + (define log-manifest-re + "^install\\.log$|^manifest-([a-z]|[0-9]|_|-)+(-preview)= ?$") + (define (delete-install-log output) + (for-each delete-file-recursively + (find-files output log-manifest-re))) + (for-each delete-install-log (map cdr outputs))))))))))) =20 (define-public rust-1.47 (let ((base-rust =2D-=20 2.30.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJCBAEBCAAsFiEEWhWPr0BqdIqBqdxOT0N6drRIojsFAmATM/QOHGpzb28xQGFz dS5lZHUACgkQT0N6drRIojtLBBAA0tIdWUdry9+VKn67NlIMjvxOAvN8krw9VSzd z5+APOhmtscN956V0lkBKgc1ME1nA+iE643lnmKfK+DWnr621afd52JJAMrmG4xv Ds7XOGGfANxHDRNqxqrEPZUEN1vL7eUC0z1hsl11hCOkjL6Ka56/DUIerPViOMLW AZEPBhx6eDsKPLckRFPGWZUbB/O6ejLtpmou38IeYGAMlgJVop7Uk4JGzo6h9ZHD c2bkoEofi8DgtBoYuZ4RmCSGFw1JrqIFnZtXzrqqSdjaFA/GBV5ozGRtfXLlfxZN qB4ZEvgJRnvGOWELKJVuyk9oeD4BqpYYva3Xqf3zlp3jCNHLa17ZC1EKlyt/WaOm r7EorYpJdIuc1kpAwVzz3ns/LatdmnMZX3aWyifAU6jJWDH8xl1TPAiKTo8hRil/ RhEtqfUBegV/qIn/hdidKWXEnWlEtEgU3gRl1KTrZ5+f/hy2eSj3T7RFPkdQmH3i qhyF8HFGmlejjX2IXN5/UB0bVBWVnR3PF7cjAE+D3yJdJ/PwGVetPlydsL6nFISL CVhlDsjFiNiv6Ry1evYEI9NYhl+jLTRt4eygSk9iP7zFFq0bk3aib6F2VX83gdXM fVceT5S+SiE32w7OYhn8A0+4+yywKciasJZTV1zBP86YYGb993Y0bvctKujiD33p rEOqDQA= =V2V8 -----END PGP SIGNATURE----- --==-=-=--
John Soo <jsoo1@HIDDEN>
:guix-patches@HIDDEN
.
Full text available.guix-patches@HIDDEN
:bug#46162
; Package guix-patches
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.