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

bootstrap: (half) merge cp_r and cp_filtered #111734

Closed
wants to merge 3 commits into from
Closed

Conversation

klensy
Copy link
Contributor

@klensy klensy commented May 18, 2023

Half-way merges cp_r and cp_filtered functions, as there some different points:

cp_r and cp_filtered difference:
skip running if dry_run => cp_r: yes, cp_filtered: no
removes target dir if it exist (i.e. can't be used to copy files into dst dir from multiple sources, (or no?)) => cp_r: no, cp_filtered: yes

Currently this two places didn't changed.

@rustbot
Copy link
Collaborator

rustbot commented May 18, 2023

r? @Mark-Simulacrum

(rustbot has picked a reviewer for you, use r? to override)

@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 May 18, 2023
@klensy
Copy link
Contributor Author

klensy commented May 21, 2023

Looking at 2 uses of cp_filtered, target directory created somewhere before and should be empty, so remove_dir_all (as second difference between cp_r and cp_filtered) can be removed.

self.create_dir(&dst);
self.recurse_(&path, &dst, &relative, filter);
} else {
let _ = fs::remove_file(&dst);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you say more about removing these lines? What is replacing them / why is it safe to do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've described why this line can be removed in commit's title:
dont call remove_file in cp_filtered, as self.copy will call copy_internal which will call remove_file itself

Hm, looks like i mean recurse_ function, not cp_filtered

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment about remove_dir_all: #111734 (comment)

Comment on lines 1538 to 1540
if self.config.dry_run() {
return;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this dry_run is only difference.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But we may break things if we remove it? I'm not sure we want to do this clean up, seems like these functions are distinct if similar today.

@Mark-Simulacrum
Copy link
Member

Looking at 2 uses of cp_filtered, target directory created somewhere before and should be empty, so remove_dir_all (as second difference between cp_r and cp_filtered) can be removed.

I don't think this is valid reasoning. We don't want to write this code against current usage, we want it to work against future usages as well -- which may have a destination directory that does exist.

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 16, 2023
@JohnCSimon
Copy link
Member

@klensy

ping from triage - can you post your status on this PR? There hasn't been an update in a few months. Thanks!

FYI: when a PR is ready for review, send a message containing
@rustbot ready to switch to S-waiting-on-review so the PR is in the reviewer's backlog.

@bors
Copy link
Contributor

bors commented Oct 17, 2023

☔ The latest upstream changes (presumably #116196) made this pull request unmergeable. Please resolve the merge conflicts.

@Dylan-DPC
Copy link
Member

Closing this as inactive. Feel free to reöpen this pr or create a new pr if you get the time to work on this. Thanks

@Dylan-DPC Dylan-DPC closed this Oct 27, 2023
@Dylan-DPC Dylan-DPC added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. 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.

6 participants