From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 8Ad+AnqS62FKJgAAgWs5BA (envelope-from ) for ; Sat, 22 Jan 2022 06:13:30 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id aOHUNnmS62E9KAAAG6o9tA (envelope-from ) for ; Sat, 22 Jan 2022 06:13:29 +0100 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 68C2CEC38 for ; Sat, 22 Jan 2022 06:13:29 +0100 (CET) Received: from localhost ([::1]:44562 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nB8iO-0001dL-HE for larch@yhetil.org; Sat, 22 Jan 2022 00:13:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nB8iE-0001cx-B9 for guix-patches@gnu.org; Sat, 22 Jan 2022 00:13:18 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:42625) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nB8hx-0000V7-RN for guix-patches@gnu.org; Sat, 22 Jan 2022 00:13:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nB8hx-0003CN-Mf for guix-patches@gnu.org; Sat, 22 Jan 2022 00:13:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53208] [PATCH 39/39] gnu: rust-analyzer: Make it out of box. Resent-From: Z572 <873216071@qq.com> Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Jan 2022 05:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53208 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Nicolas Goaziou Cc: 53208@debbugs.gnu.org Received: via spool by 53208-submit@debbugs.gnu.org id=B53208.164282837612281 (code B ref 53208); Sat, 22 Jan 2022 05:13:01 +0000 Received: (at 53208) by debbugs.gnu.org; 22 Jan 2022 05:12:56 +0000 Received: from localhost ([127.0.0.1]:35528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nB8hn-0003Bx-5i for submit@debbugs.gnu.org; Sat, 22 Jan 2022 00:12:56 -0500 Received: from out162-62-57-64.mail.qq.com ([162.62.57.64]:41043) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <873216071@qq.com>) id 1nB8hh-0003BY-IG for 53208@debbugs.gnu.org; Sat, 22 Jan 2022 00:12:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512; t=1642828355; bh=BHnCOZDmEH1YrolIW7nx04borUDoiouFGhUcGXPvuek=; h=References:From:To:Cc:Subject:Date:In-reply-to; b=PHArzPFcqYHnYFwuPKV1cqpfJHjGcwPf7ry7nsXhNVCFyDYJywhsr+LR7gDrjDovT 6Cx4yNeEFEZOaBRxoTBWISGA1pvEmgIcGvFMWUq7S35oUQ4UBdnmPFU1C18afmQ/rS K7gEduuhLv8weIcHW1st5IvbU+14Gvazw67req5A= Received: from asus ([39.183.1.114]) by newxmesmtplogicsvrszc10.qq.com (NewEsmtp) with SMTP id 32228611; Sat, 22 Jan 2022 13:12:34 +0800 X-QQ-mid: xmsmtpt1642828354t6okgu24r Message-ID: X-QQ-XMAILINFO: Nqlrvrrau4mSCcL8OrXiIA9RBh4oAbsCmxP/AfTHrzY4BzATixBIetZjbFQUmg Vw6bN1FYCM2Fx6O2q5uDUqzlrZIDKeiGHqaY0wQNNaIWjk9XXVtoBVix5rxNKplIsFjOyWnqob2J gjl1iS9ehuJZLv1KQLjze0++p+1diReWhBFIQygUMB2XvBlEqw9iI4u0Y4N287gzWptheh8JZT0/ 7/SIgtlfaRigFTIiReejW9KVaWqq6cStgoYfZYFK56PxLsLLVMifOoUasqILkMW6+Jdxvu+ymG78 sJ1tzIZPvKgd0GssKEwgwxiH1YYsG+c3hxMetU6RapXb/59DxpjJB3Sf6WwdsjrTWm1N/rioaGCo qe78mH5hnGlM91X0DR/BLLAnV63Ys7VrgUWCx+xAO6vSYZs2DBUDde03777DQIWQ3Ztmu6xOOnfF fYhTQs3sWldO1Qk8GfftQ5k79tor8GzcexGD0dB0mMJvrx80e1gyoLMVqpxnkC6q8Qko1n6te8Ri g+Hs37xnRkDMfU5EsvtMDzdl1fZzOV9tmONyuZ3aOoLqdgAiRLYInZ5sSPOFYJQwE3j8Y5Hj0LBH bSYlAZAcAjfYUrbG9YcFD3d/Rdsurmk5pNoZ7NUBnRqyBLjsq9I7K0reoNeu+LmuebdWh+bq0gTC WRKe55tt8X+amWXjQoBhUyZsUOKZNgszuf+9sc9v6VQX9lBg/VJlC7IGv3mly4pF3VZ1AdzjuFLU MFZV9GIcPlYJunKWxKpkQvH8cBoG8xWJr2gIwj+ZU+ZRq/4D3xbvUAm6XeurQZ82yv+Xbg7cMdSD hLj9sIK8le+AEjhcGCenv35BBSqGr4Ld8= References: <87r1928016.fsf@nicolasgoaziou.fr> User-agent: mu4e 1.6.10; emacs 29.0.50 Date: Sat, 22 Jan 2022 12:37:10 +0800 In-reply-to: <87r1928016.fsf@nicolasgoaziou.fr> Message-ID: <87ee504am6.fsf@qq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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" Reply-to: Z572 <873216071@qq.com> X-ACL-Warn: , Z572 via Guix-patches From: Z572 via Guix-patches via X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642828409; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=BHnCOZDmEH1YrolIW7nx04borUDoiouFGhUcGXPvuek=; b=RZllc+VBgfUX0XoM+F8Dr8vV5icAnkJdMFrxJUO2GmC2q6+v71t1LYeTwsyND3Sg3cZXFZ A5gZ3M2Jzae1DC9M9rcTDrBN12YwCLAapbiu3XBwj2bkgc5U1ge4ve1NL8scI0d+CPvB2/ wm9GtSaowwWxAF2os/HED0tBKNltug3Fw8fKKSXIwqlPvWHunEnrLWZnlPlcBsPNRchXD/ VDs0+9RCyMcVN9+DHF2E8LvKafqwhADrR2G+fMcRuBpe/nUyTLVN16dw2qctyNv6wePF+e Oe7ZB7zGysA1z48XNfMhOUrFT1n0xPdFHQDmO+LwSt+yInxuvaUC5B5b3JqJGA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642828409; a=rsa-sha256; cv=none; b=lhPNlmKR7UNcoicSaUKbblcfeqy7ExR0t8FaM+XK9kRWqCm/V3naEsaUgDX+Xos3Yrx9fK jW/YyGUoiMIQNm6CEn027C9UVeFb0LvPKX1cTt25kluPF1fNM1qu1pw9xKOnWGYoyvWRrf lDp1FUeB0aM1bQHycTapw53697SemSp9bQ/TNpXAQ9nV2jpCTLy35BXhxtAYNjZ86d9ejd jqbgk8ll5hU+UzZiiIqIOO+YQcb5p7trQlxSDDcZ77krfvqyTmIC9QKYqgD3QGcS+2BriE /hNL5GK3wqRvszdFc2Jk+jlJGI0LLR3srdALod/v+0J6CAFhBXp1ZkGL11POSg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=qq.com header.s=s201512 header.b=PHArzPFc; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -0.03 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=qq.com header.s=s201512 header.b=PHArzPFc; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 68C2CEC38 X-Spam-Score: -0.03 X-Migadu-Scanner: scn0.migadu.com X-TUID: qwaEFDgku3gm --=-=-= Content-Type: text/plain looks like failed to send email yesterday Nicolas Goaziou writes: > Hello, > > Z572 via Guix-patches via writes: > >> +(define-public rust-src >> + (hidden-package >> + (package >> + (inherit rust-1.57) >> + (name "rust-src") >> + (build-system copy-build-system) >> + (native-inputs '()) >> + (inputs '()) >> + (native-search-paths '()) >> + (outputs '("out")) >> + (arguments >> + `(#:install-plan >> + '(("library" "lib/rustlib/src/rust/library") >> + ("src" "lib/rustlib/src/rust/src")))) >> + (synopsis "Source code for the Rust standard library") >> + (description "This package provide source code for the Rust >> standard >> +library, only use by rust-analyzer, make rust-analyzer out of >> box.")))) > > This cannot work, because, AFAIK, you can only inherit packages from the > same module. So rust-src should be moved to rust.scm and made visible. It can work, for example: fdik-libetpan and libetpan. fdik-libetpan is in (gnu packages pep), libetpan is in (gnu packages mail), fdik-libetpan inherit from libetpan, them are in different module. > >> + (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 not get environment variable RUST_SRC_PATH, set it, >> + ;; make rust-analyzer 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)))))) > > I tried to move the rust-src in rust.scm, as explained above, but when > I do, installation of rust-analyzer fails during the `wrap-program' > phases. new patch move rust-src to rust.scm, and build rust-analyzer success. > >> (replace 'install-license-files >> (lambda* (#:key outputs #:allow-other-keys) >> (let* ((out (assoc-ref outputs "out")) >> @@ -1298,6 +1341,7 @@ (define-public rust-analyzer >> (chdir "../..") >> (install-file "LICENSE-MIT" doc) >> (install-file "LICENSE-APACHE" doc))))))) >> + (inputs (list rust-src)) > > Shouldn't it be a native-input? Fix in new patch. > > Could you have a look at those issues? Thanks! > > Regards, --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-gnu-rust-analyzer-Make-it-out-of-the-box.patch Content-Transfer-Encoding: quoted-printable >From a3ea65ba89f7f369fd6d2f8bd557dd59645ed456 Mon Sep 17 00:00:00 2001 Message-Id: From: Z572 <873216071@qq.com> Date: Fri, 21 Jan 2022 19:06:10 +0800 Subject: [PATCH] gnu: rust-analyzer: Make it out of the box. * gnu/packages/rust.scm (rust-src): New variable. * gnu/packages/rust-apps.scm (rust-analyzer): [native-inputs]: Add rust-src. [arguments]: <#:phases>: Add wrap-program phase. --- gnu/packages/rust-apps.scm | 25 +++++++++++++++++++++++++ gnu/packages/rust.scm | 20 ++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm index a31fabac36..8ffa3a9817 100644 --- a/gnu/packages/rust-apps.scm +++ b/gnu/packages/rust-apps.scm @@ -1408,6 +1408,30 @@ (define-public rust-analyzer (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 not get environment variable RUST_SRC_PATH, set it, + ;; make rust-analyzer 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=3D~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")) @@ -1416,6 +1440,7 @@ (define-public rust-analyzer (chdir "../..") (install-file "LICENSE-MIT" doc) (install-file "LICENSE-APACHE" doc))))))) + (native-inputs (list rust-src)) (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 diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 739ffb3192..5a6d4a5c30 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -13,6 +13,7 @@ ;;; Copyright =C2=A9 2020 Matthew James Kraai ;;; Copyright =C2=A9 2021 Maxim Cournoyer ;;; Copyright =C2=A9 2021 (unmatched parenthesis +;;; Copyright =C2=A9 2022 Zheng Junjie <873216071@qq.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -49,6 +50,7 @@ (define-module (gnu packages rust) #:use-module (gnu packages tls) #:use-module (gnu packages) #:use-module (guix build-system cargo) + #:use-module (guix build-system copy) #:use-module (guix build-system gnu) #:use-module (guix build-system trivial) #:use-module (guix download) @@ -787,3 +789,21 @@ (define rust-1.57 ;;; be relied upon. This is to ease maintenance and reduce the time ;;; required to build the full Rust bootstrap chain. (define-public rust rust-1.57) + +(define-public rust-src + (hidden-package + (package + (inherit rust) + (name "rust-src") + (build-system copy-build-system) + (native-inputs '()) + (inputs '()) + (native-search-paths '()) + (outputs '("out")) + (arguments + `(#:install-plan + '(("library" "lib/rustlib/src/rust/library") + ("src" "lib/rustlib/src/rust/src")))) + (synopsis "Source code for the Rust standard library") + (description "This package provide source code for the Rust standard +library, only use by rust-analyzer, make rust-analyzer out of the box.")))) --=20 2.34.0 --=-=-= Content-Type: text/plain -- over --=-=-=--