Skip to content

Commit 6963d74

Browse files
Rollup merge of rust-lang#138078 - moxian:rember-warns, r=Kobzol
Reduce the noise of bootstrap changelog warnings in --dry-run mode Presently x.py displays "There have been changes to x.py since you last updated:" note only once when run normally, but on every invocation when run with `--dry-run`. The disparity is not exactly intentonal, but just a historical accident. It was made to be printed once in rust-lang#117815 via storing `.last-warned-change-id` on disk in `{config.out}/bootstrap` (i.e. `build/bootstrap`) directory. But that didn't quite work for `--dry-run`, since `{config.out}/bootsrap` points to `build/tmp-dry-run/bootstrap` which *isn't* created in dry-run mode, so file creation fails. This got fixed in rust-lang#118789 and now `--dry-run` does not save `.last-warned-change-id` at all. (Nor does it read it, since it cannot know to read from non-dry-run location) This PR simply stops displaying the changelog altogether in --dry-run mode. <details> <summary>previous attempt (outdated)</summary> This PR takes a different approach, and instead of not-writing the stamp in `--dry-run` mode it instead tries harder to yes-write it, and, specifically, creates `build/tmp-dry-run/bootstrap` directory to do so. If neccessary (i.e. if there are changes newer than the `change-id` stamp of config.toml to warn about). Note that `build/tmp-dry-run/` was *already* being created, so making an extra `boostrap` sub-folder should not meaningfully pollute the build dir. </details> (Apologies for the, perhaps, excessively wordy PR, I'm new to this)
2 parents d36961f + e13af7a commit 6963d74

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/bootstrap/src/bin/main.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,12 @@ fn main() {
7070
}
7171

7272
// check_version warnings are not printed during setup, or during CI
73-
let changelog_suggestion = if matches!(config.cmd, Subcommand::Setup { .. }) || CiEnv::is_ci() {
74-
None
75-
} else {
76-
check_version(&config)
77-
};
73+
let changelog_suggestion =
74+
if matches!(config.cmd, Subcommand::Setup { .. }) || CiEnv::is_ci() || config.dry_run() {
75+
None
76+
} else {
77+
check_version(&config)
78+
};
7879

7980
// NOTE: Since `./configure` generates a `config.toml`, distro maintainers will see the
8081
// changelog warning, not the `x.py setup` message.
@@ -187,7 +188,7 @@ fn check_version(config: &Config) -> Option<String> {
187188
"update `config.toml` to use `change-id = {latest_change_id}` instead"
188189
));
189190

190-
if io::stdout().is_terminal() && !config.dry_run() {
191+
if io::stdout().is_terminal() {
191192
t!(fs::write(warned_id_path, latest_change_id.to_string()));
192193
}
193194
} else {

0 commit comments

Comments
 (0)