Skip to content

Commit

Permalink
Rollup merge of #95849 - ehuss:check-submodules, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Dylan-DPC authored Apr 10, 2022
2 parents c172544 + ca9ef27 commit 0b87143
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,8 +1097,19 @@ def update_submodule(self, module, checked_out, recorded_submodules):

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

default_encoding = sys.getdefaultencoding()
Expand Down

0 comments on commit 0b87143

Please sign in to comment.