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

use cache urls from opam config #337

Merged
merged 2 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
vendor (#321, @NathanReb)
- Display a better error message when the depext command fails when getting the
status of the packages (#258, #323, @RyanGibb, @Julow)
- Take `archive-mirrors` from the global opam configuration into account to
allow more local caches (#337, @hannesm)

### Removed

Expand Down
3 changes: 2 additions & 1 deletion lib/opam.ml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ let pull_tree_with_cache' ~cache_dir ~url ~hashes ~dir =
(* Opam requires a label for the pull, it's only used for logging *)
let opam_dir = OpamFilename.Dir.of_string dir_str in
let open OpamProcess.Job.Op in
OpamRepository.pull_tree ~cache_dir label opam_dir hashes [ url ] @@| function
let cache_urls = OpamFile.Config.dl_cache global_state.config in
OpamRepository.pull_tree ~cache_urls ~cache_dir label opam_dir hashes [ url ] @@| function
| Result _ | Up_to_date _ -> Ok ()
| Not_available (_, long_msg) ->
Error (`Msg (Printf.sprintf "Failed to pull %s: %s" label long_msg))
Expand Down