-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Avoid redundant downloads when bootstrapping #34644
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
Conversation
If the local file is available, then verify it against the hash we just downloaded, and if it matches then we don't need to download it again.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks for the PR! This was actually a bad approximation to fix another issue which we may want to take into account as well. If you're bootstrapping Rust today you'll have the snapshot compiler downloaded, but then once it updates and you do a Basically we just need to handle that case where if |
I think my patch here doesn't break that - it still always downloads the hash, even if |
Oh! I failed to notice the fall through from a failed verification to just doing the download anyway, sorry about that! Then in that case this looks good to me, thanks! Perhaps |
I've changed |
download(temp_path, url, verbose) | ||
verify(temp_path, sha_path, verbose) | ||
if not verify(temp_path, sha_path, verbose): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps this should pass verbose
as True
unconditionally to ensure we always print out the mismatching hashes?
Similarly, the verbose
above seems like it could always be False
as we don't want to print out mis-verifications there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, see the next commit.
Avoid redundant downloads when bootstrapping If the local file is available, then verify it against the hash we just downloaded, and if it matches then we don't need to download it again.
If the local file is available, then verify it against the hash we just
downloaded, and if it matches then we don't need to download it again.