Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
na4zagin3 committed Apr 24, 2022
1 parent 1d4f421 commit b61c192
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
15 changes: 10 additions & 5 deletions src/opamWrapper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let exists_switch_at_dir dir =
let switch_config_file = OpamPath.Switch.switch_config root switch in
OpamFile.exists switch_config_file

let get_satysfi_opam_registry switch =
let get_satysfi_opam_registry ~outf switch =
let get_reg_from_root switch =
let root = OpamStateConfig.(!r.root_dir) in
let switch_config_file = OpamPath.Switch.switch_config root switch in
Expand All @@ -34,19 +34,24 @@ let get_satysfi_opam_registry switch =
in
let get_reg () =
OpamGlobalState.with_ `Lock_none @@ fun gt ->
let global_switch = OpamFile.Config.switch gt.config in
let global_switch =
OpamFile.Config.switch gt.config
(* OpamStateConfig.get_switch_opt () *)
in
match switch, global_switch with
| Some switch, _ ->
Format.fprintf outf "Switch specified: %s@." (OpamSwitch.to_string switch);
get_reg_from_root switch
| None, Some switch ->
Format.fprintf outf "Global switch found: %s@." (OpamSwitch.to_string switch);
get_reg_from_root switch
| None, None ->
failwith "get_reg: No switch is specified"
in
Result.try_with get_reg

let get_satysfi_opam_registry_exc switch =
get_satysfi_opam_registry switch
let get_satysfi_opam_registry_exc ~outf switch =
get_satysfi_opam_registry ~outf switch
|> Result.ok_exn

let dune_cache_envs = [
Expand Down Expand Up @@ -84,7 +89,7 @@ let opam_switch_arg opam_switch =

let read_opam_environment ~outf ?opam_switch env =
let satysfi_opam_registry () =
get_satysfi_opam_registry opam_switch
get_satysfi_opam_registry ~outf opam_switch
|> Result.map ~f:OpamFilename.Dir.to_string
in

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ diff -Nr @@empty_dir@@/satysfi-grcnum.opam @@temp_dir@@/pkg/satysfi-grcnum.opam
------------------------------------------------------------
Command invoked:
opam list -i --color=never --columns name,repository,installed-version --separator=, --recursive --required-by satysfi-fonts-theano,satysfi-grcnum
Installing packages +
------------------------------------------+------------------
Gathering OPAM package information... +
Exception: +
Installing packages
------------------------------------------------------------
Gathering OPAM package information...
Exception:
(Failure
"BUG: Unrecognizable package information from OPAM: \"***,invalid,response,!!!\"")
------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions test/testlib/testLib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,10 @@ let test_install ?(replacements=[]) ?(post_dump_dirs=default_post_dump_dirs) set
post_dump_dirs ~dest_dir ~temp_dir
in
let opam_prefix = Unix.open_process_in "opam var prefix" |> input_line (* Assume a path does not contain line breaks*) in
let working_dir = Unix.getcwd () in
let replacements =
[ opam_prefix, "@@opam_prefix@@";
working_dir, "@@working_dir@@";
dest_dir, "@@dest_dir@@";
temp_dir, "@@temp_dir@@";
Unix.getenv "HOME", "@@home_dir@@";
Expand Down

0 comments on commit b61c192

Please sign in to comment.