package obi

  1. Overview
  2. Docs

Source file obi.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
(* Copyright (c) 2018 Anil Madhavapeddy <anil@recoil.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 *)

open Sexplib.Conv

module Ocaml_version = struct
  include Ocaml_version
  include Ocaml_version_sexp
end

module Builds = struct
  type build_result =
    { code: [`Signaled of int | `Exited of int]
    ; actions: string
    ; start_time: float
    ; end_time: float }
  [@@deriving sexp]

  type pkg = {name: string; versions: (string * build_result) list}
  [@@deriving sexp]

  type params =
    { arch: Dockerfile_distro.arch
    ; distro: Dockerfile_distro.t
    ; ov: Ocaml_version.t }
  [@@deriving sexp]

  type batch = {rev: string; params: params; pkgs: pkg list} [@@deriving sexp]
end

module Index = struct
  type maintainers = (string * string list) list [@@deriving sexp]

  type tags = (string * string list) list [@@deriving sexp]

  type deps = (string * string * [`Fail | `Ok | `Skipped]) list
  [@@deriving sexp]

  type result =
    [ `Ok
    | `Fail of int * deps
    | `Depfail of deps
    | `Uninstallable of string list[@sexp.omit_nil]
    | `No_sources of string list[@sexp.omit_nil]
    | `Solver_failure ]
  [@@deriving sexp]

  let pp_result ppf result =
    let open Format in
    match result with
    | `Ok -> pp_print_string ppf "ok"
    | `Fail (exit, deps) ->
        pp_print_string ppf "exit code " ;
        pp_print_int ppf exit
    | `Depfail deps -> pp_print_string ppf "dependency failed"
    | `Uninstallable sl ->
        pp_print_string ppf "uninstallable due to constraints"
    | `No_sources sl -> pp_print_string ppf "unable to fetch package sources"
    | `Solver_failure -> pp_print_string ppf "internal opam solver failure"

  type params =
    { arch: Dockerfile_distro.arch
    ; distro: Dockerfile_distro.t
    ; ov: Ocaml_version.t }
  [@@deriving sexp]

  type metadata =
    { rev: string
    ; params: params
    ; build_result: result
    ; duration: float
    ; log: string list [@sexp.omit_nil] }
  [@@deriving sexp]

  type pkg =
    { name: string
    ; mutable maintainers: string list
    ; mutable tags: string list [@sexp.omit_nil]
    ; mutable versions: (string * metadata list) list }
  [@@deriving sexp]

  type t = {version: int [@default 0]; packages: pkg list} [@@deriving sexp]

  let current_version = 2
end

module VersionCompare = VersionCompare
module OpamJsonActions = OpamJsonActions
OCaml

Innovation. Community. Security.