opam
opam copied to clipboard
Sort `opam upgrade` output by semver(-ish) versioning breakdown: major, non-major
At the moment, the output of an opam upgrade
can be somewhat overwhelming on a large project.
When analyzing this before pressing y
, I find myself overwhelmingly doing one thing: comparing version numbers.
A computer is a lot more efficient, and less error-prone, at checking version numbers. :P
I propose that the summaries of actions-to-take (if larger than some threshold π) group their output first by lose semver assumptions, before display to the user:
The following actions will be performed:
Major (or beta-minor) version changes:
β upgrade conf-libcurl 1 to 2
β install merlin-lib 4.6-414 [required by dot-merlin-reader]
β upgrade redis 0.5 to 0.6
β upgrade eqaf 0.8 to 0.9
β upgrade rpclib 8.1.2 to 9.0.0
β upgrade redis-lwt 0.5 to 0.6
β upgrade sedlex 2.6 to 3.0
β install icalendar 0.1.6 [required by <... snip ...>]
β upgrade sqlgg 20220401+git to 20220831+git
β upgrade ppx_deriving_rpc 8.1.2 to 9.0.0
Minor and patch changes:
β upgrade ocamlfind 1.9.3 to 1.9.5
β upgrade omake 0.10.3 to 0.10.5
β upgrade xdg 3.1.0 to 3.2.0
β upgrade sexplib0 v0.15.0 to v0.15.1
β upgrade re 1.10.3 to 1.10.4
<... snip ...>
β upgrade ca-certs 0.2.2 to 0.2.3
β upgrade conduit-lwt-unix 5.1.0 to 5.1.1
β upgrade aws-s3 4.6.0 to 4.7.0
β upgrade aws-s3-lwt 4.6.0 to 4.7.0
No-op recompilations:
β» recompile ocaml-base-compiler 4.14.0 [upstream or system changes]
β» recompile ocaml-config 2 [uses ocaml-base-compiler]
β» recompile ocaml 4.14.0 [uses ocaml-base-compiler]
β» recompile seq base [uses ocaml]
<... snip ...>
β» recompile ppx_jane v0.15.0 [uses dune]
β» recompile int_repr v0.15.0 [uses dune]
β» recompile base_bigstring v0.15.0 [uses dune]
β» recompile core v0.15.0 [uses sexplib, jst-config, dune]
β» recompile core_kernel v0.15.0 [uses dune]
β» recompile re2 v0.15.0 [uses dune]
===== β 2 β» 238 β 8 β 45 =====
Do you want to continue? [Y/n]
To anticipate some feedback and agree with it β this feature is a footgun, if the OCaml ecosystem isn't reasonably careful as a whole about our semver. My recollection is of there being some pushback and 'who cares' about semver a few years ago, last time I read anything on this topic; but it does seem to have gained some additional support β and fwiw, @Khady has convinced me to open this issue anyway. π
Which version of opam are you using? Have you tried with opam master? (see https://github.com/ocaml/opam/pull/5045)
Hm, that seems almost like β¦ the opposite of this?
Well, not quite, on second glance β but the important part here is definitely the semver-analysis, not the sorting out of recompilations or installations
Thinking about it again, it seems rather "easy to do" on top the current code. Essentially youβre just asking for the new upgrades <n> packages
section to be split into two:
- one for major bumps (
upgrades <n> packages (major)
) - one for minor/patch bumps (
upgrades <n> packages (minor/patch)
)
Weβve talked about in the dev meeting and weβd be happy to review a PR for that if you have time to make one.