Skip to content
Browse files

Change cores to jobs in the code as well

  • Loading branch information...
1 parent 078f652 commit 9271600ae8331200c0c897537307c4e33fc15ee6 @samoht samoht committed Jan 7, 2013
Showing with 23 additions and 15 deletions.
  1. +2 −2 src/client/opamSolution.ml
  2. +18 −10 src/core/opamFile.ml
  3. +2 −2 src/core/opamFile.mli
  4. +1 −1 src/core/opamGlobals.ml
View
4 src/client/opamSolution.ml
@@ -619,9 +619,9 @@ let apply_solution ?(force = false) t sol =
| [h] -> OpamPackage.to_string h
| l -> OpamPackage.Set.to_string (OpamPackage.Set.of_list l) in
- let cores = OpamFile.Config.cores t.config in
+ let jobs = OpamFile.Config.jobs t.config in
try
- PackageActionGraph.Parallel.parallel_iter cores sol.to_process ~pre ~child ~post;
+ PackageActionGraph.Parallel.parallel_iter jobs sol.to_process ~pre ~child ~post;
OK
with PackageActionGraph.Parallel.Errors (errors, remaining) ->
OpamGlobals.msg "\n";
View
28 src/core/opamFile.ml
@@ -424,7 +424,7 @@ module Config = struct
opam_version : opam_version ;
repositories : repository_name list ;
switch : switch;
- cores : int;
+ jobs : int;
}
let with_repositories t repositories = { t with repositories }
@@ -434,23 +434,25 @@ module Config = struct
let opam_version t = t.opam_version
let repositories t = t.repositories
let switch t = t.switch
- let cores t = t.cores
+ let jobs t = t.jobs
- let create opam_version switch repositories cores =
- { opam_version ; repositories ; switch ; cores }
+ let create opam_version switch repositories jobs =
+ { opam_version ; repositories ; switch ; jobs }
let empty = {
opam_version = OpamVersion.of_string OpamGlobals.opam_version;
repositories = [];
switch = OpamSwitch.of_string "<empty>";
- cores = OpamGlobals.default_cores;
+ jobs = OpamGlobals.default_jobs;
}
let s_repositories = "repositories"
let s_switch = "switch"
let s_switch1 = "alias"
let s_switch2 = "ocaml-version"
+ let s_jobs = "jobs"
+
let s_cores = "cores"
let s_system_version1 = "system_ocaml-version"
@@ -460,14 +462,15 @@ module Config = struct
s_opam_version;
s_repositories;
s_switch;
- s_cores;
+ s_jobs;
(* this fields are no longer useful, but we keep it for backward
compatibility *)
s_switch1;
s_switch2;
s_system_version1;
s_system_version2;
+ s_cores;
]
let of_string filename f =
@@ -516,10 +519,15 @@ module Config = struct
| Some v, _ , _
| _ , Some v, _
| _ , _ , Some v -> v
- | None , None , None -> OpamGlobals.error_and_exit "No current switch defined" in
+ | None , None , None -> OpamGlobals.error_and_exit "No current switch defined." in
- let cores = OpamFormat.assoc s.file_contents s_cores OpamFormat.parse_int in
- { opam_version; repositories; switch; cores }
+ let jobs =
+ let mk str = OpamFormat.assoc_option s.file_contents str OpamFormat.parse_int in
+ match mk s_jobs, mk s_cores with
+ | Some i, _ -> i
+ | _ , Some i -> i
+ | _ -> 1 in
+ { opam_version; repositories; switch; jobs }
let to_string filename t =
let s = {
@@ -530,7 +538,7 @@ module Config = struct
OpamFormat.make_list
(OpamRepositoryName.to_string |> OpamFormat.make_string)
t.repositories);
- Variable (s_cores , OpamFormat.make_int t.cores);
+ Variable (s_jobs , OpamFormat.make_int t.jobs);
Variable (s_switch, OpamFormat.make_string (OpamSwitch.to_string t.switch))
]
} in
View
4 src/core/opamFile.mli
@@ -68,8 +68,8 @@ module Config: sig
(** Return the OCaml switch *)
val switch: t -> switch
- (** Return the number of cores *)
- val cores: t -> int
+ (** Return the number of jobs *)
+ val jobs: t -> int
end
View
2 src/core/opamGlobals.ml
@@ -140,7 +140,7 @@ let makecmd = ref (lazy (
| _ -> "make"
)
)
-let default_cores = 1
+let default_jobs = 1
let exit i =
raise (Exit i)

0 comments on commit 9271600

Please sign in to comment.
Something went wrong with that request. Please try again.