Skip to content

Commit

Permalink
client: on windows init, when updating config file on msys2, resolve …
Browse files Browse the repository at this point in the history
…pacman path and store it as system package manager in config file
  • Loading branch information
rjbou committed Feb 29, 2024
1 parent b65f78e commit 61bc20f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ users)
# API updates
## opam-client
* `OpamClient.windows_checks`: On existing cygwin install, permit to detect msys2 and store `os-distribution=msys2` in `global-variables` config file field [#5843 @rjbou]
* `OpamClient.windows_checks`: When updating config file for msys2, resolve `pacman` path and store it in `sys-pkg-manager-cmd` for msys2 [#5843 @rjbou]

## opam-repository

Expand Down
19 changes: 18 additions & 1 deletion src/client/opamClient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,24 @@ let windows_checks ?cygwin_setup ?git_location config =
OpamStd.Sys.exit_because `Aborted
in
let config =
if is_msys2 cygcheck then config else
if is_msys2 cygcheck then
let env =
OpamStd.Env.cyg_env ~cygbin:(OpamFilename.Dir.to_string cygbin)
~git_location:None
in
match OpamSystem.resolve_command ~env "pacman.exe" with
| Some pacman ->
if OpamConsole.confirm
"Found package manager pacman binary at %s.\n\
Do you want to use it for depexts?"
pacman then
OpamFile.Config.with_sys_pkg_manager_cmd
(OpamStd.String.Map.add distrib (OpamFilename.of_string pacman)
(OpamFile.Config.sys_pkg_manager_cmd config))
config
else config
| None -> config
else
OpamFile.Config.with_sys_pkg_manager_cmd
(OpamStd.String.Map.add distrib cygcheck
(OpamFile.Config.sys_pkg_manager_cmd config))
Expand Down

0 comments on commit 61bc20f

Please sign in to comment.