Skip to content

Commit

Permalink
solution: add dry_run function to simulate a state from a solution
Browse files Browse the repository at this point in the history
  • Loading branch information
cannorin authored and rjbou committed Sep 9, 2022
1 parent fde4a3a commit fafdf10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/client/opamSolution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,9 @@ let simulate_new_state state t =
t state.installed in
{ state with installed }

let dry_run state solution =
simulate_new_state state (OpamSolver.get_atomic_action_graph solution)

(* Ask confirmation whenever the packages to modify are not exactly
the packages in the user request *)
let confirmation ?ask requested solution =
Expand Down
4 changes: 4 additions & 0 deletions src/client/opamSolution.mli
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ val check_solution:
(solution_result, 'conflict) result ->
unit

(** Simulate the new [switch_state] after applying the [solution]
without actually performing the action(s) on disk. *)
val dry_run: 'a switch_state -> OpamSolver.solution -> 'a switch_state

(* Install external dependencies of the given package set, according the depext
configuration. If [confirm] is false, install commands are directly
launched, without asking user (used by the `--depext-only` option). If
Expand Down

0 comments on commit fafdf10

Please sign in to comment.