Skip to content

Commit 8e46742

Browse files
committed
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.
1 parent 6ff7204 commit 8e46742

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/bootstrap/bootstrap.py

+12
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,12 @@ def _download_component_helper(
540540
unpack(tarball, tarball_suffix, self.bin_root(stage0), match=pattern, verbose=self.verbose)
541541

542542
def _download_ci_llvm(self, llvm_sha, llvm_assertions):
543+
if not llvm_sha:
544+
print("error: could not find commit hash for downloading LLVM")
545+
print("help: maybe your repository history is too shallow?")
546+
print("help: consider disabling `download-ci-llvm`")
547+
print("help: or fetch enough history to include one upstream commit")
548+
exit(1)
543549
cache_prefix = "llvm-{}-{}".format(llvm_sha, llvm_assertions)
544550
cache_dst = os.path.join(self.build_dir, "cache")
545551
rustc_cache = os.path.join(cache_dst, cache_prefix)
@@ -688,6 +694,12 @@ def maybe_download_ci_toolchain(self):
688694
"--first-parent", "HEAD"
689695
]
690696
commit = subprocess.check_output(merge_base, universal_newlines=True).strip()
697+
if not commit:
698+
print("error: could not find commit hash for downloading rustc")
699+
print("help: maybe your repository history is too shallow?")
700+
print("help: consider disabling `download-rustc`")
701+
print("help: or fetch enough history to include one upstream commit")
702+
exit(1)
691703

692704
# Warn if there were changes to the compiler or standard library since the ancestor commit.
693705
status = subprocess.call(["git", "diff-index", "--quiet", commit, "--", compiler, library])

0 commit comments

Comments
 (0)