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

Copy files instead of rsync when they are in a local cache #4270

Merged
merged 2 commits into from
Jul 15, 2020
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
3 changes: 3 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Possibly scripts breaking changes are prefixed with ✘
* Add `_build` to rsync exclusion list [#4230 @rjobou - fix #4195]
* Recursive opam file lookup: ignore `_build` [#4230 @rjbou]

## Archives fetch
* Copy instead of calling rsync when archives are in a local cache [#4270 @kit-ty-kate]

## Switch
* Fix Not_found with `opam switch create . --deps` [#4151 @AltGr]
* Package Var: resolve self `name` variable for orphan packages [#4228 @rjbou - fix #4224]
Expand Down
12 changes: 9 additions & 3 deletions src/repository/opamRepository.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,15 @@ let fetch_from_cache =
~quiet:true ~validate:false ~overwrite:true ~checksum
url file
| `rsync ->
(OpamLocal.rsync_file url file @@| function
| Result _ | Up_to_date _-> ()
| Not_available (s,l) -> raise (OpamDownload.Download_fail (s,l)))
begin match OpamUrl.local_file url with
| Some src ->
OpamFilename.copy ~src ~dst:file;
OpamProcess.Job.Op.Done ()
| None ->
(OpamLocal.rsync_file url file @@| function
| Result _ | Up_to_date _-> ()
| Not_available (s,l) -> raise (OpamDownload.Download_fail (s,l)))
end
| #OpamUrl.version_control ->
failwith "Version control not allowed as cache URL"
in
Expand Down