From patchwork Tue Oct 24 14:07:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 55289 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 4144727BBE9; Tue, 24 Oct 2023 15:10:06 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C76AA27BBE2 for ; Tue, 24 Oct 2023 15:10:03 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvI6D-0000v8-2a; Tue, 24 Oct 2023 10:09:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvI68-0000uW-OC for guix-patches@gnu.org; Tue, 24 Oct 2023 10:09:32 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvI68-0004xc-G7 for guix-patches@gnu.org; Tue, 24 Oct 2023 10:09:32 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qvI6b-0007CO-Qb; Tue, 24 Oct 2023 10:10:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66728] [PATCH] gnu: rust-analyzer: Replace with version from rust. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, guix-patches@gnu.org Resent-Date: Tue, 24 Oct 2023 14:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66728 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66728@debbugs.gnu.org Cc: 873216071@qq.com, Efraim Flashner , Distopico , Efraim Flashner X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Efraim Flashner Received: via spool by submit@debbugs.gnu.org id=B.169815658027637 (code B ref -1); Tue, 24 Oct 2023 14:10:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Oct 2023 14:09:40 +0000 Received: from localhost ([127.0.0.1]:56054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvI6G-0007Bg-0f for submit@debbugs.gnu.org; Tue, 24 Oct 2023 10:09:40 -0400 Received: from lists.gnu.org ([2001:470:142::17]:58138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qvI6C-0007BR-6Q for submit@debbugs.gnu.org; Tue, 24 Oct 2023 10:09:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvI5b-0000oe-9I for guix-patches@gnu.org; Tue, 24 Oct 2023 10:08:59 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qvI5Y-0004sf-Jt for guix-patches@gnu.org; Tue, 24 Oct 2023 10:08:58 -0400 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5079f9675c6so7138928e87.2 for ; Tue, 24 Oct 2023 07:08:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698156535; x=1698761335; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=WDCOFS2tpi35bDcxZEeriQxs1vcrsBxSIWU9IcMx5ic=; b=XO5tFxOfoAVL6XFlmDphKf66PG9v/jKRNMDBfitfQNA2hcb0zENWi9nokK5WbBrMz2 3JTgnFyCrVWrTzazaaqVskzha9AQyVcUv6dWej78DpM4NETV+FzJj6TEwbDGscbpuZgU 8pS2HksIjae1QG+WhTTJH7BM+cEdTtD24xGlyXN1WeD4nlekQMgg6mqz30sQ5tSnGzFO LNjbhfdsin/azelRNLpSno7Y+YPJ0uF68ZQziOJRUYOO36iw/45YZR7M2oeSdUf1YIdj HBqgCkBS82uuVt/3er0l87OqmDfu5pBZcpUn1yTRF6JgHXKxhzAoXUugQ53d7b8j94Lx ZEdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698156535; x=1698761335; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WDCOFS2tpi35bDcxZEeriQxs1vcrsBxSIWU9IcMx5ic=; b=ewWk8XFWE7sD2rCfT84WqID5mVqMUfAfpYGXJoolOBijOnxdu3dXw473pXpGsPhB/w zAS1OUskvCyRfS57tYi8871esoX3/MPqOcPiu5NOUI//51KrSKHHd0Vl/nnCe36Izy1H dP/jzbCBV70nihbdZFvFUEg5od18s9VmH0Izn1/EOZ2QMwp7wP3EBP5rqRJIy3solqlR qf9Q8EBdqCRZzNX7+ZCuZn84aI8+z60hjFlsC08wYiLmeV4hrhxI+Dd1G1P2DrqJfW/q a9F9onv8sYWbAaPFSF3423HUgn9sph7rBmDXTsAXEhtclkdsb/+HnqmfedgxLazFwH7B llDg== X-Gm-Message-State: AOJu0YyHxr+PDdvosHoB+Sw5pm8DJU7re6w2RUOpUHoNl+Rqg08wTnkN xWNsX2K8aU2zPuC/NFs3KpkUhcB7NA0j0w== X-Google-Smtp-Source: AGHT+IHk06fZx5HR9l1Fun8Oob2SNNOBVASzurYbmKzWBjnpc9vKcx4bA6x0PstAMu8h6anPu1n+eA== X-Received: by 2002:a05:6512:3132:b0:500:d960:8b6d with SMTP id p18-20020a056512313200b00500d9608b6dmr8914176lfd.33.1698156534298; Tue, 24 Oct 2023 07:08:54 -0700 (PDT) Received: from localhost ([31.210.180.106]) by smtp.gmail.com with ESMTPSA id i21-20020a05600c355500b00405bbfd5d16sm12287134wmq.7.2023.10.24.07.08.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 07:08:53 -0700 (PDT) From: Efraim Flashner Date: Tue, 24 Oct 2023 17:07:13 +0300 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=efraim.flashner@gmail.com; helo=mail-lf1-x12a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * gnu/packages/rust-apps.scm (rust-analyzer): Rewrite package to contain the rust-analyzer from the rust package. Change-Id: I36a15e444fda76f044323f97ebce08f562063d4b --- There is a version of rust-analyzer which comes with rust itself, now installed in the "tools" output of rust. I would like to replace the separate rust-analyzer package with the one built from the rust sources and wanted your opinions since you're the ones who have contributed to the package and are most likely to have to have used it. gnu/packages/rust-apps.scm | 184 ++++--------------------------------- 1 file changed, 17 insertions(+), 167 deletions(-) base-commit: a3946d5c1d6539546d0ad6502928bd58a8b0e8ea diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm index 3ecaa049ee..1a39006cd7 100644 --- a/gnu/packages/rust-apps.scm +++ b/gnu/packages/rust-apps.scm @@ -44,6 +44,7 @@ (define-module (gnu packages rust-apps) #:use-module (guix build-system cargo) #:use-module (guix build-system pyproject) + #:use-module (guix build-system trivial) #:use-module (guix deprecation) #:use-module (guix download) #:use-module (guix gexp) @@ -1940,174 +1941,23 @@ (define-public rbw (define-public rust-analyzer (package (name "rust-analyzer") - (version "2022-01-10") - (source - (origin - ;; The crate at "crates.io" is empty. - (method git-fetch) - (uri (git-reference - (url "https://github.com/rust-analyzer/rust-analyzer") - (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1ci85bp8xwqrk8nqr8sh6yj8njgd98nhgnhaks2g00c77wwyra41")))) - (build-system cargo-build-system) + (version (package-version rust)) + (source #f) + (build-system trivial-build-system) (arguments - `(#:rust ,rust-1.64 - #:install-source? #f ; virtual manifest - #:cargo-test-flags - '("--release" "--lib" "--tests" "--" - "--skip=tests::test_version_check" ;it need rustc's version - ;; FIXME: Guix's rust does not install source in - ;; %out/lib/rustlib/src/rust so "can't load standard library from - ;; sysroot" - "--skip=tests::test_loading_rust_analyzer" - ;; Failed to run rustfmt from toolchain 'stable'. Please run `rustup - ;; component add rustfmt --toolchain stable` to install it - "--skip=tests::sourcegen::sourcegen_assists_docs" ;need rustfmt - "--skip=tests::sourcegen_ast::sourcegen_ast" ;same - - "--skip=tidy::check_licenses" ;it runs cargo metadata - "--skip=tidy::check_merge_commits" ;it runs git rev-list - "--skip=tidy::check_code_formatting" ;need rustfmt as cargo fmt - - ;; These tests require rust <= 1.60 and too many packages - ;; has as dependency rust-serde-json-1 that use indexmap2 - ;; and it need rust >= 1.64 - "--skip=tests::list_test_macros" - "--skip=tests::test_derive_empty" - "--skip=tests::test_attr_macro" - "--skip=tests::test_fn_like_macro" - "--skip=tests::test_fn_like_macro2" - "--skip=tests::test_derive_error") - #:cargo-development-inputs - (("rust-arbitrary" ,rust-arbitrary-1) - ("rust-derive-arbitrary" ,rust-derive-arbitrary-1) - ("rust-expect-test" ,rust-expect-test-1) - ("rust-oorandom" ,rust-oorandom-11) - ("rust-quote" ,rust-quote-1.0.10) - ("rust-rayon" ,rust-rayon-1) - ("rust-tracing" ,rust-tracing-0.1) - ("rust-tracing-subscriber" ,rust-tracing-subscriber-0.3) - ("rust-tracing-tree" ,rust-tracing-tree-0.2) - ("rust-ungrammar" ,rust-ungrammar-1)) - #:cargo-inputs - (("rust-always-assert" ,rust-always-assert-0.1) - ("rust-anyhow" ,rust-anyhow-1) - ("rust-anymap" ,rust-anymap-0.12) - ("rust-arrayvec" ,rust-arrayvec-0.7) - ("rust-cargo-metadata" ,rust-cargo-metadata-0.14) - ("rust-cfg-if" ,rust-cfg-if-1) - ("rust-chalk-ir" ,rust-chalk-ir-0.75) - ("rust-chalk-recursive" ,rust-chalk-recursive-0.75) - ("rust-chalk-solve" ,rust-chalk-solve-0.75) - ("rust-countme" ,rust-countme-3) - ("rust-cov-mark" ,rust-cov-mark-2) - ("rust-crossbeam-channel" ,rust-crossbeam-channel-0.5) - ("rust-dissimilar" ,rust-dissimilar-1) - ("rust-dot" ,rust-dot-0.1) - ("rust-drop-bomb" ,rust-drop-bomb-0.1) - ("rust-either" ,rust-either-1.6.0) - ("rust-ena" ,rust-ena-0.14) - ("rust-env-logger" ,rust-env-logger-0.8) - ("rust-flate2" ,rust-flate2-1) - ("rust-fst" ,rust-fst-0.4) - ("rust-home" ,rust-home-0.5) - ("rust-indexmap" ,rust-indexmap-1.7) - ("rust-itertools" ,rust-itertools-0.10) - ("rust-jod-thread" ,rust-jod-thread-0.1) - ("rust-libc" ,rust-libc-0.2) - ("rust-libloading" ,rust-libloading-0.7) - ("rust-log" ,rust-log-0.4) - ("rust-lsp-server" ,rust-lsp-server-0.5) - ("rust-lsp-types" ,rust-lsp-types-0.91) - ("rust-memmap2" ,rust-memmap2-0.5) - ("rust-mimalloc" ,rust-mimalloc-0.1) - ("rust-miow" ,rust-miow-0.4) - ("rust-notify" ,rust-notify-5-pre.13) - ("rust-object" ,rust-object-0.28) - ("rust-once-cell" ,rust-once-cell-1) - ("rust-parking-lot" ,rust-parking-lot-0.11) - ("rust-perf-event" ,rust-perf-event-0.4) - ("rust-proc-macro2" ,rust-proc-macro2-1.0.34) - ("rust-pulldown-cmark" ,rust-pulldown-cmark-0.8) - ("rust-pulldown-cmark-to-cmark" ,rust-pulldown-cmark-to-cmark-7) - ("rust-rowan" ,rust-rowan-0.15) - ("rust-rustc-ap-rustc-lexer" ,rust-rustc-ap-rustc-lexer-725) - ("rust-rustc-hash" ,rust-rustc-hash-1) - ("rust-salsa" ,rust-salsa-0.17) - ("rust-scoped-tls" ,rust-scoped-tls-1) - ("rust-serde" ,rust-serde-1) - ("rust-serde-json" ,rust-serde-json-1.0.73) - ("rust-serde-path-to-error" ,rust-serde-path-to-error-0.1) - ("rust-typed-arena" ,rust-typed-arena-2) - ("rust-smallvec" ,rust-smallvec-1) - ("rust-smol-str" ,rust-smol-str-0.1) - ("rust-snap" ,rust-snap-1) - ("rust-text-size" ,rust-text-size-1) - ("rust-threadpool" ,rust-threadpool-1) - ("rust-tikv-jemalloc-ctl" ,rust-tikv-jemalloc-ctl-0.4) - ("rust-tikv-jemallocator" ,rust-tikv-jemallocator-0.4) - ("rust-url" ,rust-url-2) - ("rust-walkdir" ,rust-walkdir-2) - ("rust-winapi" ,rust-winapi-0.3) - ("rust-write-json" ,rust-write-json-0.1) - ("rust-xflags" ,rust-xflags-0.2) - ("rust-xshell" ,rust-xshell-0.1)) - #:phases - (modify-phases %standard-phases - (add-before 'check 'fix-tests - (lambda _ - (let ((bash (string-append "#!" (which "bash")))) - (with-directory-excursion "crates/parser/test_data/lexer/ok" - (substitute* "single_line_comments.txt" - (("SHEBANG 19") - (string-append "SHEBANG " - (number->string (string-length bash)))) - (("#!/usr/bin/env bash") bash)))))) - (add-before 'install 'install-doc - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (doc (string-append out "/share/doc/rust-analyzer-" - ,version))) - (copy-recursively "docs" doc)))) - (add-before 'install 'chdir - (lambda _ - (chdir "crates/rust-analyzer"))) - (add-after 'install 'wrap-program - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (bin (string-append out "/bin")) - (rust-src-path (search-input-directory - inputs "/lib/rustlib/src/rust/library"))) - ;; if environment variable RUST_SRC_PATH is not set, set it, - ;; make rust-analyzer work out of box. - (with-directory-excursion bin - (let* ((prog "rust-analyzer") - (wrapped-file (string-append (dirname prog) - "/." (basename prog) "-real")) - (prog-tmp (string-append wrapped-file "-tmp"))) - (link prog wrapped-file) - (call-with-output-file prog-tmp - (lambda (port) - (format port "#!~a -if test -z \"${RUST_SRC_PATH}\";then export RUST_SRC_PATH=~S;fi; -exec -a \"$0\" \"~a\" \"$@\"" - (which "bash") - rust-src-path - (canonicalize-path wrapped-file)))) - (chmod prog-tmp #o755) - (rename-file prog-tmp prog)))))) - (replace 'install-license-files - (lambda* (#:key outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (doc (string-append out "/share/doc/rust-analyzer-" - ,version))) - (chdir "../..") - (install-file "LICENSE-MIT" doc) - (install-file "LICENSE-APACHE" doc))))))) - (native-inputs (list rust-src-1.64)) + (list + #:modules '((guix build utils)) + #:builder + #~(begin + (use-modules (guix build utils)) + (let ((rust (assoc-ref %build-inputs "rust")) + (out (assoc-ref %outputs "out"))) + (install-file (string-append rust "/bin/rust-analyzer") + (string-append out "/bin")) + (copy-recursively (string-append rust "/share") + (string-append out "/share")))))) + (inputs + (list (list rust "tools"))) (home-page "https://rust-analyzer.github.io/") (synopsis "Experimental Rust compiler front-end for IDEs") (description "Rust-analyzer is a modular compiler frontend for the Rust