Skip to content

Commit

Permalink
Init ~/.opam/<switch>/installed.user with the initial packages (it wa…
Browse files Browse the repository at this point in the history
…s working before, because is that file is empty, then OPAM copies the content of ~/.opam/<switch>/installed).
  • Loading branch information
samoht committed Jan 9, 2013
1 parent 19de888 commit 009ba25
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/client/opamClient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -699,10 +699,12 @@ let init repo compiler cores =
(* Finally, load the complete state and install the compiler packages *)
log "installing compiler packages";
let t = OpamState.load_state () in
let _solution = OpamSolution.resolve_and_apply ~force:true t Init
let compiler_packages = OpamState.get_compiler_packages t compiler in
let compiler_names = OpamPackage.Name.Set.of_list (List.map fst compiler_packages) in
let _solution = OpamSolution.resolve_and_apply ~force:true t (Init compiler_names)
{ wish_install = [];
wish_remove = [];
wish_upgrade = OpamState.get_compiler_packages t compiler } in
wish_upgrade = compiler_packages } in

OpamState.print_env_warning ~add_profile:true t

Expand Down
4 changes: 3 additions & 1 deletion src/client/opamSolution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,9 @@ let apply_solution ?(force = false) t action sol =

let installed = ref t.installed in
let user_installed = ref t.user_installed in
let root_installs = match action with Install i -> i | _ -> OpamPackage.Name.Set.empty in
let root_installs = match action with
| Init i | Install i -> i
| _ -> OpamPackage.Name.Set.empty in

(* This function should be called by the parent process only, as it modifies
the global state of OPAM *)
Expand Down
6 changes: 6 additions & 0 deletions src/core/opamPackage.ml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ let versions_of_packages nvset =
nvset
Version.Set.empty

let names_of_packages nvset =
Set.fold
(fun nv vset -> Name.Set.add (name nv) vset)
nvset
Name.Set.empty

let versions packages n =
versions_of_packages
(Set.filter
Expand Down
3 changes: 3 additions & 0 deletions src/core/opamPackage.mli
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ val to_map: Set.t -> Version.Set.t Name.Map.t
(** Extract the versions from a collection of packages *)
val versions_of_packages: Set.t -> Version.Set.t

(** Extract the naes from a collection of packages *)
val names_of_packages: Set.t -> Name.Set.t

(** Look for all .opam files in directory *)
val opam_files: OpamFilename.Dir.t -> Set.t

Expand Down
2 changes: 1 addition & 1 deletion src/core/opamTypes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ type user_action =
| Upgrade of package_set
| Reinstall
| Depends
| Init
| Init of name_set
| Remove
| Switch

Expand Down
2 changes: 1 addition & 1 deletion src/core/opamTypes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ type user_action =
| Upgrade of package_set (** The subset of packages to upgrade *)
| Reinstall
| Depends
| Init
| Init of name_set (** The 'root' packages to be installed *)
| Remove
| Switch

Expand Down

0 comments on commit 009ba25

Please sign in to comment.