Skip to content

Commit

Permalink
chore(bootstrap): capitalize {error, warning, info, note} tags
Browse files Browse the repository at this point in the history
This should enhance the readability.

Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Nov 9, 2023
1 parent 42fbf3e commit d1e2640
Show file tree
Hide file tree
Showing 23 changed files with 92 additions and 92 deletions.
16 changes: 8 additions & 8 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def require(cmd, exit=True, exception=False):
if exception:
raise
elif exit:
eprint("error: unable to run `{}`: {}".format(' '.join(cmd), exc))
eprint("ERROR: unable to run `{}`: {}".format(' '.join(cmd), exc))
eprint("Please make sure it's installed and in the path.")
sys.exit(1)
return None
Expand Down Expand Up @@ -681,7 +681,7 @@ def get_answer():

answer = self._should_fix_bins_and_dylibs = get_answer()
if answer:
eprint("info: You seem to be using Nix.")
eprint("INFO: You seem to be using Nix.")
return answer

def fix_bin_or_dylib(self, fname):
Expand Down Expand Up @@ -727,7 +727,7 @@ def fix_bin_or_dylib(self, fname):
"nix-build", "-E", nix_expr, "-o", nix_deps_dir,
])
except subprocess.CalledProcessError as reason:
eprint("warning: failed to call nix-build:", reason)
eprint("WARNING: failed to call nix-build:", reason)
return
self.nix_deps_dir = nix_deps_dir

Expand All @@ -747,7 +747,7 @@ def fix_bin_or_dylib(self, fname):
try:
subprocess.check_output([patchelf] + patchelf_args + [fname])
except subprocess.CalledProcessError as reason:
eprint("warning: failed to call patchelf:", reason)
eprint("WARNING: failed to call patchelf:", reason)
return

def rustc_stamp(self):
Expand Down Expand Up @@ -1005,7 +1005,7 @@ def check_vendored_status(self):
if 'SUDO_USER' in os.environ and not self.use_vendored_sources:
if os.getuid() == 0:
self.use_vendored_sources = True
eprint('info: looks like you\'re trying to run this command as root')
eprint('INFO: looks like you\'re trying to run this command as root')
eprint(' and so in order to preserve your $HOME this will now')
eprint(' use vendored sources by default.')

Expand All @@ -1017,14 +1017,14 @@ def check_vendored_status(self):
"--sync ./src/tools/rust-analyzer/Cargo.toml " \
"--sync ./compiler/rustc_codegen_cranelift/Cargo.toml " \
"--sync ./src/bootstrap/Cargo.toml "
eprint('error: vendoring required, but vendor directory does not exist.')
eprint('ERROR: vendoring required, but vendor directory does not exist.')
eprint(' Run `cargo vendor {}` to initialize the '
'vendor directory.'.format(sync_dirs))
eprint('Alternatively, use the pre-vendored `rustc-src` dist component.')
raise Exception("{} not found".format(vendor_dir))

if not os.path.exists(cargo_dir):
eprint('error: vendoring required, but .cargo/config does not exist.')
eprint('ERROR: vendoring required, but .cargo/config does not exist.')
raise Exception("{} not found".format(cargo_dir))
else:
if os.path.exists(cargo_dir):
Expand Down Expand Up @@ -1125,7 +1125,7 @@ def main():
# process has to happen before anything is printed out.
if help_triggered:
eprint(
"info: Downloading and building bootstrap before processing --help command.\n"
"INFO: Downloading and building bootstrap before processing --help command.\n"
" See src/bootstrap/README.md for help with common commands.")

exit_code = 0
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/bootstrap_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def serialize_and_parse(configure_args, bootstrap_args=None):
# Verify this is actually valid TOML.
tomllib.loads(build.config_toml)
except ImportError:
print("warning: skipping TOML validation, need at least python 3.11", file=sys.stderr)
print("WARNING: skipping TOML validation, need at least python 3.11", file=sys.stderr)
return build


Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def parse_args(args):
if not found:
unknown_args.append(arg)

# Note: here and a few other places, we use [-1] to apply the *last* value
# NOTE: here and a few other places, we use [-1] to apply the *last* value
# passed. But if option-checking is enabled, then the known_args loop will
# also assert that options are only passed once.
option_checking = ('option-checking' not in known_args
Expand Down Expand Up @@ -477,7 +477,7 @@ def configure_section(lines, config):
# These are used by rpm, but aren't accepted by x.py.
# Give a warning that they're ignored, but not a hard error.
if key in ["infodir", "localstatedir"]:
print("warning: {} will be ignored".format(key))
print("WARNING: {} will be ignored".format(key))
else:
raise RuntimeError("failed to find config line for {}".format(key))

Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn main() {
if suggest_setup {
println!("WARNING: you have not made a `config.toml`");
println!(
"help: consider running `./x.py setup` or copying `config.example.toml` by running \
"HELP: consider running `./x.py setup` or copying `config.example.toml` by running \
`cp config.example.toml config.toml`"
);
} else if let Some(suggestion) = &changelog_suggestion {
Expand All @@ -76,7 +76,7 @@ fn main() {
if suggest_setup {
println!("WARNING: you have not made a `config.toml`");
println!(
"help: consider running `./x.py setup` or copying `config.example.toml` by running \
"HELP: consider running `./x.py setup` or copying `config.example.toml` by running \
`cp config.example.toml config.toml`"
);
} else if let Some(suggestion) = &changelog_suggestion {
Expand All @@ -97,7 +97,7 @@ fn main() {
}

if suggest_setup || changelog_suggestion.is_some() {
println!("note: this message was printed twice to make it more likely to be seen");
println!("NOTE: this message was printed twice to make it more likely to be seen");
}
}

Expand Down Expand Up @@ -128,14 +128,14 @@ fn check_version(config: &Config) -> Option<String> {

msg.push_str("WARNING: there have been changes to x.py since you last updated.\n");

msg.push_str("note: to silence this warning, ");
msg.push_str("NOTE: to silence this warning, ");
msg.push_str(&format!(
"update `config.toml` to use `change-id = {latest_config_id}` instead"
));
}
} else {
msg.push_str("WARNING: The `change-id` is missing in the `config.toml`. This means that you will not be able to track the major changes made to the bootstrap configurations.\n");
msg.push_str("note: to silence this warning, ");
msg.push_str("NOTE: to silence this warning, ");
msg.push_str(&format!("add `change-id = {latest_config_id}` at the top of `config.toml`"));
};

Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ fn main() {

if status.success() {
std::process::exit(0);
// note: everything below here is unreachable. do not put code that
// NOTE: everything below here is unreachable. do not put code that
// should run on success, after this block.
}
if verbose > 0 {
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ fn rm_rf(path: &Path) {
&& p.file_name().and_then(std::ffi::OsStr::to_str)
== Some("bootstrap.exe")
{
eprintln!("warning: failed to delete '{}'.", p.display());
eprintln!("WARNING: failed to delete '{}'.", p.display());
return Ok(());
}
Err(e)
Expand Down
22 changes: 11 additions & 11 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl Step for Std {
if builder.config.keep_stage.contains(&compiler.stage)
|| builder.config.keep_stage_std.contains(&compiler.stage)
{
builder.info("Warning: Using a potentially old libstd. This may not behave well.");
builder.info("WARNING: Using a potentially old libstd. This may not behave well.");

copy_third_party_objects(builder, &compiler, target);
copy_self_contained_objects(builder, &compiler, target);
Expand Down Expand Up @@ -817,8 +817,8 @@ impl Step for Rustc {
builder.ensure(Std::new(compiler, target));

if builder.config.keep_stage.contains(&compiler.stage) {
builder.info("Warning: Using a potentially old librustc. This may not behave well.");
builder.info("Warning: Use `--keep-stage-std` if you want to rebuild the compiler when it changes");
builder.info("WARNING: Using a potentially old librustc. This may not behave well.");
builder.info("WARNING: Use `--keep-stage-std` if you want to rebuild the compiler when it changes");
builder.ensure(RustcLink::from_rustc(self, compiler));
return;
}
Expand Down Expand Up @@ -1203,8 +1203,8 @@ fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool {
}
if needs_codegen_backend_config {
run.builder.info(
"Warning: no codegen-backends config matched the requested path to build a codegen backend. \
Help: add backend to codegen-backends in config.toml.",
"WARNING: no codegen-backends config matched the requested path to build a codegen backend. \
HELP: add backend to codegen-backends in config.toml.",
);
return true;
}
Expand Down Expand Up @@ -1250,7 +1250,7 @@ impl Step for CodegenBackend {

if builder.config.keep_stage.contains(&compiler.stage) {
builder.info(
"Warning: Using a potentially old codegen backend. \
"WARNING: Using a potentially old codegen backend. \
This may not behave well.",
);
// Codegen backends are linked separately from this step today, so we don't do
Expand Down Expand Up @@ -1525,14 +1525,14 @@ impl Step for Sysroot {
let sysroot_lib_rustlib_src_rust = sysroot_lib_rustlib_src.join("rust");
if let Err(e) = symlink_dir(&builder.config, &builder.src, &sysroot_lib_rustlib_src_rust) {
eprintln!(
"warning: creating symbolic link `{}` to `{}` failed with {}",
"WARNING: creating symbolic link `{}` to `{}` failed with {}",
sysroot_lib_rustlib_src_rust.display(),
builder.src.display(),
e,
);
if builder.config.rust_remap_debuginfo {
eprintln!(
"warning: some `tests/ui` tests will fail when lacking `{}`",
"WARNING: some `tests/ui` tests will fail when lacking `{}`",
sysroot_lib_rustlib_src_rust.display(),
);
}
Expand All @@ -1545,7 +1545,7 @@ impl Step for Sysroot {
symlink_dir(&builder.config, &builder.src, &sysroot_lib_rustlib_rustcsrc_rust)
{
eprintln!(
"warning: creating symbolic link `{}` to `{}` failed with {}",
"WARNING: creating symbolic link `{}` to `{}` failed with {}",
sysroot_lib_rustlib_rustcsrc_rust.display(),
builder.src.display(),
e,
Expand Down Expand Up @@ -1986,7 +1986,7 @@ pub fn stream_cargo(
builder.verbose(&format!("running: {cargo:?}"));
let mut child = match cargo.spawn() {
Ok(child) => child,
Err(e) => panic!("failed to execute command: {cargo:?}\nerror: {e}"),
Err(e) => panic!("failed to execute command: {cargo:?}\nERROR: {e}"),
};

// Spawn Cargo slurping up its JSON output. We'll start building up the
Expand Down Expand Up @@ -2050,7 +2050,7 @@ pub fn strip_debug(builder: &Builder<'_>, target: TargetSelection, path: &Path)
}

let previous_mtime = FileTime::from_last_modification_time(&path.metadata().unwrap());
// Note: `output` will propagate any errors here.
// NOTE: `output` will propagate any errors here.
output(Command::new("strip").arg("--strip-debug").arg(path));

// After running `strip`, we have to set the file modification time to what it was before,
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ install!((self, builder, _config),
}
};
RustDemangler, alias = "rust-demangler", Self::should_build(_config), only_hosts: true, {
// Note: Even though `should_build` may return true for `extended` default tools,
// NOTE: Even though `should_build` may return true for `extended` default tools,
// dist::RustDemangler may still return None, unless the target-dependent `profiler` config
// is also true, or the `tools` array explicitly includes "rust-demangler".
if let Some(tarball) = builder.ensure(dist::RustDemangler {
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/src/core/build_steps/llvm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ pub(crate) fn detect_llvm_sha(config: &Config, is_git: bool) -> String {

if llvm_sha.is_empty() {
eprintln!("error: could not find commit hash for downloading LLVM");
eprintln!("help: maybe your repository history is too shallow?");
eprintln!("help: consider disabling `download-ci-llvm`");
eprintln!("help: or fetch enough history to include one upstream commit");
eprintln!("HELP: maybe your repository history is too shallow?");
eprintln!("HELP: consider disabling `download-ci-llvm`");
eprintln!("HELP: or fetch enough history to include one upstream commit");
panic!();
}

Expand Down
20 changes: 10 additions & 10 deletions src/bootstrap/src/core/build_steps/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Step for Profile {
if path.exists() {
eprintln!();
eprintln!(
"error: you asked for a new config file, but one already exists at `{}`",
"ERROR: you asked for a new config file, but one already exists at `{}`",
t!(path.canonicalize()).display()
);

Expand Down Expand Up @@ -212,7 +212,7 @@ pub fn setup(config: &Config, profile: Profile) {
if profile == Profile::Tools {
eprintln!();
eprintln!(
"note: the `tools` profile sets up the `stage2` toolchain (use \
"NOTE: the `tools` profile sets up the `stage2` toolchain (use \
`rustup toolchain link 'name' build/host/stage2` to use rustc)"
)
}
Expand Down Expand Up @@ -414,8 +414,8 @@ pub fn interactive_path() -> io::Result<Profile> {
break match parse_with_abbrev(&input) {
Ok(profile) => profile,
Err(err) => {
eprintln!("error: {err}");
eprintln!("note: press Ctrl+C to exit");
eprintln!("ERROR: {err}");
eprintln!("NOTE: press Ctrl+C to exit");
continue;
}
};
Expand Down Expand Up @@ -444,8 +444,8 @@ fn prompt_user(prompt: &str) -> io::Result<Option<PromptResult>> {
"p" | "print" => return Ok(Some(PromptResult::Print)),
"" => return Ok(None),
_ => {
eprintln!("error: unrecognized option '{}'", input.trim());
eprintln!("note: press Ctrl+C to exit");
eprintln!("ERROR: unrecognized option '{}'", input.trim());
eprintln!("NOTE: press Ctrl+C to exit");
}
};
}
Expand Down Expand Up @@ -512,7 +512,7 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
match fs::hard_link(src, &dst) {
Err(e) => {
eprintln!(
"error: could not create hook {}: do you already have the git hook installed?\n{}",
"ERROR: could not create hook {}: do you already have the git hook installed?\n{}",
dst.display(),
e
);
Expand Down Expand Up @@ -578,10 +578,10 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
);
match mismatched_settings {
Some(true) => eprintln!(
"warning: existing `.vscode/settings.json` is out of date, x.py will update it"
"WARNING: existing `.vscode/settings.json` is out of date, x.py will update it"
),
Some(false) => eprintln!(
"warning: existing `.vscode/settings.json` has been modified by user, x.py will back it up and replace it"
"WARNING: existing `.vscode/settings.json` has been modified by user, x.py will back it up and replace it"
),
_ => (),
}
Expand All @@ -608,7 +608,7 @@ fn create_vscode_settings_maybe(config: &Config) -> io::Result<()> {
// exists and is not current version or outdated, so back it up
let mut backup = vscode_settings.clone();
backup.set_extension("json.bak");
eprintln!("warning: copying `settings.json` to `settings.json.bak`");
eprintln!("WARNING: copying `settings.json` to `settings.json.bak`");
fs::copy(&vscode_settings, &backup)?;
"Updated"
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ pub fn suggest(builder: &Builder<'_>, run: bool) {
build.build();
}
} else {
println!("help: consider using the `--run` flag to automatically run suggested tests");
println!("HELP: consider using the `--run` flag to automatically run suggested tests");
}
}
18 changes: 9 additions & 9 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,10 +1127,10 @@ impl Step for Tidy {
let inferred_rustfmt_dir = builder.initial_rustc.parent().unwrap();
eprintln!(
"\
error: no `rustfmt` binary found in {PATH}
info: `rust.channel` is currently set to \"{CHAN}\"
help: if you are testing a beta branch, set `rust.channel` to \"beta\" in the `config.toml` file
help: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to `x.py test`",
ERROR: no `rustfmt` binary found in {PATH}
INFO: `rust.channel` is currently set to \"{CHAN}\"
HELP: if you are testing a beta branch, set `rust.channel` to \"beta\" in the `config.toml` file
HELP: to skip test's attempt to check tidiness, pass `--skip src/tools/tidy` to `x.py test`",
PATH = inferred_rustfmt_dir.display(),
CHAN = builder.config.channel,
);
Expand Down Expand Up @@ -1183,7 +1183,7 @@ impl Step for ExpandYamlAnchors {
/// appropriate configuration for all our CI providers. This step ensures the tool was called
/// by the user before committing CI changes.
fn run(self, builder: &Builder<'_>) {
// Note: `.github/` is not included in dist-src tarballs
// NOTE: `.github/` is not included in dist-src tarballs
if !builder.src.join(".github/workflows/ci.yml").exists() {
builder.info("Skipping YAML anchors check: GitHub Actions config not found");
return;
Expand Down Expand Up @@ -1566,10 +1566,10 @@ impl Step for Compiletest {
fn run(self, builder: &Builder<'_>) {
if builder.top_stage == 0 && env::var("COMPILETEST_FORCE_STAGE0").is_err() {
eprintln!("\
error: `--stage 0` runs compiletest on the beta compiler, not your local changes, and will almost always cause tests to fail
help: to test the compiler, use `--stage 1` instead
help: to test the standard library, use `--stage 0 library/std` instead
note: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `COMPILETEST_FORCE_STAGE0=1`."
ERROR: `--stage 0` runs compiletest on the beta compiler, not your local changes, and will almost always cause tests to fail
HELP: to test the compiler, use `--stage 1` instead
HELP: to test the standard library, use `--stage 0 library/std` instead
NOTE: if you're sure you want to do this, please open an issue as to why. In the meantime, you can override this with `COMPILETEST_FORCE_STAGE0=1`."
);
crate::exit!(1);
}
Expand Down
Loading

0 comments on commit d1e2640

Please sign in to comment.