From 056d4e4c51dce1fddb1773e5a523525b8fd24d65 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Sat, 11 Nov 2023 16:20:06 +0300 Subject: [PATCH] print the change warnings once for per id Signed-off-by: onur-ozkan --- src/bootstrap/src/bin/main.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs index 0a6072ae1a5d..1cbe3991abfd 100644 --- a/src/bootstrap/src/bin/main.rs +++ b/src/bootstrap/src/bin/main.rs @@ -109,11 +109,19 @@ fn check_version(config: &Config) -> Option { } let latest_config_id = CONFIG_CHANGE_HISTORY.last().unwrap(); + let warned_id_path = config.out.join("bootstrap").join(".last-warned-change-id"); + if let Some(id) = config.change_id { if &id == latest_config_id { return None; } + if let Ok(last_warned_id) = fs::read_to_string(&warned_id_path) { + if id.to_string() == last_warned_id { + return None; + } + } + let change_links: Vec = find_recent_config_change_ids(id) .iter() .map(|id| format!("https://github.com/rust-lang/rust/pull/{id}")) @@ -132,6 +140,8 @@ fn check_version(config: &Config) -> Option { msg.push_str(&format!( "update `config.toml` to use `change-id = {latest_config_id}` instead" )); + + t!(fs::write(warned_id_path, id.to_string())); } } 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");