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

repo: fall back in case archive doesn't exist #4008

Merged
merged 4 commits into from
Nov 7, 2019
Merged
Changes from 1 commit
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
14 changes: 9 additions & 5 deletions src/state/opamRepositoryState.ml
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ let cleanup rt =
Hashtbl.clear rt.repos_tmp

let get_root_raw root repos_tmp name =
match Hashtbl.find repos_tmp name with
| lazy repo_root -> repo_root
| exception Not_found -> OpamRepositoryPath.root root name
try
Lazy.force (Hashtbl.find repos_tmp name)
with Not_found -> OpamRepositoryPath.root root name
rjbou marked this conversation as resolved.
Show resolved Hide resolved

let get_root rt name =
get_root_raw rt.repos_global.root rt.repos_tmp name
Expand Down Expand Up @@ -214,8 +214,12 @@ let load lock_kind gt =
then
let tmp = lazy (
let tmp_root = Lazy.force repos_tmp_root in
OpamFilename.extract_in tar tmp_root;
OpamFilename.Op.(tmp_root / OpamRepositoryName.to_string name)
if OpamFilename.exists tar then
(OpamFilename.extract_in tar tmp_root;
OpamFilename.Op.(tmp_root / OpamRepositoryName.to_string name))
else
rjbou marked this conversation as resolved.
Show resolved Hide resolved
(log "Missing repository archive %s" (OpamFilename.to_string tar);
raise Not_found)
) in
Hashtbl.add repos_tmp name tmp
) repositories;
Expand Down