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

Rename sysroot directories to be more clear #103286

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
8a97952
made changes to compile.rs to change the name
Oct 20, 2022
184b115
reverted changes, as earlier changes was appropriate
Oct 20, 2022
b5cd01a
made changes as per the suggestion
Oct 20, 2022
f3872aa
renamed stage0 to bootstrap-sysroot
Oct 20, 2022
3602282
empty commit to restart the build
Oct 20, 2022
29aa242
Merge branch 'master' into ISSUE#101961
Oct 20, 2022
e3b777f
renamed stage0 to bootstrap-sysroot in src/bootstrap/config.rs and ad…
Oct 20, 2022
cbf6c2c
changed version number to 3 and changed CHANGELOG.md
Oct 20, 2022
ca9d12a
updated the missing update in config.rs
Oct 20, 2022
44401f0
reveted deletion of some lines in compile.rs
Oct 20, 2022
3d26bd7
formatting
Oct 20, 2022
a0ffa72
made sysroot search as default and then the incremental stage{}-sysroot
Oct 20, 2022
76eff26
fixed breaking test related to stage0 name change
Oct 20, 2022
c8ca2a5
remove commented/unwanted code
Oct 20, 2022
bf0a9a8
fixed another instance of failing test
Oct 20, 2022
917093b
added sysroot to the next stage builds
Oct 20, 2022
cdac1c9
Merge branch 'master' into ISSUE#101961
Oct 22, 2022
151046d
Merge remote-tracking branch 'upstream/master' into ISSUE#101961
Oct 26, 2022
fb0eec9
changed ci script to take the namechange of sysroot directories
Oct 26, 2022
4525f55
appended sysroot to the stage2 as part of sysroot name change process
Oct 26, 2022
37548a7
added the miss changed on line 229
Oct 26, 2022
bce7057
Update src/bootstrap/CHANGELOG.md
chetankokil Oct 31, 2022
ff6483f
Merge branch 'master' into ISSUE#101961
chetankokil Nov 20, 2022
445253d
Update config.rs
chetankokil Nov 20, 2022
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
2 changes: 2 additions & 0 deletions src/bootstrap/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Changes since the last major version]

jyn514 marked this conversation as resolved.
Show resolved Hide resolved
## [Version 3] - 2022-10-20
- The names of the sysroot directories have changed. Previously they were `stage0`, `stage0-sysroot`, `stage1`, and `stage2`. Now they are `bootstrap-sysroot`, `stage0-sysroot`, `stage1-sysroot`, and `stage2-sysroot`. If you've created a rustup toolchain using these sysroots with `rustup toolchain link mytoolchain build/stage1`, you will need to update them by running `rustup toolchain remove mytoolchain && rustup toolchain link mytoolchain build/stage1`. [#103286](https://github.com/rust-lang/rust/pull/103286)
chetankokil marked this conversation as resolved.
Show resolved Hide resolved
- Vendoring is no longer done automatically when building from git sources. To use vendoring, run `cargo vendor` manually, or use the pre-vendored `rustc-src` tarball.
- `llvm-libunwind` now accepts `in-tree` (formerly true), `system` or `no` (formerly false) [#77703](https://github.com/rust-lang/rust/pull/77703)
- The options `infodir`, `localstatedir`, and `gpg-password-file` are no longer allowed in config.toml. Previously, they were ignored without warning. Note that `infodir` and `localstatedir` are still accepted by `./configure`, with a warning. [#82451](https://github.com/rust-lang/rust/pull/82451)
Expand Down
8 changes: 4 additions & 4 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def rustc_stamp(self):

>>> rb = RustBuild()
>>> rb.build_dir = "build"
>>> rb.rustc_stamp() == os.path.join("build", "stage0", ".rustc-stamp")
>>> rb.rustc_stamp() == os.path.join("build", "bootstrap-sysroot", ".rustc-stamp")
True
"""
return os.path.join(self.bin_root(), '.rustc-stamp')
Expand All @@ -588,16 +588,16 @@ def bin_root(self):

>>> rb = RustBuild()
>>> rb.build_dir = "build"
>>> rb.bin_root() == os.path.join("build", "stage0")
>>> rb.bin_root() == os.path.join("build", "bootstrap-sysroot")
True

When the 'build' property is given should be a nested directory:

>>> rb.build = "devel"
>>> rb.bin_root() == os.path.join("build", "devel", "stage0")
>>> rb.bin_root() == os.path.join("build", "devel", "bootstrap-sysroot")
True
"""
subdir = "stage0"
subdir = "bootstrap-sysroot"
return os.path.join(self.build_dir, self.build, subdir)

def get_toml(self, key, section=None):
Expand Down
7 changes: 3 additions & 4 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,13 +1127,12 @@ impl Step for Sysroot {
fn run(self, builder: &Builder<'_>) -> Interned<PathBuf> {
let compiler = self.compiler;
let host_dir = builder.out.join(&compiler.host.triple);
let sysroot = if compiler.stage == 0 {
host_dir.join("stage0-sysroot")
} else if builder.download_rustc() {
let sysroot = if builder.download_rustc() {
host_dir.join("ci-rustc-sysroot")
} else {
host_dir.join(format!("stage{}", compiler.stage))
host_dir.join(format!("stage{}-sysroot", compiler.stage))
};

let _ = fs::remove_dir_all(&sysroot);
t!(fs::create_dir_all(&sysroot));

Expand Down
27 changes: 16 additions & 11 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,14 +957,12 @@ impl Config {
config.out = crate::util::absolute(&config.out);
}

config.initial_rustc = build
.rustc
.map(PathBuf::from)
.unwrap_or_else(|| config.out.join(config.build.triple).join("stage0/bin/rustc"));
config.initial_cargo = build
.cargo
.map(PathBuf::from)
.unwrap_or_else(|| config.out.join(config.build.triple).join("stage0/bin/cargo"));
config.initial_rustc = build.rustc.map(PathBuf::from).unwrap_or_else(|| {
config.out.join(config.build.triple).join("bootstrap-sysroot/bin/rustc")
});
config.initial_cargo = build.cargo.map(PathBuf::from).unwrap_or_else(|| {
config.out.join(config.build.triple).join("bootstrap-sysroot/bin/cargo")
});

// NOTE: it's important this comes *after* we set `initial_rustc` just above.
if config.dry_run {
Expand Down Expand Up @@ -1278,7 +1276,7 @@ impl Config {
// If using a system toolchain for bootstrapping, see if that has rustfmt available.
let host = config.build;
let rustfmt_path = config.initial_rustc.with_file_name(exe("rustfmt", host));
let bin_root = config.out.join(host.triple).join("stage0");
let bin_root = config.out.join(host.triple).join("bootstrap-sysroot");
if !rustfmt_path.starts_with(&bin_root) {
// Using a system-provided toolchain; we shouldn't download rustfmt.
*config.initial_rustfmt.borrow_mut() = RustfmtState::SystemToolchain(rustfmt_path);
Expand Down Expand Up @@ -1623,14 +1621,21 @@ fn maybe_download_rustfmt(builder: &Builder<'_>) -> Option<PathBuf> {

let host = builder.config.build;
let rustfmt_path = builder.config.initial_rustc.with_file_name(exe("rustfmt", host));
let bin_root = builder.config.out.join(host.triple).join("stage0");
let bin_root = builder.config.out.join(host.triple).join("bootstrap-sysroot");
let rustfmt_stamp = bin_root.join(".rustfmt-stamp");
if rustfmt_path.exists() && !program_out_of_date(&rustfmt_stamp, &channel) {
return Some(rustfmt_path);
}

let filename = format!("rustfmt-{version}-{build}.tar.xz", build = host.triple);
download_component(builder, DownloadSource::Dist, filename, "rustfmt-preview", &date, "stage0");
download_component(
builder,
DownloadSource::Dist,
filename,
"rustfmt-preview",
&date,
"bootstrap-sysroot",
);

builder.fix_bin_or_dylib(&bin_root.join("bin").join("rustfmt"));
builder.fix_bin_or_dylib(&bin_root.join("bin").join("cargo-fmt"));
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const LLVM_TOOLS: &[&str] = &[
/// LLD file names for all flavors.
const LLD_FILE_NAMES: &[&str] = &["ld.lld", "ld64.lld", "lld-link", "wasm-ld"];

pub const VERSION: usize = 2;
pub const VERSION: usize = 3;

/// Extra --check-cfg to add when building
/// (Mode restriction, config name, config values (if any))
Expand Down
10 changes: 5 additions & 5 deletions src/ci/pgo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ fi
# The various build artifacts used in other commands: to launch rustc builds, build the perf
# collector, and run benchmarks to gather profiling data
BUILD_ARTIFACTS=$BUILD_ROOT/build/$PGO_HOST
RUSTC_STAGE_0=$BUILD_ARTIFACTS/stage0/bin/rustc
CARGO_STAGE_0=$BUILD_ARTIFACTS/stage0/bin/cargo
RUSTC_STAGE_2=$BUILD_ARTIFACTS/stage2/bin/rustc
RUSTC_STAGE_0=$BUILD_ARTIFACTS/bootstrap-sysroot/bin/rustc
CARGO_STAGE_0=$BUILD_ARTIFACTS/bootstrap-sysroot/bin/cargo
RUSTC_STAGE_2=$BUILD_ARTIFACTS/stage2-sysroot/bin/rustc

# Windows needs these to have the .exe extension
if isWindows; then
Expand Down Expand Up @@ -226,5 +226,5 @@ else
fi

echo "Rustc binary size"
ls -la ./build/$PGO_HOST/stage2/bin
ls -la ./build/$PGO_HOST/stage2/lib
ls -la ./build/$PGO_HOST/stage2-sysroot/bin
ls -la ./build/$PGO_HOST/stage2-sysroot/lib