Skip to content

Commit

Permalink
bootstrap: add error messages re shallow history
Browse files Browse the repository at this point in the history
Exit with an error if we can't find a commit hash for downloading
LLVM or rustc snapshots.
  • Loading branch information
tlyu committed Oct 7, 2021
1 parent 6ff7204 commit 8e46742
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,12 @@ def _download_component_helper(
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)
Expand Down Expand Up @@ -688,6 +694,12 @@ def maybe_download_ci_toolchain(self):
"--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])
Expand Down

0 comments on commit 8e46742

Please sign in to comment.