rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Tiago Lam <tiagolam@gmail.com>
Cc: "Viresh Kumar" <viresh.kumar@linaro.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	rust-for-linux@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] docs: rust: Clarify that 'rustup override' applies to build directory
Date: Thu, 14 Dec 2023 18:22:47 +0100	[thread overview]
Message-ID: <CANiq72=mvca8PXoxwzSao+QFbAHDCecSKCDtV+ffd+YgZNFaww@mail.gmail.com> (raw)
In-Reply-To: <1c03eb18-a6ac-45c8-8fea-46097bb4e132@gmail.com>

On Thu, Dec 14, 2023 at 2:26 PM Tiago Lam <tiagolam@gmail.com> wrote:
>
> `scripts/min-tool-version.sh` won't exist within the build dir if the
> option the user takes is "enter the kernel build directory", right? It
> only works if they use the `--path` argument in the `rustup override
> set` option.

Yeah, the script is in the source tree, and the path is the build
tree. Giving a single one-liner with `--path <builddir>` and
`<srctree>/scripts...` would be simplest in the sense that it would
allow us to remove even the "enter ..." part too. But then the command
cannot be copy-pasted and it is likely harder for newcomers that may
not be using `O=`.

Something like v1 but a bit simpler, e.g. keeping things as they are,
but with just a sentence after the command like "If you are building
the kernel with `O=`, i.e. specifying an output directory, then you
should append `--path <builddir>`." could work.

Or we could just provide a `rustupoverride` Make target to do this for
us [1], since we have all the information needed and would be
copy-pasteable by everybody. I can send it as a non-mangled patch and
then Viresh can redo this one on top using it.

Cheers,
Miguel

[1]

diff --git a/Makefile b/Makefile
index 70fc4c11dfc0..7fe82dd4dc6f 100644
--- a/Makefile
+++ b/Makefile
@@ -276,7 +276,8 @@ no-dot-config-targets := $(clean-targets) \
                         cscope gtags TAGS tags help% %docs check% coccicheck \
                         $(version_h) headers headers_% archheaders
archscripts \
                         %asm-generic kernelversion %src-pkg dt_binding_check \
-                        outputmakefile rustavailable rustfmt rustfmtcheck
+                        outputmakefile rustavailable rustfmt rustfmtcheck \
+                        rustupoverride
 no-sync-config-targets := $(no-dot-config-targets) %install
modules_sign kernelrelease \
                          image_name
 single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s
%.symtypes %/
@@ -1611,6 +1612,7 @@ help:
        @echo  '                    (requires kernel .config;
downloads external repos)'
        @echo  '  rust-analyzer   - Generate rust-project.json
rust-analyzer support file'
        @echo  '                    (requires kernel .config)'
+       @echo  '  rustupoverride  - Set up a rustup override for the
build directory'
        @echo  '  dir/file.[os]   - Build specified target only'
        @echo  '  dir/file.rsi    - Build macro expanded source,
similar to C preprocessing.'
        @echo  '                    Run with RUSTFMT=n to skip
reformatting if needed.'
@@ -1735,6 +1737,11 @@ rustfmt:
 rustfmtcheck: rustfmt_flags = --check
 rustfmtcheck: rustfmt

+# `rustup override` setup target
+PHONY += rustupoverride
+rustupoverride:
+       $(Q)rustup override set $(shell
$(srctree)/scripts/min-tool-version.sh rustc)
+
 # Misc
 # ---------------------------------------------------------------------------

  reply	other threads:[~2023-12-14 17:22 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12  7:43 [PATCH V2] docs: rust: Clarify that 'rustup override' applies to build directory Viresh Kumar
2023-12-12  9:19 ` Alice Ryhl
2023-12-12 17:43 ` Benno Lossin
2023-12-14 13:26 ` Tiago Lam
2023-12-14 17:22   ` Miguel Ojeda [this message]
2023-12-14 22:25     ` Miguel Ojeda
2023-12-15  6:48     ` Viresh Kumar
2023-12-15 11:14       ` Tiago Lam
2023-12-15 11:24         ` Viresh Kumar
2023-12-15 11:53           ` Miguel Ojeda
2023-12-18 12:06             ` Masahiro Yamada
2023-12-21 21:39               ` Miguel Ojeda
2023-12-15 12:19           ` Tiago Lam
2023-12-15 11:35         ` Miguel Ojeda
2023-12-21 21:40 ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CANiq72=mvca8PXoxwzSao+QFbAHDCecSKCDtV+ffd+YgZNFaww@mail.gmail.com' \
    --to=miguel.ojeda.sandonis@gmail.com \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=corbet@lwn.net \
    --cc=gary@garyguo.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tiagolam@gmail.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=wedsonaf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).