Skip to content

Commit

Permalink
Always display the full dependency path of the conflicting package wh…
Browse files Browse the repository at this point in the history
…en showing conflict explanations
  • Loading branch information
kit-ty-kate committed Sep 3, 2024
1 parent e028e64 commit 9a05832
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 16 deletions.
7 changes: 0 additions & 7 deletions src/solver/opamCudf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1156,20 +1156,13 @@ let extract_explanations packages cudfnv2opam reasons : explanation list =
reduce_invariant_msg [] false explanations
in

let same_depexts sdeps fdeps =
List.for_all (function
| `Missing (_, sdeps', fdeps') -> sdeps = sdeps' && fdeps = fdeps'
| _ -> false)
in
log ~level:3 "Explanations: %a" Pp_explanation.pp_explanationlist explanations;
match explanations with
| [] ->
OpamConsole.error_and_exit `Internal_error
"Internal error while computing conflict explanations:\n\
sorry about that. Please report how you got here in \
https://github.com/ocaml/opam/discussions/5130 if possible."
| `Missing (_, sdeps, fdeps) :: rest when same_depexts sdeps fdeps rest ->
[`Missing (None, sdeps, fdeps)]
| _ -> explanations

let strings_of_cycles cycles =
Expand Down
4 changes: 2 additions & 2 deletions tests/reftests/deps-only.test
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ depends: "b"
### opam install a c --deps-only
[ERROR] Package conflict!
* Missing dependency:
- a
- deps-of-c -> b -> a
unmet availability conditions: 'false'

No solution found, exiting
# Return code 20 #
### opam install c --deps-only
[ERROR] Package conflict!
* Missing dependency:
- a
- deps-of-c -> b -> a
unmet availability conditions: 'false'

No solution found, exiting
Expand Down
2 changes: 1 addition & 1 deletion tests/reftests/list-large-dependencies.test
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ abt
### opam install abella --show
[ERROR] Package conflict!
* Missing dependency:
- test-not-in-repo.dev: no longer available
- (invariant) -> test-not-in-repo -> test-not-in-repo.dev: no longer available

No solution found, exiting
# Return code 20 #
Expand Down
4 changes: 2 additions & 2 deletions tests/reftests/opamrt-reinstall.test
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ a.1
### opam install d
[ERROR] Package conflict!
* Missing dependency:
- b
- d -> c -> b
unknown package

No solution found, exiting
Expand Down Expand Up @@ -181,7 +181,7 @@ d
### : # This used to be allowed, but not anymore
### opam reinstall c
* Missing dependency:
- b.1: no longer available
- c -> b -> b.1: no longer available

No solution found, exiting
# Return code 20 #
Expand Down
4 changes: 2 additions & 2 deletions tests/reftests/orphans.test
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ The following actions would be performed:
### opam upgrade bar
[ERROR] Package conflict!
* Missing dependency:
- foo.1: no longer available
- bar -> foo -> foo.1: no longer available

# Return code 20 #
### opam clean -s
Cleaning up switch sw
### opam upgrade bar
[ERROR] Package conflict!
* Missing dependency:
- foo.1: no longer available
- bar -> foo -> foo.1: no longer available

# Return code 20 #
### : replay the same sequence but with another version of `foo` present
Expand Down
2 changes: 1 addition & 1 deletion tests/reftests/tree.test
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ d.1
### opam tree nonsense
[ERROR] Could not simulate installing the specified package(s) to this switch:
* Missing dependency:
- nonsense
- (request) -> nonsense
unknown package

# Return code 20 #
Expand Down
2 changes: 1 addition & 1 deletion tests/reftests/unhelpful-conflicts-002.test
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ocaml-config is now pinned locally (version 1)
### opam install --show expect.0.0.6
[ERROR] Package conflict!
* Missing dependency:
- ocaml < 4.12.0
- expect >= 0.0.6 -> batteries -> ocaml < 4.12.0
not available because the package is pinned to version 4.12.0

No solution found, exiting
Expand Down

0 comments on commit 9a05832

Please sign in to comment.