about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-09-17 23:30:50 +0200
committerGitHub <noreply@github.com>2022-09-17 23:30:50 +0200
commitcda20a7da6d23fabdc805f15644fcc6a8a270532 (patch)
tree6b6ee8962972827c1183fb533b011eb827fa62f8
parentbfbb15a47915e10c92ec85308993b00c593976a4 (diff)
parent63b8d9b6898ec926f9eafa372506b6722d583694 (diff)
downloadrust-cda20a7da6d23fabdc805f15644fcc6a8a270532.tar.gz
rust-cda20a7da6d23fabdc805f15644fcc6a8a270532.zip
Rollup merge of #101835 - jyn514:fix-vendoring, r=Mark-Simulacrum
Allow using vendoring when running bootstrap from outside the source root

Fixes https://github.com/rust-lang/rust/issues/100364.
-rw-r--r--src/bootstrap/bootstrap.py3
-rw-r--r--src/bootstrap/builder.rs3
2 files changed, 5 insertions, 1 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index cc08ae5f99f..25037bd0faa 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -771,7 +771,8 @@ class RustBuild(object):
         elif color == "never":
             args.append("--color=never")
 
-        run(args, env=env, verbose=self.verbose)
+        # Run this from the source directory so cargo finds .cargo/config
+        run(args, env=env, verbose=self.verbose, cwd=self.rust_root)
 
     def build_triple(self):
         """Build triple as in LLVM
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 14e8ebd6876..6a07ac6b007 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1325,6 +1325,9 @@ impl<'a> Builder<'a> {
     ) -> Cargo {
         let mut cargo = Command::new(&self.initial_cargo);
         let out_dir = self.stage_out(compiler, mode);
+        // Run cargo from the source root so it can find .cargo/config.
+        // This matters when using vendoring and the working directory is outside the repository.
+        cargo.current_dir(&self.src);
 
         // Codegen backends are not yet tracked by -Zbinary-dep-depinfo,
         // so we need to explicitly clear out if they've been updated.