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

Don't display bootstrap changelog warnings in --dry-run mode #138078

Merged
merged 2 commits into from
Mar 7, 2025

Conversation

moxian
Copy link
Contributor

@moxian moxian commented Mar 6, 2025

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 #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 #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.

previous attempt (outdated) 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.

(Apologies for the, perhaps, excessively wordy PR, I'm new to this)

@rustbot
Copy link
Collaborator

rustbot commented Mar 6, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 6, 2025
@moxian
Copy link
Contributor Author

moxian commented Mar 6, 2025

The current PR still makes us see the note twice - once for normal run, and once more for dry run, but that's not a big deal.

One alternative approach is to unify the location of .last-warned-change-id to be the same between dry-run and non-dry-run, but I'm not sure how to do that neatly. The obvious way is something like:

--- a/src/bootstrap/src/bin/main.rs
+++ b/src/bootstrap/src/bin/main.rs
@@ -151,7 +151,10 @@ fn check_version(config: &Config) -> Option<String> {
     let mut msg = String::new();

     let latest_change_id = CONFIG_CHANGE_HISTORY.last().unwrap().change_id;
-    let warned_id_path = config.out.join("bootstrap").join(".last-warned-change-id");
+    // If we are in dry-run mode, try and recover the original config.out
+    // (i.e. the one without "tmp-dry-run" appended)
+    let base_path = if config.dry_run() { config.out.parent().unwrap() } else { config.out };
+    let warned_id_path = base_path.join("bootstrap").join(".last-warned-change-id");

     if let Some(mut id) = config.change_id {
         if id == latest_change_id {

but that looks extremely hacky, and probably not worth the gains.

@Kobzol
Copy link
Contributor

Kobzol commented Mar 6, 2025

Can't we just put an if condition around the print to avoid printing it in dry run mode altogether? Seems like that would be the easiest :)

@moxian
Copy link
Contributor Author

moxian commented Mar 6, 2025

Great idea, actually! Done.

@moxian moxian changed the title Remember silenced bootstrap changelog warnings even in --dry-run mode Reduce the noise of bootstrap changelog warnings in --dry-run mode Mar 6, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Mar 6, 2025

r? Kobzol (since you're looking at it already)

@rustbot rustbot assigned Kobzol and unassigned jieyouxu Mar 6, 2025
@Kobzol
Copy link
Contributor

Kobzol commented Mar 6, 2025

Thanks! You might want to modify the PR title and description.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 6, 2025

📌 Commit e13af7a has been approved by Kobzol

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Mar 6, 2025

🌲 The tree is currently closed for pull requests below priority 100. This pull request will be tested once the tree is reopened.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 6, 2025
@moxian moxian changed the title Reduce the noise of bootstrap changelog warnings in --dry-run mode Don't display bootstrap changelog warnings in --dry-run mode Mar 6, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2025
…mpiler-errors

Rollup of 17 pull requests

Successful merges:

 - rust-lang#137827 (Add timestamp to unstable feature usage metrics)
 - rust-lang#138041 (bootstrap and compiletest: Use `size_of_val` from the prelude instead of imported)
 - rust-lang#138046 (trim channel value in `get_closest_merge_commit`)
 - rust-lang#138053 (Increase the max. custom try jobs requested to `20`)
 - rust-lang#138061 (triagebot: add a `compiler_leads` ad-hoc group)
 - rust-lang#138064 (Remove - from xtensa targets cpu names)
 - rust-lang#138075 (Use final path segment for diagnostic)
 - rust-lang#138078 (Reduce the noise of bootstrap changelog warnings in --dry-run mode)
 - rust-lang#138081 (Move `yield` expressions behind their own feature gate)
 - rust-lang#138090 (`librustdoc`: flatten nested ifs)
 - rust-lang#138092 (Re-add `DynSend` and `DynSync` impls for `TyCtxt`)
 - rust-lang#138094 (a small borrowck cleanup)
 - rust-lang#138098 (Stabilize feature `const_copy_from_slice`)
 - rust-lang#138103 (Git ignore citool's target directory)
 - rust-lang#138105 (Fix broken link to Miri intrinsics in documentation)
 - rust-lang#138108 (Mention me (WaffleLapkin) when changes to `rustc_codegen_ssa` occur)
 - rust-lang#138117 ([llvm/PassWrapper] use `size_t` when building arg strings)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 6963d74 into rust-lang:master Mar 7, 2025
6 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Mar 7, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 7, 2025
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants