Feedback on this post is welcomed on Discuss!
As mentioned in our talk at the OCaml Workshop 2024, we decided to switch to a time-based release cycle (every 6 months), starting with opam 2.3.
As promised, we are very pleased to announce the release of opam 2.3.0, and encourage all users to upgrade. Please read on for installation and upgrade instructions.
Try it!
In case you plan a possible rollback, you may want to first backup your
~/.opam
or $env:LOCALAPPDATA\opam
directory.
The upgrade instructions are unchanged:
- Either from binaries: run
For Unix systems
bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh)"
or from PowerShell for Windows systems
Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) }"
or download manually from the Github "Releases" page to your PATH.
- Or from source, manually: see the instructions in the README.
You should then run:
opam init --reinit -ni
Major breaking change: extra-files
When loading a repository, opam now ignores files in packages' files/
directories which aren't listed in the extra-files
field of the opam file.
This was done to simplify the opam specification where we hope the opam file to be the only thing that you have to look at when reading a package specification. It being optional to list all files in the extra-files:
field went against that principle. This change also reduces the surface area for potential file corruption as all extra-files must have checksums.
This is a breaking change and means that if you are using the files/
directory without listing them in the extra-files:
field, you need to make sure that all files in that directory are included in the extra-files
field.
The resulting opam file remains compatible with all previous opam 2.x releases.
If you have an opam repository, you should make sure all files are listed so every packages continues to work without any issue, which can be done automatically using the opam admin update-extrafiles
command.
Major changes
-
Packages requiring an unsupported version of opam are now marked unavailable, instead of causing a repository error. This means an opam repository can now allow smoother upgrade in the future where some packages can require a newer version of opam without having to fork the repository to upgrade every package to that version as was done for the upgrade from opam 1.2 to 2.0
-
Add a new
opam list --latests-only
option to list only the latest versions of packages. Note that this option respects the order options were given on the command line. For example:--available --latests-only
will first list all the available packages, then choose only the latest packages in that set; while--latests-only --available
will first list all the latest packages, then only show the ones that are available in that set -
Fix and improve
opam install --check
, which now checks if the whole dependency tree of the package is installed instead of only the root dependencies -
Add a new
--verbose-on
option to enable verbose output for specified package names. Thanks to @desumn for this contribution -
Add a new
opam switch import --deps-only
option to install only the dependencies of the root packages listed in the opam switch export file -
opam switch list-available
no longer displays compilers flagged withavoid-version
/deprecated
unless--all
is given, meaning that pre-release or unreleased OCaml packages no longer appear to be the latest version -
opam switch create --repositories
now correctly infers--kind=git
for URLs ending with.git
rather than requiring thegit+https://
protocol. This is consistant with other commands such asopam repository add
. Thanks to @Keryan-dev for this contribution -
opam switch set-invariant
now displays the switch invariant using the same syntax as the--formula
flag -
The
builtin-0install
solver was improved and should now be capable of being your default solver instead ofbuiltin-mccs+glpk
. It was previously mostly only suited for automated tasks such as Continuous Integration. If you wish to give it a try, simply callingopam option solver=builtin-0install
(callopam option solver=
restores the default) -
Most of the unhelpful conflict messages were fixed. (#4373)
-
Fix an opam 2.1 regression where the initial pin of a local VCS directory would store untracked and ignored files. Those files would usually be cleaned before building the package, however git submodules would not be cleaned and would cause issues when paired with the new behaviour added in 2.3.0~alpha1 which makes opam error when git submodules fail to update (it was previously a warning). (#5809)
-
Fix the value of the
arch
variable when the current OS is 32bit on a 64bit machine (e.g. Raspberry Pi OS). (#5949) -
opam now fails when git submodules fail to update instead of ignoring the error and just showing a warning
-
opam's libraries now compile with OCaml >= 5.0 on Windows
-
Fix the installed packages internal cache, which was storing the wrong version of the opam file after a build failure. This could be triggered easily for users with custom repositories with non-populated extra-files. (#6213)
-
Several improvements to the pre-built release binaries were made:
- The Linux binaries are now built on Alpine 3.20
- The FreeBSD binary is now built on FreeBSD 14.1
- The OpenBSD binary is now built on OpenBSD 7.6 and loses support for OpenBSD 7.5 and earlier
- Linux/riscv64 and NetBSD/x86_64 binaries are now available
And many other general, performance and UI improvements were made and bugs were fixed. You can take a look to previous blog posts. API changes and a more detailed description of the changes are listed in:
- the release note for 2.3.0~alpha1
- the release note for 2.3.0~beta1
- the release note for 2.3.0~beta2
- the release note for 2.3.0~rc1
- the release note for 2.3.0
This release also includes PRs improving the documentation and improving and extending the tests.
Please report any issues to the bug-tracker.
We hope you will enjoy the new features of opam 2.3!