Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for git submodules in non-git source tree. #95849

Merged
merged 1 commit into from
Apr 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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