Skip to content

Commit 27f43e4

Browse files
committed
Correct active_distros lists
1 parent e3af0ba commit 27f43e4

File tree

1 file changed

+43
-25
lines changed

1 file changed

+43
-25
lines changed

lib_spec_opam/distro.ml

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,9 @@ let resolve_alias (d : t) : distro =
5757
| `Macos (`Latest | `V13) -> `Macos `V13
5858
| `Macos `V12 -> `Macos `V12
5959

60-
let distro_status (d : t) : status =
61-
match d with
62-
| #D.t -> failwith "Using extended [distro_status] with non-MacOS distro. Use [D.distro_status] instead."
63-
| `Macos _ ->
64-
let resolved = resolve_alias d in
65-
if (resolved : distro :> t) <> d then `Alias else `Active `Tier2
60+
let distro_status_extended (d : t) : status =
61+
let resolved = resolve_alias d in
62+
if (resolved : distro :> t) <> d then `Alias else `Active `Tier2
6663

6764
let latest_distros = (D.latest_distros :> t list) @ [ `Macos `Latest ]
6865

@@ -84,31 +81,52 @@ let distro_active_for arch (d : t) =
8481
| _ -> distro_supported_on arch OV.Releases.latest d
8582

8683
let active_distros arch =
87-
List.filter
88-
(fun d -> match distro_status d with `Active _ -> true | _ -> false)
89-
distros
90-
|> List.filter (distro_active_for arch)
84+
let extended_distros =
85+
List.filter
86+
(fun d ->
87+
match distro_status_extended d with
88+
| `Active _ -> true
89+
| _ -> false)
90+
macos_distros
91+
|> List.filter (distro_active_for arch)
92+
in
93+
(D.active_distros arch :> t list) @ extended_distros
9194

9295
let active_tier1_distros arch =
93-
List.filter
94-
(fun d ->
95-
match distro_status d with `Active `Tier1 -> true | _ -> false)
96-
distros
97-
|> List.filter (distro_active_for arch)
96+
let extended_distros =
97+
List.filter
98+
(fun d ->
99+
match distro_status_extended d with
100+
| `Active `Tier1 -> true
101+
| _ -> false)
102+
macos_distros
103+
|> List.filter (distro_active_for arch)
104+
in
105+
(D.active_tier1_distros arch :> t list) @ extended_distros
98106

99107
let active_tier2_distros arch =
100-
List.filter
101-
(fun d ->
102-
match distro_status d with `Active `Tier2 -> true | _ -> false)
103-
distros
104-
|> List.filter (distro_active_for arch)
108+
let extended_distros =
109+
List.filter
110+
(fun d ->
111+
match distro_status_extended d with
112+
| `Active `Tier2 -> true
113+
| _ -> false)
114+
macos_distros
115+
|> List.filter (distro_active_for arch)
116+
in
117+
(D.active_tier2_distros arch :> t list) @ extended_distros
105118

106119
let active_tier3_distros arch =
107-
List.filter
108-
(fun d ->
109-
match distro_status d with `Active `Tier3 -> true | _ -> false)
110-
distros
111-
|> List.filter (distro_active_for arch)
120+
let extended_distros =
121+
List.filter
122+
(fun d ->
123+
match distro_status_extended d with
124+
| `Active `Tier3 -> true
125+
| _ -> false)
126+
macos_distros
127+
|> List.filter (distro_active_for arch)
128+
in
129+
(D.active_tier3_distros arch :> t list) @ extended_distros
112130

113131
let builtin_ocaml_of_distro (d : t) =
114132
match d with #D.t as d -> D.builtin_ocaml_of_distro d | `Macos _ -> None

0 commit comments

Comments
 (0)