Only use cargo-vendor if building from git sources#41047
Only use cargo-vendor if building from git sources#41047bors merged 3 commits intorust-lang:masterfrom
Conversation
|
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
|
I'd also nominate this for beta as it's a slight regression from 1.16, which didn't try to access the network. |
src/bootstrap/lib.rs
Outdated
| }; | ||
| let rust_info = channel::GitInfo::new(&src); | ||
| let cargo_info = channel::GitInfo::new(&src.join("cargo")); | ||
| let src_is_git = src.join(".git").is_dir(); |
There was a problem hiding this comment.
This won't work if rust itself is a git submodule. Checking if .git exists at all would be an improvement.
There was a problem hiding this comment.
Hmm, I thought it was better to be more precise, but I see your point. I'll check just for existence.
There was a problem hiding this comment.
(i.e. using fs::metadata as before) edit: oops, didn't see your comment
There was a problem hiding this comment.
Or Path::exists() is the same metadata check, but shorter. :)
|
📌 Commit 4d32ff4 has been approved by |
| let mut has_cargo_vendor = false; | ||
| let mut cmd = Command::new(&build.cargo); | ||
| for line in output(cmd.arg("install").arg("--list")).lines() { | ||
| has_cargo_vendor |= line.starts_with("cargo-vendor "); |
There was a problem hiding this comment.
doesn't this allow the build to use an installed cargo-vendor of the wrong version?
There was a problem hiding this comment.
Maybe so, but FWIW I didn't really change any of these lines, only their indentation.
|
beta-nominate this? |
|
Should I open a beta backport PR? It seems like you're rolling these in batches lately. |
|
@cuviper yeah if you're willing please feel free! We'll batch up if necessary but it's not required. |
|
#41069 is for beta. |
Only use cargo-vendor if building from git sources The only time we need to vendor sources is when building from git. If one is building from a rustc source tarball, everything should already be in place. This also matters for distros which do offline builds, as they can't install cargo-vendor this way. This adds a common `Build::src_is_git` flag, and then uses it in the dist-src target to decide whether to install or use `cargo-vendor` at all. Fixes rust-lang#41042.
Only use cargo-vendor if building from git sources The only time we need to vendor sources is when building from git. If one is building from a rustc source tarball, everything should already be in place. This also matters for distros which do offline builds, as they can't install cargo-vendor this way. This adds a common `Build::src_is_git` flag, and then uses it in the dist-src target to decide whether to install or use `cargo-vendor` at all. Fixes rust-lang#41042.
Only use cargo-vendor if building from git sources The only time we need to vendor sources is when building from git. If one is building from a rustc source tarball, everything should already be in place. This also matters for distros which do offline builds, as they can't install cargo-vendor this way. This adds a common `Build::src_is_git` flag, and then uses it in the dist-src target to decide whether to install or use `cargo-vendor` at all. Fixes rust-lang#41042.
Only use cargo-vendor if building from git sources The only time we need to vendor sources is when building from git. If one is building from a rustc source tarball, everything should already be in place. This also matters for distros which do offline builds, as they can't install cargo-vendor this way. This adds a common `Build::src_is_git` flag, and then uses it in the dist-src target to decide whether to install or use `cargo-vendor` at all. Fixes rust-lang#41042.
Only use cargo-vendor if building from git sources The only time we need to vendor sources is when building from git. If one is building from a rustc source tarball, everything should already be in place. This also matters for distros which do offline builds, as they can't install cargo-vendor this way. This adds a common `Build::src_is_git` flag, and then uses it in the dist-src target to decide whether to install or use `cargo-vendor` at all. Fixes rust-lang#41042.
The only time we need to vendor sources is when building from git. If one is
building from a rustc source tarball, everything should already be in place.
This also matters for distros which do offline builds, as they can't install
cargo-vendor this way.
This adds a common
Build::src_is_gitflag, and then uses it in the dist-srctarget to decide whether to install or use
cargo-vendorat all.Fixes #41042.