Skip to content

Commit 75a01e6

Browse files
committed
Remove opam 2.0 support
The service config pins V2_5 for every build platform and lint.ml uses V2_2; nothing constructs V2_0, so the V2_0 cases in Variant.pp, the opam_build depext match, and Opam_version.of_string were never executed. Variant.pp also drops the V2_0-as-empty-suffix special case, so all variants now print with an explicit _opam-X.X suffix. That in turn makes two more pieces of API redundant: - Opam_version.default -- referenced only by Variant.of_string as a fallback for un-suffixed variant strings. Now that nothing emits un-suffixed strings, of_string rejects them outright. - Opam_version.to_string_with_patch -- declared in the .mli, called nowhere. Prepares for ocurrent/docker-base-images#342 and upstream ocurrent/ocaml-dockerfile#262 to remove the opam-2.0 base images. Deploy-safe in any order: V2_5 platforms pull the same _opam-2.5 tag before and after, and V2_0 was already unused.
1 parent bc61053 commit 75a01e6

5 files changed

Lines changed: 4 additions & 23 deletions

File tree

lib/opam_build.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,6 @@ let install_project_deps ~opam_version ~opam_files ~selection =
182182
let non_root_pkgs = String.concat " " non_root_pkgs in
183183
let opam_depext =
184184
match opam_version with
185-
| `V2_0 ->
186-
run ~network ~cache "opam depext --update -y %s $DEPS"
187-
compatible_root_pkgs
188185
| `V2_1 ->
189186
run ~network ~cache
190187
"opam update --depexts && opam install --cli=2.1 --depext-only -y %s \

lib/opam_version.ml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
1-
type t = [ `V2_0 | `V2_1 | `V2_2 | `V2_3 | `V2_4 | `V2_5 ]
1+
type t = [ `V2_1 | `V2_2 | `V2_3 | `V2_4 | `V2_5 ]
22
[@@deriving ord, yojson, eq]
33

44
let to_string = function
5-
| `V2_0 -> "2.0"
65
| `V2_1 -> "2.1"
76
| `V2_2 -> "2.2"
87
| `V2_3 -> "2.3"
98
| `V2_4 -> "2.4"
109
| `V2_5 -> "2.5"
1110

12-
let to_string_with_patch = function
13-
| `V2_0 -> "2.0.10"
14-
| `V2_1 -> "2.1.6"
15-
| `V2_2 -> "2.2.1"
16-
| `V2_3 -> "2.3.0"
17-
| `V2_4 -> "2.4.1"
18-
| `V2_5 -> "2.5.0"
19-
2011
let pp = Fmt.of_to_string to_string
21-
let default = `V2_0
2212

2313
let of_string = function
24-
| "2.0" -> Ok `V2_0
2514
| "2.1" -> Ok `V2_1
2615
| "2.2" -> Ok `V2_2
2716
| "2.3" -> Ok `V2_3

lib/opam_version.mli

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
(** Opam versions supported. *)
22

3-
type t = [ `V2_0 | `V2_1 | `V2_2 | `V2_3 | `V2_4 | `V2_5 ]
3+
type t = [ `V2_1 | `V2_2 | `V2_3 | `V2_4 | `V2_5 ]
44
[@@deriving ord, yojson, eq]
55

66
val pp : t Fmt.t
77
val to_string : t -> string
8-
val to_string_with_patch : t -> string
9-
val default : t
108
val of_string : string -> (t, [ `Msg of string ]) result

lib/variant.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,7 @@ let pp f t =
8181
(match t.arch with
8282
| `X86_64 -> ""
8383
| a -> "_" ^ Ocaml_version.to_opam_arch a)
84-
(match t.opam_version with
85-
| `V2_0 -> ""
86-
| v -> "_opam-" ^ Opam_version.to_string v)
84+
("_opam-" ^ Opam_version.to_string t.opam_version)
8785

8886
let to_string = Fmt.str "%a" pp
8987
let err_variant id = failwith ("internal error: unknown variant " ^ id)
@@ -101,7 +99,7 @@ let opam_version_of_string v =
10199
let of_string s =
102100
let s, opam_version =
103101
match Astring.String.cut ~rev:true ~sep:"_opam-" s with
104-
| None -> (s, Opam_version.default)
102+
| None -> err_opam_version s
105103
| Some (s, v) -> (s, opam_version_of_string v)
106104
in
107105
let id, arch =

test/service/test_variant.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ let test_simple () =
1414
[
1515
"debian-11-4.13_x86_32_opam-2.1";
1616
"debian-11-4.13_opam-2.1";
17-
"debian-11-4.13_x86_32";
1817
]
1918

2019
let test_errors () =

0 commit comments

Comments
 (0)