@@ -5,50 +5,60 @@ module Op = struct
5
5
6
6
module Key = struct
7
7
type t = Fpath .t
8
+
8
9
let digest = Fpath. to_string
9
10
end
10
11
11
12
module Value = struct
12
13
type t = Package.Set .t
14
+
13
15
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
18
18
end
19
19
20
20
module Outcome = Current. Unit
21
21
22
22
let id = " publish-valid-packages"
23
-
24
23
let pp f (k , _v ) = Fmt. pf f " Publish valid packages to path %a" Fpath. pp k
25
24
let auto_cancel = true
25
+
26
26
let publish config job fpath packages =
27
27
let open Lwt.Syntax in
28
28
let ssh = Config. ssh config in
29
29
let * () = Current.Job. start ~level: Harmless job in
30
30
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
36
42
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)
44
55
end
45
56
46
57
module Publish = Current_cache. Output (Op )
47
58
48
-
49
59
let set_current config solver_result_c path v =
50
60
let open Current.Syntax in
51
61
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
0 commit comments