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

bootstrap.py: use git rev-list for robustness #87532

Merged
merged 3 commits into from
Aug 5, 2021
Merged
Changes from 2 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
9 changes: 5 additions & 4 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,16 +464,17 @@ def download_toolchain(self, stage0=True, rustc_channel=None):
# LLVM more often than necessary.
#
# This git command finds that commit SHA, looking for bors-authored
# merges that modified src/llvm-project.
# commits that modified src/llvm-project or other relevant version
# stamp files.
#
# This works even in a repository that has not yet initialized
# submodules.
top_level = subprocess.check_output([
"git", "rev-parse", "--show-toplevel",
]).decode(sys.getdefaultencoding()).strip()
llvm_sha = subprocess.check_output([
"git", "log", "--author=bors", "--format=%H", "-n1",
"-m", "--first-parent",
"git", "rev-list", "--author=bors@rust-lang.org", "-n1",
"--first-parent", "HEAD",
"--",
"{}/src/llvm-project".format(top_level),
"{}/src/bootstrap/download-ci-llvm-stamp".format(top_level),
Expand Down Expand Up @@ -665,7 +666,7 @@ def maybe_download_ci_toolchain(self):

# Look for a version to compare to based on the current commit.
# Only commits merged by bors will have CI artifacts.
merge_base = ["git", "log", "--author=bors", "--pretty=%H", "-n1"]
merge_base = ["git", "rev-list", "--author=bors@rust-lang.org", "-n1", "HEAD"]
commit = subprocess.check_output(merge_base, universal_newlines=True).strip()

# Warn if there were changes to the compiler or standard library since the ancestor commit.
Expand Down