How can you tell if a compiler is a patched version?

If I run ocaml switch list-available, I get something like:

ocaml-base-compiler                    4.12.0
          Official release 4.12.0
ocaml-system                           4.12.0
          The OCaml compiler (system version, from outside of
          opam)
ocaml-variants                         4.12.0+options
          Official release of OCaml 4.12.0
ocaml-variants                         4.12.1+trunk
          Latest 4.12 development
ocaml-base-compiler                    4.13.0~alpha1
          First alpha release of OCaml 4.13.0
ocaml-variants                         4.13.0~alpha1+options
          First alpha release of OCaml 4.13.0
ocaml-variants                         4.13.0+trunk
          Latest 4.13 developmet
ocaml-variants                         4.14.0+trunk
          Current trunk
...

How can I tell which one of these is patched? Im not sure what that means.

Im trying to generate a list of the last patched compiler for each version.
These are the compilers I have tested:

(lang dune 1.0)
;; This file is used by `make all-supported-ocaml-versions`
(context (opam (switch 4.02.3)))
(context (opam (switch 4.03.0)))
(context (opam (switch 4.04.2)))
(context (opam (switch 4.05.0)))
(context (opam (switch 4.06.1)))
(context (opam (switch 4.07.0)))
(context (opam (switch 4.07.1)))
(context (opam (switch 4.08.0)))
(context (opam (switch 4.08.1)))
(context (opam (switch 4.09.0)))
(context (opam (switch 4.09.1)))
(context (opam (switch 4.10.0)))
(context (opam (switch 4.10.1)))
(context (opam (switch 4.10.2)))
(context (opam (switch 4.11.0)))
(context (opam (switch 4.11.1)))
(context (opam (switch 4.11.2)))
(context (opam (switch 4.12.0)))

I would like to change this to reflect the last patched compiler.

Thank you.

Since OCaml 4.03.0, the compiler follows partially the semantic versioning scheme: the patch version is the last number of the version string. Thus the last patched version of each release is

  • 4.03.0
  • 4.04.2
  • 4.05.0
  • 4.06.1
  • 4.07.1
  • 4.08.1
  • 4.09.1
  • 4.10.2
  • 4.11.2
  • 4.12.0
1 Like

We need something similar for all of OCaml CI pipelines. We use the ocaml-version library to track all of the compiler information we need (often pinned or submoduled rather than waiting for a release). So the list you were after (maybe) would be:

Ocaml_version.Releases.recent;;

- : Ocaml_version.t list =
[4.02.3; 4.03.0; 4.04.2; 4.05.0; 4.06.1; 4.07.1; 4.08.1; 4.09.1; 4.10.2;
 4.11.2; 4.12.0]

The repository stays fairly up to date given it underpins these pipelines. I’m not entirely sure I followed quite what you are after or if using OCaml programmatically to make this list is even possible in your problem, but maybe you’ll find something useful in this library :))

2 Likes

@octachron you have provided the definition of patch! Thank you.
@patricoferris I will check out this lib for the hell of it. Might be useful. Seems esy enough to find the last patch number by looking though, right?

While we are at it. Am i wrong in assuming that a major version then is indicated by the x.xx digits in x.xx.xx?

Just realized you typed out the actual info, @octachron. Thank you for taking the time.

1 Like

Glad you got the solution you were after :))

You’re not wrong, the main problem ocaml-version solves for us is that it acts as a single source of truth that can be updated once rather than going around all of the different projects and making the same changes to all of them. It also makes it easier to handle complexity in pipelines, for example the docker base images where we also need to ask questions like “is this linux distribution supported on this compiler version?”.

I’m not very familiar with semantic versioning (or how it is used by the compiler maintainers), but from the semantic versioning site the version number is MAJOR.MINOR.PATCH (incidentally ocaml-version has corresponding functions to get each of these from a given version of OCaml). I don’t know how tightly the compiler follows the rules to bump each of these to the next version.

Appreciate you taking a look at the library, hopefully others might find it useful too.

OCaml version numbers are of the form major.minor.patch+extra, where the patch and extra fields are optional.

source

For future reference.