Skip to content

Commit

Permalink
[solver] More API clean-ups
Browse files Browse the repository at this point in the history
split opamSolver into 3 files:
* opamCudf.ml contains the interaction with CUDF engine
* opamHeuristic.ml contains the heuristics implemented in OPAM (and which can be reuse for any CUDF-based system)
* opamSolver.ml contains the OPAM-specific interfaces with the solver
  • Loading branch information
samoht committed Nov 7, 2012
1 parent c84f44c commit 2e65e11
Show file tree
Hide file tree
Showing 11 changed files with 1,053 additions and 869 deletions.
4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -79,9 +79,9 @@ uninstall:

LIB = opam-lib
NOMLI = opamGlobals.ml
CMI = $(shell ls src/*.mli)
MLI = $(foreach i, $(shell find src/ -name "*.mli"), $(notdir $i))
_FILES= $(LIB:%=%.a) $(LIB:%=%.cma) $(LIB:%=%.cmxa)\
$(CMI:src/%.mli=%.cmi)
$(MLI:%.mli=%.cmi)
FILES = $(_FILES:%=_obuild/opam-lib/%) $(NOMLI:%.ml=_obuild/opam-lib/%.cmi)

.PHONY: libuninstall libinstall
Expand Down
2 changes: 2 additions & 0 deletions opam.install
Expand Up @@ -27,6 +27,8 @@ lib: [
"_obuild/opam-lib/opamRepository.cmi"
"_obuild/opam-lib/opamRepositoryName.cmi"
"_obuild/opam-lib/opamRsync.cmi"
"_obuild/opam-lib/opamCudf.cmi"
"_obuild/opam-lib/opamHeuristic.cmi"
"_obuild/opam-lib/opamSolver.cmi"
"_obuild/opam-lib/opamSystem.cmi"
"_obuild/opam-lib/opamTypes.cmi"
Expand Down
4 changes: 3 additions & 1 deletion opam.ocp
Expand Up @@ -35,7 +35,9 @@ begin library "opam-lib"
"repo/opamCurl.ml"
"repo/opamRsync.ml"
"repo/opamGit.ml"
"opamSolver.ml"
"solver/opamCudf.ml"
"solver/opamHeuristic.ml"
"solver/opamSolver.ml"
"opamClient.ml"
]

Expand Down
10 changes: 5 additions & 5 deletions src/opamClient.ml
Expand Up @@ -1692,7 +1692,7 @@ let apply_solution ?(force = false) t sol =
let depends =
let set = OpamPackage.Set.singleton nv in
OpamPackage.Set.of_list
(OpamSolver.get_forward_dependencies ~depopts:true ~installed:true universe set) in
(OpamSolver.forward_dependencies ~depopts:true ~installed:true universe set) in
OpamPackage.Set.iter (proceed_todelete ~rm_build:false t) depends;
installed := OpamPackage.Set.diff !installed depends;
write_installed ();
Expand Down Expand Up @@ -1851,7 +1851,7 @@ let upgrade names =
let universe = universe t Depends in
let partial_reinstall =
OpamPackage.Set.of_list
(OpamSolver.get_forward_dependencies ~depopts:true ~installed:true universe partial_reinstall) in
(OpamSolver.forward_dependencies ~depopts:true ~installed:true universe partial_reinstall) in
let installed = OpamPackage.Set.diff t.installed partial_reinstall in
let solution = resolve_and_apply t (Upgrade partial_reinstall)
{ wish_install = atoms_of_packages installed;
Expand Down Expand Up @@ -2096,7 +2096,7 @@ let remove names =
let universe = universe t Depends in
let to_remove =
OpamPackage.Set.of_list
(OpamSolver.get_forward_dependencies ~depopts:false ~installed:true universe packages) in
(OpamSolver.forward_dependencies ~depopts:false ~installed:true universe packages) in
let installed = OpamPackage.Set.diff t.installed to_remove in
let solution = resolve_and_apply t Remove
{ wish_install = atoms_of_packages installed;
Expand All @@ -2120,7 +2120,7 @@ let reinstall names =
let reinstall = OpamPackage.Set.of_list reinstall in
let depends =
let universe = universe t Depends in
OpamSolver.get_forward_dependencies ~depopts:true ~installed:true universe reinstall in
OpamSolver.forward_dependencies ~depopts:true ~installed:true universe reinstall in
let to_process =
List.map (fun pkg -> To_recompile pkg) depends in
let solution = apply_solution t (OpamSolver.sequential_solution to_process) in
Expand Down Expand Up @@ -2213,7 +2213,7 @@ let get_transitive_dependencies t ?(depopts = false) names =
let universe = universe t Depends in
(* Compute the transitive closure of dependencies *)
let packages = OpamPackage.Set.of_list (List.map (find_installed_package_by_name t) names) in
OpamSolver.get_backward_dependencies ~depopts universe packages
OpamSolver.backward_dependencies ~depopts universe packages

let config_includes t is_rec names =
let deps =
Expand Down

0 comments on commit 2e65e11

Please sign in to comment.