Skip to content

Commit

Permalink
Add an option to not install the base packages on init
Browse files Browse the repository at this point in the history
This is helpful when the initial repository is empty (and thus does not contain the description for the base package) as it is the case in the tests.
  • Loading branch information
samoht committed Jul 5, 2012
1 parent ffc1882 commit 640a3ba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/client.ml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -324,7 +324,10 @@ let create_default_compiler_description t =
let f = let f =
File.Comp.create_preinstalled File.Comp.create_preinstalled
ocaml_version ocaml_version
[ mk "base-threads"; mk "base-unix"; mk "base-bigarray"; mk "base-threads" ] (if !Globals.base_packages then
[ mk "base-threads"; mk "base-unix"; mk "base-bigarray"; mk "base-threads" ]
else
[])
[ ("CAML_LD_LIBRARY_PATH", "+=", Dirname.to_string (Path.C.stublibs t.compiler))] in [ ("CAML_LD_LIBRARY_PATH", "+=", Dirname.to_string (Path.C.stublibs t.compiler))] in
let comp = Path.G.compiler t.global ocaml_version in let comp = Path.G.compiler t.global ocaml_version in
File.Comp.write comp f File.Comp.write comp f
Expand Down Expand Up @@ -835,7 +838,7 @@ module Heuristic = struct
let available = NV.to_map t.available in let available = NV.to_map t.available in
List.rev_map List.rev_map
(function (function
| (name, _), None -> | (name, _), None ->
let name = N.of_string name in let name = N.of_string name in
f_h None (N.Map.find name available) name f_h None (N.Map.find name available) name
| n, v -> n, v) | n, v -> n, v)
Expand Down
2 changes: 2 additions & 0 deletions src/globals.ml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ let verbose = ref (
with _ -> false with _ -> false
) )


let base_packages = ref true

let yes = ref false let yes = ref false


let version = "0.2" let version = "0.2"
Expand Down
4 changes: 3 additions & 1 deletion src/opam.ml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ let init =
("-comp" , Arg.Set_string comp , " Which compiler version to use"); ("-comp" , Arg.Set_string comp , " Which compiler version to use");
("-alias", Arg.Set_string alias, " Set the compiler alias name"); ("-alias", Arg.Set_string alias, " Set the compiler alias name");
("-cores", Arg.Set_int cores , " Set the nomber of cores"); ("-cores", Arg.Set_int cores , " Set the nomber of cores");
("-kind" , Arg.Set_string kind , " Set the repository kind") ("-kind" , Arg.Set_string kind , " Set the repository kind");
("-no-base-packages", Arg.Clear Globals.base_packages, " Do not install the base packages");
]; ];
anon; anon;
main = main =
Expand Down Expand Up @@ -310,6 +311,7 @@ let switch =
("-clone" , Arg.Set clone , " Try to keep the same installed packages"); ("-clone" , Arg.Set clone , " Try to keep the same installed packages");
("-list" , Arg.Unit (set `list) , " List the available compiler descriptions"); ("-list" , Arg.Unit (set `list) , " List the available compiler descriptions");
("-alias" , Arg.Set_string alias , " Set the compiler name"); ("-alias" , Arg.Set_string alias , " Set the compiler name");
("-no-base-packages", Arg.Clear Globals.base_packages, " Do not install the base packages");
]; ];
anon; anon;
main = parse_args (fun args -> main = parse_args (fun args ->
Expand Down
4 changes: 2 additions & 2 deletions tests/Makefile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ ifeq ($(REPOKIND), git)
touch README && git add README && \ touch README && git add README && \
git commit -a -m "Initial commit" git commit -a -m "Initial commit"
endif endif
$(OPAM) init $(REPO) $(OPAM_REPO) -kind $(REPOKIND) $(OPAM) init -no-base-packages $(REPO) $(OPAM_REPO) -kind $(REPOKIND)


upload: $(ARCHIVES) upload: $(ARCHIVES)
ifeq ($(REPOKIND), git) ifeq ($(REPOKIND), git)
Expand Down Expand Up @@ -210,7 +210,7 @@ downgrade:
switch-alias: switch-alias:
$(OPAM) remove P3.1~weird-version.test P4.2 $(OPAM) remove P3.1~weird-version.test P4.2
$(CHECK) -l switch-alias P1.1 P2.1 $(CHECK) -l switch-alias P1.1 P2.1
$(OPAM) switch -alias test $(OCAMLVERSION) -clone $(OPAM) switch -alias test $(OCAMLVERSION) -clone -no-base-packages
$(CHECK) -l switch-alias-test P1.1 P2.1 $(CHECK) -l switch-alias-test P1.1 P2.1
$(OPAM) switch 4.00.0 $(OPAM) switch 4.00.0
$(OPAM) install P1 $(OPAM) install P1
Expand Down

0 comments on commit 640a3ba

Please sign in to comment.