Skip to content

Commit 0b87143

Browse files
authored
Rollup merge of #95849 - ehuss:check-submodules, r=Mark-Simulacrum
Check for git submodules in non-git source tree. People occasionally download the source from https://github.com/rust-lang/rust/releases, but those source distributions will not work because they are missing the submodules. They will get a confusing `failed to load manifest for workspace member` error. Unfortunately AFAIK there is no way to disable the GitHub source links. This change tries to detect this scenario and provide an error message that guides them toward a solution. Closes #95608
2 parents c172544 + ca9ef27 commit 0b87143

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/bootstrap/bootstrap.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -1097,8 +1097,19 @@ def update_submodule(self, module, checked_out, recorded_submodules):
10971097

10981098
def update_submodules(self):
10991099
"""Update submodules"""
1100-
if (not os.path.exists(os.path.join(self.rust_root, ".git"))) or \
1101-
self.get_toml('submodules') == "false":
1100+
has_git = os.path.exists(os.path.join(self.rust_root, ".git"))
1101+
# This just arbitrarily checks for cargo, but any workspace member in
1102+
# a submodule would work.
1103+
has_submodules = os.path.exists(os.path.join(self.rust_root, "src/tools/cargo/Cargo.toml"))
1104+
if not has_git and not has_submodules:
1105+
print("This is not a git repository, and the requisite git submodules were not found.")
1106+
print("If you downloaded the source from https://github.com/rust-lang/rust/releases,")
1107+
print("those sources will not work. Instead, consider downloading from the source")
1108+
print("releases linked at")
1109+
print("https://forge.rust-lang.org/infra/other-installation-methods.html#source-code")
1110+
print("or clone the repository at https://github.com/rust-lang/rust/.")
1111+
raise SystemExit(1)
1112+
if not has_git or self.get_toml('submodules') == "false":
11021113
return
11031114

11041115
default_encoding = sys.getdefaultencoding()

0 commit comments

Comments
 (0)