about summary refs log tree commit diff
path: root/src/bootstrap/bootstrap.py
diff options
context:
space:
mode:
authorTaylor Yu <tlyu@mit.edu>2021-10-07 18:20:38 -0500
committerTaylor Yu <tlyu@mit.edu>2021-10-07 18:47:43 -0500
commit8e467421decb43a1f1adc353c4984df7eecd0af7 (patch)
tree77e7a85dc81019831a7652b393ec59d6706f141c /src/bootstrap/bootstrap.py
parent6ff72045dee098e5a95f42c27b2f2cf167f0d52d (diff)
downloadrust-8e467421decb43a1f1adc353c4984df7eecd0af7.tar.gz
rust-8e467421decb43a1f1adc353c4984df7eecd0af7.zip
bootstrap: add error messages re shallow history
Exit with an error if we can't find a commit hash for downloading
LLVM or rustc snapshots.
Diffstat (limited to 'src/bootstrap/bootstrap.py')
-rw-r--r--src/bootstrap/bootstrap.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 49121869282..817850b1ec7 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -540,6 +540,12 @@ class RustBuild(object):
         unpack(tarball, tarball_suffix, self.bin_root(stage0), match=pattern, verbose=self.verbose)
 
     def _download_ci_llvm(self, llvm_sha, llvm_assertions):
+        if not llvm_sha:
+            print("error: could not find commit hash for downloading LLVM")
+            print("help: maybe your repository history is too shallow?")
+            print("help: consider disabling `download-ci-llvm`")
+            print("help: or fetch enough history to include one upstream commit")
+            exit(1)
         cache_prefix = "llvm-{}-{}".format(llvm_sha, llvm_assertions)
         cache_dst = os.path.join(self.build_dir, "cache")
         rustc_cache = os.path.join(cache_dst, cache_prefix)
@@ -688,6 +694,12 @@ class RustBuild(object):
             "--first-parent", "HEAD"
         ]
         commit = subprocess.check_output(merge_base, universal_newlines=True).strip()
+        if not commit:
+            print("error: could not find commit hash for downloading rustc")
+            print("help: maybe your repository history is too shallow?")
+            print("help: consider disabling `download-rustc`")
+            print("help: or fetch enough history to include one upstream commit")
+            exit(1)
 
         # Warn if there were changes to the compiler or standard library since the ancestor commit.
         status = subprocess.call(["git", "diff-index", "--quiet", commit, "--", compiler, library])