From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GB1UOj5JE2DMZwAA0tVLHw (envelope-from ) for ; Thu, 28 Jan 2021 23:31:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id gF4ENj5JE2AQUQAAbx9fmQ (envelope-from ) for ; Thu, 28 Jan 2021 23:31:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6160A94042F for ; Thu, 28 Jan 2021 23:31:10 +0000 (UTC) Received: from localhost ([::1]:40264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Gkn-0007lz-3I for larch@yhetil.org; Thu, 28 Jan 2021 18:31:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5Gkg-0007lq-8f for guix-patches@gnu.org; Thu, 28 Jan 2021 18:31:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5Gkg-0007le-1V for guix-patches@gnu.org; Thu, 28 Jan 2021 18:31:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l5Gkf-0001mf-To for guix-patches@gnu.org; Thu, 28 Jan 2021 18:31:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46162] [PATCH] staging gnu: Add more tools to rust outputs. Resent-From: John Soo Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 28 Jan 2021 23:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46162 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 46162@debbugs.gnu.org Received: via spool by 46162-submit@debbugs.gnu.org id=B46162.16118766136797 (code B ref 46162); Thu, 28 Jan 2021 23:31:01 +0000 Received: (at 46162) by debbugs.gnu.org; 28 Jan 2021 23:30:13 +0000 Received: from localhost ([127.0.0.1]:50591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5Gjo-0001lS-Hg for submit@debbugs.gnu.org; Thu, 28 Jan 2021 18:30:13 -0500 Received: from mail-pj1-f54.google.com ([209.85.216.54]:35051) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l5Gjj-0001jR-8C for 46162@debbugs.gnu.org; Thu, 28 Jan 2021 18:30:06 -0500 Received: by mail-pj1-f54.google.com with SMTP id e9so5315721pjj.0 for <46162@debbugs.gnu.org>; Thu, 28 Jan 2021 15:30:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=asu-edu.20150623.gappssmtp.com; s=20150623; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=0rt6tFJHQ08vwyy/lqiMpm8Uxpvp+h71XJk76lDTM8I=; b=aSG3wTpX9aBzHfmbt7ANNgcd2ypF1nSTuZoOBatlYqnL8ZvqIG2zVXNU1xQ+P6xDWH 84dv7qHyJWDCZx4y4xmcrmN2beu9IgM5fNrY1ovD5cGa9i1ZcZX6AX3ZQQhqbkvai91n dgSnj+QC78H2yl0DGVaFCT5kbR6U2hTN+qzQIe1eGV+Y7TUz9u5GARxumGYX1NTooEy+ lZwGFq6iBuaEOlWriLlQo+jVaRE3MUgdWSRaT3RKIEIYtlXP+sQc+sTiMth8zIRYnGZa Jem4WWygG+clJFvHwZXfReMOG6PsbmNwBkQ94F7CpRM/JBf+qyP/RDxhaoqc9/lkIMjj JHYg== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=0rt6tFJHQ08vwyy/lqiMpm8Uxpvp+h71XJk76lDTM8I=; b=d4zjyBJs0reqxaQ0u5PG5NfATs1QUxhQ+Jo61sTJ7Y20VAbPxW8s6F730zh9NV6T5l dXIqzdajKIuHDIDoXGDEaGBAoUMZgHMJ3GNl7IcKazYLnBSSybFI6lHK3IeoJCUJY6NX D9iYVtInIzfl22mU3SNtaIQxCz4ww87NxipG7xLN07146zfvqH2kFYvalfLt+YUHFN1o PgC5Pe0DZYD9eeDLf6aRwPMOg8qg6yMSiNFPF62KFLqJAXbV9HDxkUYm3nJ0yLgKrCvq lTwzT3Xa/pRxPP5udJWlZMs58702hmrlGGi0TKFrDQ1Gxug+V/n6Xu0JOGt3JXe9YGUX /iwg== X-Gm-Message-State: AOAM533Bak4EuRYNO3gOguIss6R4DtmJHuIjMVHYVRjq8ZR45jXPM0e6 bd7FDjvtBJ1bsorf8d0lqMHzaUsHbkZJlA== X-Google-Smtp-Source: ABdhPJzm/0/WAJftAzWa9s3P1EZ9XDL2rd3MzLqCJyRSXwIXtdne6gAZvA5CK0DDmAVzTPdbPeHKyw== X-Received: by 2002:a17:90a:5993:: with SMTP id l19mr1590551pji.203.1611876596965; Thu, 28 Jan 2021 15:29:56 -0800 (PST) Received: from ecenter ([2600:1700:83b0:8bd0::7a8]) by smtp.gmail.com with ESMTPSA id 6sm6520838pfo.139.2021.01.28.15.29.55 for <46162@debbugs.gnu.org> (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Jan 2021 15:29:56 -0800 (PST) From: John Soo References: <87eei4k9hn.fsf@asu.edu> Date: Thu, 28 Jan 2021 15:29:54 -0800 In-Reply-To: <87eei4k9hn.fsf@asu.edu> (John Soo's message of "Thu, 28 Jan 2021 14:00:20 -0800") Message-ID: <875z3gk5cd.fsf@asu.edu> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.35 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=asu-edu.20150623.gappssmtp.com header.s=20150623 header.b=aSG3wTpX; dmarc=fail reason="SPF not aligned (relaxed)" header.from=asu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 6160A94042F X-Spam-Score: -3.35 X-Migadu-Scanner: scn1.migadu.com X-TUID: glc6cY19PIZ7 --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Here is an edited patch. I had rebased incorrectly, my apologies. - 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=20cd3bddf4785f9efac275424c5c735092600f45c5 Mon Sep 17 00:00:00 2001 From: John Soo 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 | 131 +++++++++++++++++++++++++++++++----------- 1 file changed, 97 insertions(+), 34 deletions(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index e646cd0091..b59fe98546 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 ;;; Copyright =C2=A9 2020 Pierre Langlois ;;; Copyright =C2=A9 2020 Matthew Kraai +;;; Copyright =C2=A9 2021 John Soo ;;; ;;; This file is part of GNU Guix. ;;; @@ -1322,19 +1323,41 @@ 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 + `(("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 +1366,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----- iQJCBAEBCAAsFiEEWhWPr0BqdIqBqdxOT0N6drRIojsFAmATSPIOHGpzb28xQGFz dS5lZHUACgkQT0N6drRIojthdw//b0ZQ+OGlEdBbInkATFXl0e+AMw77cttcJO2y iYE95ZiK2H7HprM36x9cdTTZfXyGnOp1rqe3G/U2245U7TvaSymqlPWsSGEIZ2Ut gVSrFFOulF9DwsUuBPvCxcPHFvHLZYTQtmcp8fUkHvVYswOhwkZ9ir11bkfffpXw zjzEWeZDVhN8lv+iqvHSkX8qrOjn8YNX3vvI71urbtFuLc5K3EQH01ZIlso6v290 rLc7hGqJW+Y6dh4FmEorVDvCbr/EWo4AJkTic4odcew6PTb7XcFZi+VqQdyW6IxS d8eGghlOzi6zi+X2t4n84nZWCgdjjaG+qsj60oaMC3qTUAH87CRy/EObCHSckRcv 7CZWjyKrXH7ZTQ3p0me+HMc7lLUGWS9DiMZxYGXHColWNYDtt73hlyVE4fSkRlXk GZsDPDtaabim9hs9sBHwQhxNYWvK3Stx722bhKC8i7KKfXOaVvhNdcpJM0aBE+fD Aj4qMuN5O4PejOaWt0pR1hzrucd4THnzNTN1dzQUc1hVa1P1HRCJlNGddg/NlT7p I2SYc6aDbE+GBTo3mRibYMBdV2zhqJNw1GRBInnKdk/bFoTu/F/1WSTk9QMP1ehK wFOr8MLcG+3yiq2zl6svXVpXVjLyM0NmVvRmjiHINB4E8d3tvcTVkILk+vtAa+Z/ XtLziOY= =CwBZ -----END PGP SIGNATURE----- --==-=-=--