Skip to content

Commit

Permalink
Alternate solution which removes dune from formulas
Browse files Browse the repository at this point in the history
Signed-off-by: Marek Kubica <marek@tarides.com>
  • Loading branch information
Leonidas-from-XIV committed Nov 5, 2024
1 parent 57f2e02 commit db5505a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/dune_pkg/opam_solver.ml
Original file line number Diff line number Diff line change
Expand Up @@ -800,13 +800,6 @@ let reject_unreachable_packages =
let version = Package_version.of_string "dev" in
Some version)
in
(* Dune is removed from the packages, but added here to allow formula
resolution to pick "dune" *)
let pkgs_by_version =
Package_name.Map.update pkgs_by_version Dune_dep.name ~f:(function
| Some _ as version -> version
| None -> Some (Package_version.of_string "dev"))
in
let pkgs_by_name =
Package_name.Map.merge pkgs_by_name local_packages ~f:(fun name lhs rhs ->
match lhs, rhs with
Expand All @@ -817,7 +810,13 @@ let reject_unreachable_packages =
[ "name", Package_name.to_dyn name ]
| Some (pkg : Lock_dir.Pkg.t), None -> Some (List.map pkg.depends ~f:snd)
| None, Some (pkg : Local_package.For_solver.t) ->
let formula = pkg.dependencies |> Dependency_formula.to_filtered_formula in
(* remove Dune from the formula as we remove it from solutions *)
let formula =
Dependency_formula.remove_packages
pkg.dependencies
(Package_name.Set.singleton Dune_dep.name)
|> Dependency_formula.to_filtered_formula
in
(* Use `dev` because at this point we don't have any version *)
let opam_package =
OpamPackage.of_string (sprintf "%s.dev" (Package_name.to_string pkg.name))
Expand Down

0 comments on commit db5505a

Please sign in to comment.