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: use the same version number for rustc and cargo #79133

Merged
merged 1 commit into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
29 changes: 4 additions & 25 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ def output(filepath):
class RustBuild(object):
"""Provide all the methods required to build Rust"""
def __init__(self):
self.cargo_channel = ''
self.date = ''
self._download_url = ''
self.rustc_channel = ''
Expand All @@ -387,7 +386,6 @@ def download_stage0(self):
will move all the content to the right place.
"""
rustc_channel = self.rustc_channel
cargo_channel = self.cargo_channel
rustfmt_channel = self.rustfmt_channel

if self.rustc().startswith(self.bin_root()) and \
Expand All @@ -400,30 +398,22 @@ def download_stage0(self):
rustc_channel, self.build, tarball_suffix)
pattern = "rust-std-{}".format(self.build)
self._download_stage0_helper(filename, pattern, tarball_suffix)

filename = "rustc-{}-{}{}".format(rustc_channel, self.build,
tarball_suffix)
self._download_stage0_helper(filename, "rustc", tarball_suffix)
filename = "cargo-{}-{}{}".format(rustc_channel, self.build,
tarball_suffix)
self._download_stage0_helper(filename, "cargo", tarball_suffix)
self.fix_bin_or_dylib("{}/bin/rustc".format(self.bin_root()))
self.fix_bin_or_dylib("{}/bin/rustdoc".format(self.bin_root()))
self.fix_bin_or_dylib("{}/bin/cargo".format(self.bin_root()))
lib_dir = "{}/lib".format(self.bin_root())
for lib in os.listdir(lib_dir):
if lib.endswith(".so"):
self.fix_bin_or_dylib("{}/{}".format(lib_dir, lib))
with output(self.rustc_stamp()) as rust_stamp:
rust_stamp.write(self.date)

if self.cargo().startswith(self.bin_root()) and \
(not os.path.exists(self.cargo()) or
self.program_out_of_date(self.cargo_stamp())):
tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz'
filename = "cargo-{}-{}{}".format(cargo_channel, self.build,
tarball_suffix)
self._download_stage0_helper(filename, "cargo", tarball_suffix)
self.fix_bin_or_dylib("{}/bin/cargo".format(self.bin_root()))
with output(self.cargo_stamp()) as cargo_stamp:
cargo_stamp.write(self.date)

if self.rustfmt() and self.rustfmt().startswith(self.bin_root()) and (
not os.path.exists(self.rustfmt())
or self.program_out_of_date(self.rustfmt_stamp(), self.rustfmt_channel)
Expand Down Expand Up @@ -601,16 +591,6 @@ def rustc_stamp(self):
"""
return os.path.join(self.bin_root(), '.rustc-stamp')

def cargo_stamp(self):
"""Return the path for .cargo-stamp

>>> rb = RustBuild()
>>> rb.build_dir = "build"
>>> rb.cargo_stamp() == os.path.join("build", "stage0", ".cargo-stamp")
True
"""
return os.path.join(self.bin_root(), '.cargo-stamp')

def rustfmt_stamp(self):
"""Return the path for .rustfmt-stamp

Expand Down Expand Up @@ -1056,7 +1036,6 @@ def bootstrap(help_triggered):
data = stage0_data(build.rust_root)
build.date = data['date']
build.rustc_channel = data['rustc']
build.cargo_channel = data['cargo']

if "rustfmt" in data:
build.rustfmt_channel = data['rustfmt']
Expand Down
11 changes: 5 additions & 6 deletions src/stage0.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# This file describes the stage0 compiler that's used to then bootstrap the Rust
# compiler itself. For the rustbuild build system, this also describes the
# relevant Cargo revision that we're using.
# compiler itself.
#
# Currently Rust always bootstraps from the previous stable release, and in our
# train model this means that the master branch bootstraps from beta, beta
# bootstraps from current stable, and stable bootstraps from the previous stable
# release.
#
# If you're looking at this file on the master branch, you'll likely see that
# rustc and cargo are configured to `beta`, whereas if you're looking at a
# source tarball for a stable release you'll likely see `1.x.0` for rustc and
# `0.(x+1).0` for Cargo where they were released on `date`.
# rustc is configured to `beta`, whereas if you're looking at a source tarball
# for a stable release you'll likely see `1.x.0` for rustc, with the previous
# stable release's version number. `date` is the date where the release we're
# bootstrapping off was released.

date: 2020-10-16
rustc: beta
cargo: beta

# We use a nightly rustfmt to format the source because it solves some
# bootstrapping issues with use of new syntax in this repo. If you're looking at
Expand Down