Skip to content

Commit

Permalink
Apply OCamlFormat 0.27.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterDA committed Dec 5, 2024
1 parent dc5ab75 commit 84a5759
Show file tree
Hide file tree
Showing 10 changed files with 455 additions and 422 deletions.
2 changes: 1 addition & 1 deletion .ocamlformat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
profile = conventional
version = 0.26.2
version = 0.27.0
ocaml-version = 4.08
12 changes: 6 additions & 6 deletions src-cmd/dockerfile_cmd.mli
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
(** Command invocation library to help with Docker builds.
This module primarily exposes utility functions to glue together
Docker-based scripts for (e.g.) continuous integration systems
like the ocaml-ci. The interface is fairly domain-specific and
does not expose all the functionality of the underlying tools.
Feel free to contribute more functions if you need them. *)
Docker-based scripts for (e.g.) continuous integration systems like the
ocaml-ci. The interface is fairly domain-specific and does not expose all
the functionality of the underlying tools. Feel free to contribute more
functions if you need them. *)

type cmd_log = {
command : string;
Expand All @@ -39,8 +39,8 @@ val run_log :
string ->
Bos.Cmd.t ->
(unit, [> `Msg of string ]) result
(** [runlog log_dir name cmd] will run [cmd] with label [name]
and log the results in [<log_dir>/<name>.sxp]. *)
(** [runlog log_dir name cmd] will run [cmd] with label [name] and log the
results in [<log_dir>/<name>.sxp]. *)

(** Docker command invocation *)
module Docker : sig
Expand Down
28 changes: 14 additions & 14 deletions src-cmd/gen.mli
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ val generate_dockerfile :
Fpath.t ->
Dockerfile.t ->
(unit, [> `Msg of string ]) result
(** [generate_dockerfile output_dir docker] will output Dockerfile inside
the [output_dir] subdirectory.
(** [generate_dockerfile output_dir docker] will output Dockerfile inside the
[output_dir] subdirectory.
The [crunch] argument defaults to true and applies the {!Dockerfile.crunch}
optimisation to reduce the number of layers; disable it if you really want
Expand All @@ -35,9 +35,9 @@ val generate_dockerfiles :
Fpath.t ->
(string * Dockerfile.t) list ->
(unit, [> `Msg of string ]) result
(** [generate_dockerfiles output_dir (name * docker)] will
output a list of Dockerfiles inside the [output_dir/] subdirectory,
with each Dockerfile named as [Dockerfile.<release>].
(** [generate_dockerfiles output_dir (name * docker)] will output a list of
Dockerfiles inside the [output_dir/] subdirectory, with each Dockerfile
named as [Dockerfile.<release>].
The [crunch] argument defaults to true and applies the {!Dockerfile.crunch}
optimisation to reduce the number of layers; disable it if you really want
Expand All @@ -48,9 +48,9 @@ val generate_dockerfiles_in_directories :
Fpath.t ->
(string * Dockerfile.t) list ->
(unit, [> `Msg of string ]) result
(** [generate_dockerfiles_in_directories output_dir (name * docker)] will
output a list of Dockerfiles inside the [output_dir/name] subdirectory,
with each directory containing the Dockerfile specified by [docker].
(** [generate_dockerfiles_in_directories output_dir (name * docker)] will output
a list of Dockerfiles inside the [output_dir/name] subdirectory, with each
directory containing the Dockerfile specified by [docker].
The [crunch] argument defaults to true and applies the {!Dockerfile.crunch}
optimisation to reduce the number of layers; disable it if you really want
Expand All @@ -63,12 +63,12 @@ val generate_dockerfiles_in_git_branches :
(string * Dockerfile.t) list ->
(unit, [> `Msg of string ]) result
(** [generate_dockerfiles_in_git_branches output_dir (name * docker)] will
output a set of git branches in the [output_dir] Git repository.
Each branch will be named [name] and contain a single [docker] file.
The contents of these branches will be reset, so this should be
only be used on an [output_dir] that is a dedicated Git repository
for this purpose. If [readme] is specified, the contents will be
written to [README.md] in that branch.
output a set of git branches in the [output_dir] Git repository. Each branch
will be named [name] and contain a single [docker] file. The contents of
these branches will be reset, so this should be only be used on an
[output_dir] that is a dedicated Git repository for this purpose. If
[readme] is specified, the contents will be written to [README.md] in that
branch.
The [crunch] argument defaults to true and applies the {!Dockerfile.crunch}
optimisation to reduce the number of layers; disable it if you really want
Expand Down
106 changes: 50 additions & 56 deletions src-opam/distro.mli
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
*
*)

(** Run Opam commands across a matrix of Docker containers.
Each of these containers represents a different version of
OCaml, Opam and an OS distribution (such as Debian or Alpine).
*)
(** Run Opam commands across a matrix of Docker containers. Each of these
containers represents a different version of OCaml, Opam and an OS
distribution (such as Debian or Alpine). *)

(** {2 Known distributions and OCaml variants} *)

Expand Down Expand Up @@ -207,20 +206,19 @@ val os_family_of_distro : t -> os_family
(** [os_family_of_distro t] returns the OS family of the distro. *)

val os_family_to_string : os_family -> string
(** [os_family_to_string os] returns a string representing the OS
family. *)
(** [os_family_to_string os] returns a string representing the OS family. *)

val opam_repository : os_family -> string
(** [opam_repository os_family] returns the git URL to the default
Opam repository. *)
(** [opam_repository os_family] returns the git URL to the default Opam
repository. *)

val personality : os_family -> Ocaml_version.arch -> string option
(** [personality os_family arch] returns the personality associated to
the architecture, if [os_family] is [`Linux]. *)
(** [personality os_family arch] returns the personality associated to the
architecture, if [os_family] is [`Linux]. *)

val is_same_distro : t -> t -> bool
(** [is_same_distro d1 d2] returns whether [d1] is the same distro as
[d2], regardless of their respective versions. *)
(** [is_same_distro d1 d2] returns whether [d1] is the same distro as [d2],
regardless of their respective versions. *)

val compare : t -> t -> int
(** [compare a b] is a lexical comparison function for {!t}. *)
Expand All @@ -236,21 +234,20 @@ val latest_distros : t list
(** Enumeration of the latest stable (ideally LTS) supported distributions. *)

val master_distro : t
(** The distribution that is the top-level alias for the [latest] tag
in the [ocaml/opam2] Docker Hub build. *)
(** The distribution that is the top-level alias for the [latest] tag in the
[ocaml/opam2] Docker Hub build. *)

val builtin_ocaml_of_distro : t -> string option
(** [builtin_ocaml_of_distro t] will return the OCaml version
supplied with the distribution packaging, and [None] if there
is no supported version. *)
(** [builtin_ocaml_of_distro t] will return the OCaml version supplied with the
distribution packaging, and [None] if there is no supported version. *)

val human_readable_string_of_distro : t -> string
(** [human_readable_string_of_distro t] returns a human readable
version of the distribution tag, including version information. *)
(** [human_readable_string_of_distro t] returns a human readable version of the
distribution tag, including version information. *)

val human_readable_short_string_of_distro : t -> string
(** [human_readable_short_string_of_distro t] returns a human readable
short version of the distribution tag, excluding version information. *)
(** [human_readable_short_string_of_distro t] returns a human readable short
version of the distribution tag, excluding version information. *)

type package_manager =
[ `Apk (** Alpine Apk *)
Expand Down Expand Up @@ -278,59 +275,56 @@ val tag_of_distro : t -> string
(** [tag_of_distro t] convert a distribution [t] to a Docker Hub tag. *)

val distro_of_tag : string -> t option
(** [distro_of_tag s] parses [s] into a {!t} distribution, and
[None] otherwise. *)
(** [distro_of_tag s] parses [s] into a {!t} distribution, and [None] otherwise.
*)

val latest_tag_of_distro : t -> string
(** [latest_tag_of_distro distro] will generate a Docker Hub
tag that is a convenient short form for the latest stable
release of a particular distribution. This tag will be
regularly rewritten to point to any new releases of the
distribution. *)
(** [latest_tag_of_distro distro] will generate a Docker Hub tag that is a
convenient short form for the latest stable release of a particular
distribution. This tag will be regularly rewritten to point to any new
releases of the distribution. *)

val base_distro_tag : ?arch:Ocaml_version.arch -> t -> string * string
(** [base_distro_tag ?arch t] will return a tuple of a Docker Hub
user/repository and tag for which the base image of a distribution
can be found (e.g. [opensuse/leap],[15.0] which maps to [opensuse/leap:15.0]
on the Docker Hub). This base image is in turn can be used to generate opam
and other OCaml tool Dockerfiles. [arch] defaults to [x86_64] and can vary
the base user/repository since some architecture are built elsewhere. *)
user/repository and tag for which the base image of a distribution can be
found (e.g. [opensuse/leap],[15.0] which maps to [opensuse/leap:15.0] on the
Docker Hub). This base image is in turn can be used to generate opam and
other OCaml tool Dockerfiles. [arch] defaults to [x86_64] and can vary the
base user/repository since some architecture are built elsewhere. *)

(** {2 CPU architectures} *)

val distro_arches : Ocaml_version.t -> t -> Ocaml_version.arch list
(** [distro_arches ov t] returns the list of architectures that
distribution [t] is supported on for OCaml compiler version [ov] *)
(** [distro_arches ov t] returns the list of architectures that distribution [t]
is supported on for OCaml compiler version [ov] *)

val distro_supported_on : Ocaml_version.arch -> Ocaml_version.t -> t -> bool
(** [distro_supported_on arch ov distro] returns [true] if the
combination of CPU [arch], compiler version [ov] is available
on the distribution [distro]. *)
(** [distro_supported_on arch ov distro] returns [true] if the combination of
CPU [arch], compiler version [ov] is available on the distribution [distro].
*)

(** {2 Opam build infrastructure support} *)

val active_distros : Ocaml_version.arch -> t list
(** [active_distros arch] returns the list of currently supported
distributions in the opam build infrastructure. Distributions
that are end-of-life upstream will rotate out of this list
regularly. *)
(** [active_distros arch] returns the list of currently supported distributions
in the opam build infrastructure. Distributions that are end-of-life
upstream will rotate out of this list regularly. *)

val active_tier1_distros : Ocaml_version.arch -> t list
(** Tier 1 distributions are those supported for the full matrix
of compiler versions in the opam build infrastructure.
The {{:https://github.com/ocurrent/docker-base-images}Docker base images}
will compile a base image for every OCaml version, so this
list should be added to sparingly. *)
(** Tier 1 distributions are those supported for the full matrix of compiler
versions in the opam build infrastructure. The
{{:https://github.com/ocurrent/docker-base-images}Docker base images} will
compile a base image for every OCaml version, so this list should be added
to sparingly. *)

val active_tier2_distros : Ocaml_version.arch -> t list
(** Tier 2 distributions are those supported for a limited set
of compiler versions in the opam build infrastructure. The
distros in this list are also tested for packages in the
opam repository. *)
(** Tier 2 distributions are those supported for a limited set of compiler
versions in the opam build infrastructure. The distros in this list are also
tested for packages in the opam repository. *)

val active_tier3_distros : Ocaml_version.arch -> t list
(** Tier 3 distributions are those supported for a limited set
of compiler versions in the opam build infrastructure. While
these distros will have base images compiled for them, they
are not widely tested. Distros maybe here as they are on the
way to being deprecated, or new and still experimental. *)
(** Tier 3 distributions are those supported for a limited set of compiler
versions in the opam build infrastructure. While these distros will have
base images compiled for them, they are not widely tested. Distros maybe
here as they are on the way to being deprecated, or new and still
experimental. *)
4 changes: 2 additions & 2 deletions src-opam/dockerfile_opam.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

(** Rules for generating Dockerfiles involving OPAM.
These are deployed at {{:https://hub.docker.com/r/ocaml/opam}ocaml/opam}
on the Docker Hub. The interfaces here may change as the production deployments
These are deployed at {{:https://hub.docker.com/r/ocaml/opam}ocaml/opam} on
the Docker Hub. The interfaces here may change as the production deployments
there change, so please contact [[email protected]] if you depend on these
functions for your own infrastructure. *)

Expand Down
Loading

0 comments on commit 84a5759

Please sign in to comment.