-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Only use cargo-vendor if building from git sources #41047
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
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
@@ -233,6 +234,7 @@ impl Build { | |||
}; | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(i.e. using fs::metadata
as before) edit: oops, didn't see your comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this allow the build to use an installed cargo-vendor of the wrong version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_git
flag, and then uses it in the dist-srctarget to decide whether to install or use
cargo-vendor
at all.Fixes #41042.