-
Notifications
You must be signed in to change notification settings - Fork 1
🧹 Improve distfiles fetch logic to support curl/fetch in addition to wget #288
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -171,7 +171,16 @@ distfiles_fetch () { | |||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| # If the file exists but didn't pass check, or doesn't exist, we download it using -c (continue) | ||||||||||||||||||||||||||||||||||||||||||
| notice "Fetching for ${package}-${DISTVERS[$package]}" | ||||||||||||||||||||||||||||||||||||||||||
| wget -c -O ${distfile} ${DISTS[$package]} | ||||||||||||||||||||||||||||||||||||||||||
| if command -v curl >/dev/null 2>&1; then | ||||||||||||||||||||||||||||||||||||||||||
| curl -f -L -C - -o ${distfile} ${DISTS[$package]} | ||||||||||||||||||||||||||||||||||||||||||
| elif command -v wget >/dev/null 2>&1; then | ||||||||||||||||||||||||||||||||||||||||||
| wget -c -O ${distfile} ${DISTS[$package]} | ||||||||||||||||||||||||||||||||||||||||||
| elif command -v fetch >/dev/null 2>&1; then | ||||||||||||||||||||||||||||||||||||||||||
| fetch -o ${distfile} ${DISTS[$package]} | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+175
to
+179
|
||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||
| notice "No suitable download tool (curl, wget, or fetch) found! Bailing!" | ||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+174
to
+183
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To improve the robustness and consistency of the download logic, I recommend the following improvements:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| if distfiles_sum MD5 ${package} && distfiles_sum SHA256 ${package}; then | ||||||||||||||||||||||||||||||||||||||||||
| return 0 | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
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.
The comment above says the download should use a continue/resume option ("-c"), but the
fetchbranch currently downloads without a resume flag. On BSD/macOS with large distfiles this can force a full re-download after an interrupted fetch. Consider usingfetch's equivalent continue option (e.g.,-Cwhere supported) to match the intended behavior of the other branches.