about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEric Huss <eric@huss.org>2022-04-09 08:10:34 -0700
committerEric Huss <eric@huss.org>2022-04-09 08:10:34 -0700
commitca9ef27ed156d599f6feac0c772cc29d960526ee (patch)
tree4ad55efdfa91002ca25d8b1c40edd892cb9847b2
parentfbdb10f9fabe47eb763cb4b52b5721740cc63783 (diff)
downloadrust-ca9ef27ed156d599f6feac0c772cc29d960526ee.tar.gz
rust-ca9ef27ed156d599f6feac0c772cc29d960526ee.zip
Check for git submodules in non-git source tree.
-rw-r--r--src/bootstrap/bootstrap.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 0b6bdf47419..00dc7da275a 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -1097,8 +1097,19 @@ class RustBuild(object):
 
     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()