-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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 download hermes nightly tarball if it exists #36368
Conversation
Base commit: 5746533 |
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.
Looks good to me... I wonder whether we should add a cleanup for the old filepath... 🤔 just not to keep some polluted file system to our users.
Perhaps it is a worthless worries, though...
unless File.exist?(destination_path) | ||
# Download to a temporary file first so we don't cache incomplete downloads. | ||
tmp_file = "#{destination_folder}/hermes-ios.download" | ||
`mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"` |
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.
nit: I know it is the same thing, but this makes more evident that we are moving the file.
`mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{tmp_file}" && mv "#{tmp_file}" "#{destination_path}"` | |
`mkdir -p "#{destination_folder}" && curl "#{tarball_url}" -Lo "#{tmp_file}"` | |
`mv "#{tmp_file}" "#{destination_path}"` |
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.
What if the first command fail, do you know if it would still execute the rename command?
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.
You are right, it looks like pod install won't fail and it will continue with the pod installation, with a potentially broken project.
It should be fine as it is still in node_modules so when someone updates react-native to a version with this the file will be deleted. |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@cipolleschi merged this pull request in d2dd79f. |
Summary: Currently the hermes tarball will be re-downloaded every time we run pod update even if the file already exists. This adds a check to avoid downloading it if it already exists. To avoid partial downloads causing issues (if the script is interrupted) we download first to a different file and rename it when done. ## Changelog [IOS] [FIXED] - Don't download hermes nightly tarball if it exists Pull Request resolved: facebook#36368 Test Plan: Tested in an app using nightly builds that the download is only done once when running multiple pod update. Reviewed By: sshic Differential Revision: D43815772 Pulled By: cipolleschi fbshipit-source-id: 9dedb79cab1f1cb37cd82b425d93515c6e1728c1
Summary
Currently the hermes tarball will be re-downloaded every time we run pod update even if the file already exists. This adds a check to avoid downloading it if it already exists. To avoid partial downloads causing issues (if the script is interrupted) we download first to a different file and rename it when done.
Changelog
[IOS] [FIXED] - Don't download hermes nightly tarball if it exists
Test Plan
Tested in an app using nightly builds that the download is only done once when running multiple pod update.