From b0a119d58d8820d79e79ec6e7566cbd21a8cdf7f Mon Sep 17 00:00:00 2001 From: benmandrew Date: Fri, 7 Apr 2023 15:18:42 +0200 Subject: [PATCH 1/3] Add distro.ml in obuilder-spec-opam package --- dune-project | 19 ++++ lib_spec_opam/distro.ml | 154 ++++++++++++++++++++++++++++ lib_spec_opam/distro.mli | 132 ++++++++++++++++++++++++ lib_spec_opam/dune | 10 ++ lib_spec_opam/obuilder_spec_opam.ml | 1 + obuilder-spec-opam.opam | 53 ++++++++++ 6 files changed, 369 insertions(+) create mode 100644 lib_spec_opam/distro.ml create mode 100644 lib_spec_opam/distro.mli create mode 100644 lib_spec_opam/dune create mode 100644 lib_spec_opam/obuilder_spec_opam.ml create mode 100644 obuilder-spec-opam.opam diff --git a/dune-project b/dune-project index ac2cf888..0adab4b7 100644 --- a/dune-project +++ b/dune-project @@ -55,3 +55,22 @@ ppx_deriving ppx_sexp_conv (ocaml (>= 4.10.2)))) + +(package + (name obuilder-spec-opam) + (synopsis "Build specification format -- opam support") + (description + "A library for constructing, reading and writing OBuilder build specification files.") + (depends + (fmt (>= 0.8.9)) + sexplib + astring + dockerfile-opam + ppx_deriving + ppx_deriving_yojson + ppx_sexp_conv + (ocaml (>= 4.10.0)) + (ocaml-version (>= 3.6.0)) + (opam-format (>= 2.1.0)) + (obuilder-spec (= :version)) + (alcotest-lwt :with-test))) diff --git a/lib_spec_opam/distro.ml b/lib_spec_opam/distro.ml new file mode 100644 index 00000000..29719a6b --- /dev/null +++ b/lib_spec_opam/distro.ml @@ -0,0 +1,154 @@ +module OV = Ocaml_version +module D = Dockerfile_opam.Distro + +type distro = [ D.distro | `Macos of [ `V12 | `V13 ] ] [@@deriving sexp] +type t = [ D.t | `Macos of [ `Latest | `V12 | `V13 ] ] [@@deriving sexp] +type os_family = [ D.os_family | `Macos ] [@@deriving sexp] + +let os_family_of_distro (t : t) : os_family = + match t with + | #D.t as f -> (D.os_family_of_distro f :> os_family) + | `Macos _ -> `Macos + +let os_family_to_string (os : os_family) = + match os with + | #D.os_family as os -> D.os_family_to_string os + | `Macos -> "macos" + +let opam_repository (os : os_family) = + match os with + | #D.os_family as os -> D.opam_repository os + | `Macos -> "https://github.com/ocaml/opam-repository.git" + +type status = + [ `Deprecated + | `Active of [ `Tier1 | `Tier2 | `Tier3 ] + | `Alias + | `Not_available ] +[@@deriving sexp] + +let macos_distros = [ `Macos `V12; `Macos `V13 ] +let distros = (D.distros :> t list) @ macos_distros + +let resolve_alias (d : t) : distro = + match d with + | #D.t as d -> (D.resolve_alias d :> distro) + | `Macos (`Latest | `V13) -> `Macos `V13 + | `Macos `V12 -> `Macos `V12 + +let distro_status (d : t) : status = + match d with + | #D.t -> failwith "Using extended [distro_status] with non-MacOS distro. Use [D.distro_status] instead." + | `Macos _ -> + let resolved = resolve_alias d in + if (resolved : distro :> t) <> d then `Alias else `Active `Tier2 + +let latest_distros = (D.latest_distros :> t list) @ [ `Macos `Latest ] +let master_distro = (D.master_distro :> t) + +let distro_arches ov (d : t) = + match d with + | #D.t as d -> D.distro_arches ov d + | `Macos _ when OV.(compare Releases.v4_02_0 ov) = -1 -> + [ `X86_64; `Aarch64 ] + | _ -> [ `X86_64 ] + +let distro_supported_on a ov (d : t) = List.mem a (distro_arches ov d) + +let distro_active_for arch (d : t) = + match (arch, d) with + | `X86_64, `Windows _ -> true + | _ -> distro_supported_on arch OV.Releases.latest d + +let active_distros arch = + List.filter + (fun d -> match distro_status d with `Active _ -> true | _ -> false) + distros + |> List.filter (distro_active_for arch) + +let active_tier1_distros arch = + List.filter + (fun d -> + match distro_status d with `Active `Tier1 -> true | _ -> false) + distros + |> List.filter (distro_active_for arch) + +let active_tier2_distros arch = + List.filter + (fun d -> + match distro_status d with `Active `Tier2 -> true | _ -> false) + distros + |> List.filter (distro_active_for arch) + +let active_tier3_distros arch = + List.filter + (fun d -> + match distro_status d with `Active `Tier3 -> true | _ -> false) + distros + |> List.filter (distro_active_for arch) + +let builtin_ocaml_of_distro (d : t) = + match d with #D.t as d -> D.builtin_ocaml_of_distro d | `Macos _ -> None + +let tag_of_distro (d : t) = + match d with + | #D.t as d -> D.tag_of_distro d + | `Macos (`Latest | `V13) -> "macos-homebrew-13" + | `Macos `V12 -> "macos-homebrew-12" + +let distro_of_tag x = + match D.distro_of_tag x with + | None -> ( + match x with + | "macos-homebrew-12" -> Some (`Macos `V12) + | "macos-homebrew-13" -> Some (`Macos `V13) + | "macos-homebrew" -> Some (`Macos `Latest) + | _ -> None) + | Some _ as x -> (x :> t option) + +let human_readable_string_of_distro (d : t) = + match d with + | #D.t as d -> D.human_readable_string_of_distro d + | `Macos _ as d -> ( + match resolve_alias d with + | `Macos `V12 -> "MacOS 12 (Monterey)" + | `Macos `V13 -> "MacOS 13 (Ventura)" + | _ -> failwith "Resolved to non-MacOS distro, bug in [resolve_alias]?") + +let human_readable_short_string_of_distro (d : t) = + match d with + | #D.t as d -> D.human_readable_short_string_of_distro d + | `Macos _ -> "MacOS" + +let is_same_distro (d1 : t) (d2 : t) = + match (d1, d2) with + | (#D.t as d1), (#D.t as d2) -> D.is_same_distro d1 d2 + | `Macos _, `Macos _ -> true + | _ -> false + +let latest_tag_of_distro (t : t) = + let latest = List.find (is_same_distro t) latest_distros in + tag_of_distro latest + +type package_manager = [ D.package_manager | `Homebrew ] [@@deriving sexp] + +let package_manager (d : t) : package_manager = + match d with #D.t as d -> (D.package_manager d :> package_manager) | `Macos _ -> `Homebrew + +let bubblewrap_version (d : t) = + match d with #D.t as d -> D.bubblewrap_version d | `Macos _ -> None + +let base_distro_tag ?win10_revision ?(arch = `X86_64) (d : t) = + match d with + | #D.t as d -> D.base_distro_tag ?win10_revision ~arch d + | `Macos _ as d -> ( + (* TODO There is no docker image for these yet! *) + match resolve_alias d with + | `Macos `V12 -> ("macos/monterey", "12") + | `Macos `V13 -> ("macos/ventura", "13") + | _ -> failwith "Resolved to non-MacOS distro, bug in [resolve_alias]?") + +let compare a b = + String.compare + (human_readable_string_of_distro a) + (human_readable_string_of_distro b) diff --git a/lib_spec_opam/distro.mli b/lib_spec_opam/distro.mli new file mode 100644 index 00000000..d744cccf --- /dev/null +++ b/lib_spec_opam/distro.mli @@ -0,0 +1,132 @@ +(* Distribution selections for various OPAM combinations, for Linux, Windows, and MacOS distributions *) + +open Dockerfile_opam + +type distro = [ Distro.distro | `Macos of [ `V12 | `V13 ] ] [@@deriving sexp] +(** Supported Docker container distributions without aliases. *) + +type t = [ Distro.t | `Macos of [ `Latest | `V12 | `V13 ] ] [@@deriving sexp] +(** Supported Docker container distributions with aliases. *) + +type os_family = [ Distro.os_family | `Macos ] [@@deriving sexp] +(** The operating system family a distro belongs to. *) + +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. *) + +val opam_repository : os_family -> string +(** [opam_repository os_family] returns the git URL to the default + Opam repository. *) + +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. *) + +val compare : t -> t -> int +(** [compare a b] is a lexical comparison function for {!t}. *) + +val resolve_alias : t -> distro +(** [resolve_alias t] will resolve [t] into a concrete version. This removes + versions such as [Latest]. *) + +val distros : t list +(** Enumeration of the supported Docker container distributions. *) + +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. *) + +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. *) + +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. *) + +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. *) + +type package_manager = + [ Distro.package_manager | `Homebrew (** MacOS homebrew *) ] +[@@deriving sexp] +(** The package manager used by a distro. *) + +val package_manager : t -> package_manager +(** [package_manager t] returns the type of package manager used + by that distribution. Many derived distributions (such as OracleLinux) + share the same package manager from a base distribution (such as CentOS). *) + +val bubblewrap_version : t -> (int * int * int) option +(** [bubblewrap_version t] returns the version of bubblewrap available on that + distribution. *) + +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. *) + +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. *) + +val base_distro_tag : + ?win10_revision:Distro.win10_lcu -> + ?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. *) + +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] *) + +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]. *) + +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. *) + +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. *) + +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. *) + +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. *) diff --git a/lib_spec_opam/dune b/lib_spec_opam/dune new file mode 100644 index 00000000..4ffd291f --- /dev/null +++ b/lib_spec_opam/dune @@ -0,0 +1,10 @@ +(library + (name obuilder_spec_opam) + (public_name obuilder-spec-opam) + (preprocess (pps ppx_deriving.std ppx_deriving_yojson ppx_sexp_conv)) + (libraries + dockerfile-opam + ocaml-version + obuilder-spec + sexplib + ppx_deriving_yojson.runtime)) diff --git a/lib_spec_opam/obuilder_spec_opam.ml b/lib_spec_opam/obuilder_spec_opam.ml new file mode 100644 index 00000000..f0e5cb26 --- /dev/null +++ b/lib_spec_opam/obuilder_spec_opam.ml @@ -0,0 +1 @@ +module Distro = Distro diff --git a/obuilder-spec-opam.opam b/obuilder-spec-opam.opam new file mode 100644 index 00000000..492861d5 --- /dev/null +++ b/obuilder-spec-opam.opam @@ -0,0 +1,53 @@ +# This file is generated by dune, edit dune-project instead +opam-version: "2.0" +synopsis: "Build specification format -- opam support" +description: + "A library for constructing, reading and writing OBuilder build specification files." +maintainer: ["talex5@gmail.com"] +authors: [ + "Antonin Décimo " + "Arthur Wendling " + "David Allsopp " + "Kate " + "Lucas Pluvinage " + "Mark Elvers " + "Patrick Ferris " + "Thomas Gazagnaire " + "Thomas Leonard " + "Tim McGilchrist " +] +license: "Apache-2.0" +homepage: "https://github.com/ocurrent/obuilder" +doc: "https://ocurrent.github.io/obuilder/" +bug-reports: "https://github.com/ocurrent/obuilder/issues" +depends: [ + "dune" {>= "3.7"} + "fmt" {>= "0.8.9"} + "sexplib" + "astring" + "dockerfile-opam" + "ppx_deriving" + "ppx_deriving_yojson" + "ppx_sexp_conv" + "ocaml" {>= "4.10.0"} + "ocaml-version" {>= "3.6.0"} + "opam-format" {>= "2.1.0"} + "obuilder-spec" {= version} + "alcotest-lwt" {with-test} + "odoc" {with-doc} +] +build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] +dev-repo: "git+https://github.com/ocurrent/obuilder.git" From e3af0ba6842146cc0f782e70eb9feea11788db17 Mon Sep 17 00:00:00 2001 From: benmandrew Date: Fri, 7 Apr 2023 16:31:26 +0200 Subject: [PATCH 2/3] Exposed unmodified functionality from dockerfile-opam --- lib_spec_opam/distro.ml | 33 ++++++++++++++++++++++ lib_spec_opam/distro.mli | 59 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) diff --git a/lib_spec_opam/distro.ml b/lib_spec_opam/distro.ml index 29719a6b..2aeef903 100644 --- a/lib_spec_opam/distro.ml +++ b/lib_spec_opam/distro.ml @@ -1,6 +1,14 @@ module OV = Ocaml_version module D = Dockerfile_opam.Distro +type win10_release = D.win10_release [@@deriving sexp] +type win10_ltsc = D.win10_ltsc [@@deriving sexp] +type win_all = D.win_all [@@deriving sexp] +type win10_lcu = D.win10_lcu [@@deriving sexp] + +let win10_current_lcu = D.win10_current_lcu + +type win10_revision = D.win10_revision [@@deriving sexp] type distro = [ D.distro | `Macos of [ `V12 | `V13 ] ] [@@deriving sexp] type t = [ D.t | `Macos of [ `Latest | `V12 | `V13 ] ] [@@deriving sexp] type os_family = [ D.os_family | `Macos ] [@@deriving sexp] @@ -20,6 +28,11 @@ let opam_repository (os : os_family) = | #D.os_family as os -> D.opam_repository os | `Macos -> "https://github.com/ocaml/opam-repository.git" +let personality os_family arch = + match os_family with + | #D.os_family as os_family -> D.personality os_family arch + | `Macos -> None + type status = [ `Deprecated | `Active of [ `Tier1 | `Tier2 | `Tier3 ] @@ -30,6 +43,14 @@ type status = let macos_distros = [ `Macos `V12; `Macos `V13 ] let distros = (D.distros :> t list) @ macos_distros +type win10_release_status = D.win10_release_status + +let win10_release_status = D.win10_release_status + +type win10_docker_base_image = D.win10_docker_base_image + +let win10_latest_image = D.win10_latest_image + let resolve_alias (d : t) : distro = match d with | #D.t as d -> (D.resolve_alias d :> distro) @@ -44,6 +65,8 @@ let distro_status (d : t) : status = if (resolved : distro :> t) <> d then `Alias else `Active `Tier2 let latest_distros = (D.latest_distros :> t list) @ [ `Macos `Latest ] + +let win10_latest_release = D.win10_latest_release let master_distro = (D.master_distro :> t) let distro_arches ov (d : t) = @@ -90,6 +113,14 @@ let active_tier3_distros arch = let builtin_ocaml_of_distro (d : t) = match d with #D.t as d -> D.builtin_ocaml_of_distro d | `Macos _ -> None +let win10_release_to_string = D.win10_release_to_string + +let win10_release_of_string = D.win10_release_of_string + +let win10_revision_to_string = D.win10_revision_to_string + +let win10_revision_of_string = D.win10_revision_of_string + let tag_of_distro (d : t) = match d with | #D.t as d -> D.tag_of_distro d @@ -138,6 +169,8 @@ let package_manager (d : t) : package_manager = let bubblewrap_version (d : t) = match d with #D.t as d -> D.bubblewrap_version d | `Macos _ -> None +let win10_base_tag = D.win10_base_tag + let base_distro_tag ?win10_revision ?(arch = `X86_64) (d : t) = match d with | #D.t as d -> D.base_distro_tag ?win10_revision ~arch d diff --git a/lib_spec_opam/distro.mli b/lib_spec_opam/distro.mli index d744cccf..67fffdd7 100644 --- a/lib_spec_opam/distro.mli +++ b/lib_spec_opam/distro.mli @@ -2,6 +2,18 @@ open Dockerfile_opam +type win10_release = Distro.win10_release [@@deriving sexp] + +type win10_ltsc = Distro.win10_ltsc [@@deriving sexp] + +type win_all = Distro.win_all [@@deriving sexp] + +type win10_lcu = Distro.win10_lcu [@@deriving sexp] + +val win10_current_lcu : win10_lcu + +type win10_revision = Distro.win10_revision [@@deriving sexp] + type distro = [ Distro.distro | `Macos of [ `V12 | `V13 ] ] [@@deriving sexp] (** Supported Docker container distributions without aliases. *) @@ -22,6 +34,10 @@ val opam_repository : os_family -> string (** [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]. *) + 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. *) @@ -39,6 +55,14 @@ val distros : t list val latest_distros : t list (** Enumeration of the latest stable (ideally LTS) supported distributions. *) +val win10_latest_release : win10_release +(** Latest Windows 10 release. *) + +val win10_latest_image : win10_release +(** Latest Windows 10 Docker image available. May differ from + {!win10_latest_release} if the Docker repository hasn't been + updated. *) + val master_distro : t (** The distribution that is the top-level alias for the [latest] tag in the [ocaml/opam2] Docker Hub build. *) @@ -84,6 +108,22 @@ val latest_tag_of_distro : t -> string regularly rewritten to point to any new releases of the distribution. *) +type win10_docker_base_image = Distro.win10_docker_base_image +(** Windows containers base images. + @see *) + +val win10_base_tag : + ?win10_revision:win10_lcu -> + win10_docker_base_image -> + win_all -> + string * string +(** [win10_base_tag base_image release] will return a tuple of Windows + container base image and tag for which the base image of a Windows + base image can be found (e.g. + [mcr.microsoft.com/windows/servercore],[ltsc2022] which maps to + [mcr.microsoft.com/windows/servercore:ltsc2022] on the Microsoft + Container Registry). *) + val base_distro_tag : ?win10_revision:Distro.win10_lcu -> ?arch:Ocaml_version.arch -> @@ -96,6 +136,17 @@ val base_distro_tag : and other OCaml tool Dockerfiles. [arch] defaults to [x86_64] and can vary the base user/repository since some architecture are built elsewhere. *) +val win10_release_to_string : win10_release -> string +(** [win10_release_to_string update] converts a Windows 10 version name to + string. *) + +val win10_release_of_string : string -> win_all option +(** [win10_release_of_string] converts a Windows 10 version name as + string to its internal representation. Ignores any KB number. *) + +val win10_revision_to_string : win10_revision -> string +val win10_revision_of_string : string -> win10_revision option + 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] *) @@ -105,6 +156,14 @@ val distro_supported_on : Ocaml_version.arch -> Ocaml_version.t -> t -> bool combination of CPU [arch], compiler version [ov] is available on the distribution [distro]. *) +type win10_release_status = Distro.win10_release_status +(** Windows 10 release status. *) + +val win10_release_status : win_all -> win10_release_status +(** [win10_release_status v channel] returns the Microsoft support + status of the specified Windows 10 release. + @see *) + val active_distros : Ocaml_version.arch -> t list (** [active_distros arch] returns the list of currently supported distributions in the opam build infrastructure. Distributions From 27f43e4dd19c3d302a1e0631f08bf24e5ac24371 Mon Sep 17 00:00:00 2001 From: benmandrew Date: Fri, 7 Apr 2023 16:43:59 +0200 Subject: [PATCH 3/3] Correct active_distros lists --- lib_spec_opam/distro.ml | 68 ++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/lib_spec_opam/distro.ml b/lib_spec_opam/distro.ml index 2aeef903..55be0b98 100644 --- a/lib_spec_opam/distro.ml +++ b/lib_spec_opam/distro.ml @@ -57,12 +57,9 @@ let resolve_alias (d : t) : distro = | `Macos (`Latest | `V13) -> `Macos `V13 | `Macos `V12 -> `Macos `V12 -let distro_status (d : t) : status = - match d with - | #D.t -> failwith "Using extended [distro_status] with non-MacOS distro. Use [D.distro_status] instead." - | `Macos _ -> - let resolved = resolve_alias d in - if (resolved : distro :> t) <> d then `Alias else `Active `Tier2 +let distro_status_extended (d : t) : status = + let resolved = resolve_alias d in + if (resolved : distro :> t) <> d then `Alias else `Active `Tier2 let latest_distros = (D.latest_distros :> t list) @ [ `Macos `Latest ] @@ -84,31 +81,52 @@ let distro_active_for arch (d : t) = | _ -> distro_supported_on arch OV.Releases.latest d let active_distros arch = - List.filter - (fun d -> match distro_status d with `Active _ -> true | _ -> false) - distros - |> List.filter (distro_active_for arch) + let extended_distros = + List.filter + (fun d -> + match distro_status_extended d with + | `Active _ -> true + | _ -> false) + macos_distros + |> List.filter (distro_active_for arch) + in + (D.active_distros arch :> t list) @ extended_distros let active_tier1_distros arch = - List.filter - (fun d -> - match distro_status d with `Active `Tier1 -> true | _ -> false) - distros - |> List.filter (distro_active_for arch) + let extended_distros = + List.filter + (fun d -> + match distro_status_extended d with + | `Active `Tier1 -> true + | _ -> false) + macos_distros + |> List.filter (distro_active_for arch) + in + (D.active_tier1_distros arch :> t list) @ extended_distros let active_tier2_distros arch = - List.filter - (fun d -> - match distro_status d with `Active `Tier2 -> true | _ -> false) - distros - |> List.filter (distro_active_for arch) + let extended_distros = + List.filter + (fun d -> + match distro_status_extended d with + | `Active `Tier2 -> true + | _ -> false) + macos_distros + |> List.filter (distro_active_for arch) + in + (D.active_tier2_distros arch :> t list) @ extended_distros let active_tier3_distros arch = - List.filter - (fun d -> - match distro_status d with `Active `Tier3 -> true | _ -> false) - distros - |> List.filter (distro_active_for arch) + let extended_distros = + List.filter + (fun d -> + match distro_status_extended d with + | `Active `Tier3 -> true + | _ -> false) + macos_distros + |> List.filter (distro_active_for arch) + in + (D.active_tier3_distros arch :> t list) @ extended_distros let builtin_ocaml_of_distro (d : t) = match d with #D.t as d -> D.builtin_ocaml_of_distro d | `Macos _ -> None