Skip to content

Commit e3e5e47

Browse files
committed
Formatting
1 parent 2363df7 commit e3e5e47

File tree

5 files changed

+58
-36
lines changed

5 files changed

+58
-36
lines changed

src/lib/config.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ let valid_packages_path =
183183
@@ Arg.opt Arg.(string) "valid_packages.txt"
184184
@@ Arg.info ~doc:"Valid packages path" ~docv:"PATH" [ "valid-packages" ]
185185

186-
let v cap_file jobs track_packages take_n_last_versions ssh cache_threshold valid_packages_path =
186+
let v cap_file jobs track_packages take_n_last_versions ssh cache_threshold
187+
valid_packages_path =
187188
let vat = Capnp_rpc_unix.client_only_vat () in
188189
let cap = Capnp_rpc_unix.Cap_file.load vat cap_file |> Result.get_ok in
189190

src/lib/config.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ val cache_threshold : t -> int
5252
(** Number of versions to keep in the cache *)
5353

5454
val valid_packages_path : t -> string
55-
(** Path to the file containing the valid packages. *)
55+
(** Path to the file containing the valid packages. *)

src/lib/prep.ml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ let add_base ocaml_version init =
215215
mk "base-bigarray" "base";
216216
mk "base-threads" "base";
217217
mk "opam-depext" "1.2.3";
218-
219218
mk "ocaml-base-compiler" (Ocaml_version.to_string ocaml_version);
220219
mk "ocaml" (Ocaml_version.to_string ocaml_version);
221220
]
@@ -487,11 +486,14 @@ module Prep = struct
487486
(* base is derived from 'prep' so we don't need to include it in the hash *)
488487
let opamfiles_hash =
489488
let buf = Buffer.create 1024 in
490-
let () = OpamPackage.Map.iter (fun _ x ->
491-
match x with
492-
| Ok (_has_depext, opamfile) ->
493-
Buffer.add_string buf opamfile
494-
| _ -> ()) opamfiles in
489+
let () =
490+
OpamPackage.Map.iter
491+
(fun _ x ->
492+
match x with
493+
| Ok (_has_depext, opamfile) -> Buffer.add_string buf opamfile
494+
| _ -> ())
495+
opamfiles
496+
in
495497
Hashtbl.hash (Buffer.contents buf)
496498
in
497499
Fmt.str "%s\n%s\n%s\n%d\n" prep_version (Package.digest prep)

src/lib/valid_packages.ml

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,60 @@ module Op = struct
55

66
module Key = struct
77
type t = Fpath.t
8+
89
let digest = Fpath.to_string
910
end
1011

1112
module Value = struct
1213
type t = Package.Set.t
14+
1315
let digest v =
14-
Package.Set.elements v
15-
|> List.map Package.to_yojson
16-
|> fun l -> Yojson.Safe.to_string (`List l)
17-
|> Digest.string
16+
Package.Set.elements v |> List.map Package.to_yojson |> fun l ->
17+
Yojson.Safe.to_string (`List l) |> Digest.string
1818
end
1919

2020
module Outcome = Current.Unit
2121

2222
let id = "publish-valid-packages"
23-
2423
let pp f (k, _v) = Fmt.pf f "Publish valid packages to path %a" Fpath.pp k
2524
let auto_cancel = true
25+
2626
let publish config job fpath packages =
2727
let open Lwt.Syntax in
2828
let ssh = Config.ssh config in
2929
let* () = Current.Job.start ~level:Harmless job in
3030
let path = Fpath.to_string fpath in
31-
let () = Out_channel.with_open_bin (Printf.sprintf "%s.tmp" path) (fun oc ->
32-
Package.Set.iter (fun p ->
33-
let opam = Package.opam p in
34-
Printf.fprintf oc "u/%s/%s/%s\n%!" (Package.universe p |> Package.Universe.hash) (OpamPackage.name_to_string opam) (OpamPackage.version_to_string opam);
35-
) packages) in
31+
let () =
32+
Out_channel.with_open_bin (Printf.sprintf "%s.tmp" path) (fun oc ->
33+
Package.Set.iter
34+
(fun p ->
35+
let opam = Package.opam p in
36+
Printf.fprintf oc "u/%s/%s/%s\n%!"
37+
(Package.universe p |> Package.Universe.hash)
38+
(OpamPackage.name_to_string opam)
39+
(OpamPackage.version_to_string opam))
40+
packages)
41+
in
3642
let () = Unix.rename (Printf.sprintf "%s.tmp" path) path in
37-
let cmd = Bos.Cmd.(
38-
v "scp" % "-P" % Int.to_string (Config.Ssh.port ssh)
39-
% "-i"
40-
% p (Config.Ssh.priv_key_file ssh)
41-
% Config.valid_packages_path config
42-
% (Config.Ssh.user ssh ^ "@" ^ Config.Ssh.host ssh ^ ":" ^ path)) in
43-
Current.Process.exec ~cancellable:true ~job ("", Bos.Cmd.to_list cmd |> Array.of_list)
43+
let cmd =
44+
Bos.Cmd.(
45+
v "scp"
46+
% "-P"
47+
% Int.to_string (Config.Ssh.port ssh)
48+
% "-i"
49+
% p (Config.Ssh.priv_key_file ssh)
50+
% Config.valid_packages_path config
51+
% (Config.Ssh.user ssh ^ "@" ^ Config.Ssh.host ssh ^ ":" ^ path))
52+
in
53+
Current.Process.exec ~cancellable:true ~job
54+
("", Bos.Cmd.to_list cmd |> Array.of_list)
4455
end
4556

4657
module Publish = Current_cache.Output (Op)
4758

48-
4959
let set_current config solver_result_c path v =
5060
let open Current.Syntax in
5161
Current.component "Publish valid packages"
52-
|>
53-
let> _solver_result_c = solver_result_c in
54-
Publish.set config path v
62+
|>
63+
let> _solver_result_c = solver_result_c in
64+
Publish.set config path v

src/pipelines/docs.ml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ let prep ~config ~opamfiles (all : Package.Set.t) =
192192
in
193193
let prep_dependencies = prep_dependencies_names |> List.map snd in
194194
let base_image = Misc.get_base_image package in
195-
let opamfiles =
195+
let opamfiles =
196196
Current.map
197197
(fun x ->
198198
List.filter_map
@@ -378,13 +378,16 @@ let v ~config ~opam ~monitor ~migrations () =
378378
f "3) All packages (%d)" (Package.Set.cardinal all_packages));
379379

380380
Log.info (fun f ->
381-
f "Writing valid packages to %s"
382-
(Config.valid_packages_path config));
383-
384-
let valid_packages = Valid_packages.set_current config solver_result_c (Fpath.v (Config.valid_packages_path config)) all_packages in
381+
f "Writing valid packages to %s" (Config.valid_packages_path config));
382+
383+
let valid_packages =
384+
Valid_packages.set_current config solver_result_c
385+
(Fpath.v (Config.valid_packages_path config))
386+
all_packages
387+
in
385388

386389
(* 4) Prepare the packages for compilation *)
387-
390+
388391
(* 4) Schedule a somewhat small set of jobs to obtain at least one universe for each package.version *)
389392
(* 4a) Decide on a docker tag for each job *)
390393
(* 5) Run the preparation step *)
@@ -579,7 +582,13 @@ let v ~config ~opam ~monitor ~migrations () =
579582
in
580583
let live_html = Live.set_to ~ssh "html" generation in
581584
let live_linked = Live.set_to ~ssh "linked" generation in
582-
Current.all [ commits_raw |> Current.ignore_value; live_html; live_linked; valid_packages ]
585+
Current.all
586+
[
587+
commits_raw |> Current.ignore_value;
588+
live_html;
589+
live_linked;
590+
valid_packages;
591+
]
583592
in
584593
Log.info (fun f -> f "8) Pipeline ready");
585594
live_branch

0 commit comments

Comments
 (0)