Skip to content

Commit

Permalink
Merge pull request tarides#323 from RyanGibb/main
Browse files Browse the repository at this point in the history
Properly display error message when depext fails
  • Loading branch information
Leonidas-from-XIV authored Aug 1, 2022
2 parents 004c17b + cd626f7 commit 7903fa5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
package manager state (#322, @Leonidas-from-XIV)
- Fix a bug where `pull` would crash if the lock file contained no package to
vendor (#321, @NathanReb)
- Display a better error message when the depext command fails when getting the
status of the packages (#258, #323, @RyanGibb, @Julow)

### Removed

Expand Down
12 changes: 8 additions & 4 deletions cli/depext.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ let should_install ~yes pkgs =
pkgs)
~yes

let available_packages pkgs =
match OpamSysInteract.packages_status pkgs with
| available_pkgs, _not_found_pkgs -> Ok available_pkgs
| exception Failure msg -> Error (`Msg msg)

let run (`Root root) (`Lockfile explicit_lockfile) dry_run (`Yes yes) () =
let open Result.O in
let* lockfile = Common.find_lockfile ~explicit_lockfile root in
Expand All @@ -26,11 +31,10 @@ let run (`Root root) (`Lockfile explicit_lockfile) dry_run (`Yes yes) () =
else acc)
~init:OpamSysPkg.Set.empty depexts
in
let pkgs, _ = OpamSysInteract.packages_status pkgs in
let pkgs_list = OpamSysPkg.Set.elements pkgs in
match pkgs_list with
let* pkgs = available_packages pkgs in
match OpamSysPkg.Set.elements pkgs with
| [] -> Ok ()
| _ ->
| pkgs_list ->
let pkgs_str = List.map ~f:OpamSysPkg.to_string pkgs_list in
if dry_run then (
Fmt.pr "%s\n%!" (String.concat ~sep:" " pkgs_str);
Expand Down

0 comments on commit 7903fa5

Please sign in to comment.