From 8a6f54fc3a4e8cbe71396b1fd51f5dc718e50f08 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 9 Dec 2021 11:14:49 -0600 Subject: [PATCH 1/4] Use more accurate wording in `bootstrap.py` logging --- src/bootstrap/bootstrap.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index ca7ad53203045..0cd0fabe9b160 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -189,11 +189,11 @@ def default_build_triple(verbose): host = next(x for x in version.split('\n') if x.startswith("host: ")) triple = host.split("host: ")[1] if verbose: - print("detected default triple {}".format(triple)) + print("detected default triple {} from pre-installed rustc".format(triple)) return triple except Exception as e: if verbose: - print("rustup not detected: {}".format(e)) + print("pre-installed rustc not detected: {}".format(e)) print("falling back to auto-detect") required = sys.platform != 'win32' @@ -727,11 +727,11 @@ def maybe_download_ci_toolchain(self): if status != 0: if download_rustc == "if-unchanged": return None - print("warning: `download-rustc` is enabled, but there are changes to \ - compiler/ or library/") + print("warning: `download-rustc` is enabled, but there are changes to " \ + "compiler/ or library/") if self.verbose: - print("using downloaded stage1 artifacts from CI (commit {})".format(commit)) + print("using downloaded stage2 artifacts from CI (commit {})".format(commit)) self.rustc_commit = commit # FIXME: support downloading artifacts from the beta channel self.download_toolchain(False, "nightly") From ae6f5fbc3f7825c42ade064be3a54f38a143e26b Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 9 Dec 2021 11:15:05 -0600 Subject: [PATCH 2/4] If --verbose is passed, print a warning in `bootstrap.py` when download-rustc is ignored --- src/bootstrap/bootstrap.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 0cd0fabe9b160..5df3d0bde6d58 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -726,6 +726,9 @@ def maybe_download_ci_toolchain(self): status = subprocess.call(["git", "diff-index", "--quiet", commit, "--", compiler, library]) if status != 0: if download_rustc == "if-unchanged": + if self.verbose: + print("warning: saw changes to compiler/ or library/ since {}; " \ + "ignoring `download-rustc`".format(commit)) return None print("warning: `download-rustc` is enabled, but there are changes to " \ "compiler/ or library/") From dfcaac53ce9062adfa0c8e316714509a855ba997 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 9 Dec 2021 11:15:38 -0600 Subject: [PATCH 3/4] Don't print bootstrap caching/ensure info unless `-vv` is passed Previously, passing `-v` would emit an overwhelming amount of logging: ``` > Std { stage: 1, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } > Assemble { target_compiler: Compiler { stage: 1, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } > Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } < Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } > Rustc { target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None }, compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } > Std { target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None }, compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } > StartupObjects { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } < StartupObjects { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } c Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } > Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } > Sysroot { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } < Sysroot { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } < Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } c Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } c Sysroot { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } c Assemble { target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } > StdLink { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } c Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } c Libdir { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } < StdLink { compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target_compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } }, target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } < Std { target: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None }, compiler: Compiler { stage: 0, host: TargetSelection { triple: "x86_64-unknown-linux-gnu", file: None } } } ... continues for another 150 lines ... ``` This info is occasionally useful when debugging bootstrap itself, but not very useful for figuring out why a config option was ignored or command wasn't run. Demote it to `-vv` logging so that `-v` is more useful. --- src/bootstrap/builder.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 6ba1b1b6036ea..952a65a428688 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1578,11 +1578,11 @@ impl<'a> Builder<'a> { panic!("{}", out); } if let Some(out) = self.cache.get(&step) { - self.verbose(&format!("{}c {:?}", " ".repeat(stack.len()), step)); + self.verbose_than(1, &format!("{}c {:?}", " ".repeat(stack.len()), step)); return out; } - self.verbose(&format!("{}> {:?}", " ".repeat(stack.len()), step)); + self.verbose_than(1, &format!("{}> {:?}", " ".repeat(stack.len()), step)); stack.push(Box::new(step.clone())); } @@ -1605,7 +1605,7 @@ impl<'a> Builder<'a> { let cur_step = stack.pop().expect("step stack empty"); assert_eq!(cur_step.downcast_ref(), Some(&step)); } - self.verbose(&format!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step)); + self.verbose_than(1, &format!("{}< {:?}", " ".repeat(self.stack.borrow().len()), step)); self.cache.put(step, out.clone()); out } From 684003028335580eae0d12abbe6307db9cd0ee7b Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Thu, 9 Dec 2021 11:20:55 -0600 Subject: [PATCH 4/4] Default to `doc-stage = 2` for the tools profile This already enables `download-rustc`, so it's quick to build rustdoc, and this makes it less confusing when changes to rustdoc aren't reflected in the docs. Note that this uses 2 and not 1 because `download-rustc` only affects stage 2 runs. --- src/bootstrap/defaults/config.tools.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bootstrap/defaults/config.tools.toml b/src/bootstrap/defaults/config.tools.toml index 182fb0fb0675c..88359fff191e3 100644 --- a/src/bootstrap/defaults/config.tools.toml +++ b/src/bootstrap/defaults/config.tools.toml @@ -11,6 +11,10 @@ incremental = true # This cuts compile times by almost 60x, but means you can't modify the compiler. download-rustc = "if-unchanged" +[build] +# Document with the in-tree rustdoc by default, since `download-rustc` makes it quick to compile. +doc-stage = 2 + [llvm] # Will download LLVM from CI if available on your platform. download-ci-llvm = "if-available"