Skip to content

Commit e9cfc30

Browse files
committed
Only use cargo-vendor if building from git sources
1 parent 3fb1a84 commit e9cfc30

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

src/bootstrap/dist.rs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -433,29 +433,32 @@ pub fn rust_src(build: &Build) {
433433
copy(&build.src.join(item), &dst_src.join(item));
434434
}
435435

436-
// Get cargo-vendor installed, if it isn't already.
437-
let mut has_cargo_vendor = false;
438-
let mut cmd = Command::new(&build.cargo);
439-
for line in output(cmd.arg("install").arg("--list")).lines() {
440-
has_cargo_vendor |= line.starts_with("cargo-vendor ");
441-
}
442-
if !has_cargo_vendor {
436+
// If we're building from git sources, we need to vendor a complete distribution.
437+
if build.src_is_git {
438+
// Get cargo-vendor installed, if it isn't already.
439+
let mut has_cargo_vendor = false;
440+
let mut cmd = Command::new(&build.cargo);
441+
for line in output(cmd.arg("install").arg("--list")).lines() {
442+
has_cargo_vendor |= line.starts_with("cargo-vendor ");
443+
}
444+
if !has_cargo_vendor {
445+
let mut cmd = Command::new(&build.cargo);
446+
cmd.arg("install")
447+
.arg("--force")
448+
.arg("--debug")
449+
.arg("--vers").arg(CARGO_VENDOR_VERSION)
450+
.arg("cargo-vendor")
451+
.env("RUSTC", &build.rustc);
452+
build.run(&mut cmd);
453+
}
454+
455+
// Vendor all Cargo dependencies
443456
let mut cmd = Command::new(&build.cargo);
444-
cmd.arg("install")
445-
.arg("--force")
446-
.arg("--debug")
447-
.arg("--vers").arg(CARGO_VENDOR_VERSION)
448-
.arg("cargo-vendor")
449-
.env("RUSTC", &build.rustc);
457+
cmd.arg("vendor")
458+
.current_dir(&dst_src.join("src"));
450459
build.run(&mut cmd);
451460
}
452461

453-
// Vendor all Cargo dependencies
454-
let mut cmd = Command::new(&build.cargo);
455-
cmd.arg("vendor")
456-
.current_dir(&dst_src.join("src"));
457-
build.run(&mut cmd);
458-
459462
// Create source tarball in rust-installer format
460463
let mut cmd = Command::new(SH_CMD);
461464
cmd.arg(sanitize_sh(&build.src.join("src/rust-installer/gen-installer.sh")))

0 commit comments

Comments
 (0)