2.5.0
Hi everyone,
We’re happy to announce the release of opam 2.5.0 and encourage all users to upgrade.
Note: the following section will recap the various major changes in opam 2.5.0 for anyone who haven’t already read the previous pre-release announcements. For those who did, note that nothing changed between 2.5.0~beta1 and the final 2.5.0.
What’s new? Some highlights:
- Speedup opam update up to 70%. Thanks to @arozovyk, opam update now load opam file incrementally, only parsing the files that have changed since the last time you called opam update. Before that, opam files in opam repositories were all loaded after an update if there was any change. The performance improvement of this change thus depends on how often you call opam update and what type of repository and OS you are using. (#5824)
- Improved shell integration. A number of users have been hitting issues with opam’s shell integration where parts of a previous environment was kept in the current environment, causing a number of issues. These can be triggered by, for example, nuking your opam root directory (by default
~/.opamor%LocalAppData%\opam). For this particular case we are still working on a fix, but many other users have reported similar issues without nuking their root directory and in that case we believe to have fixed the majority of issues. (dbuenzli/topkg#142, #4649, #5761) - ² We’ve also changed the default file to which opam init writes the opam shell integration to be
.bashrcinstead of the previous.profileor.bash_profilewhen bash is detected. Doing it this way prevents some issues with existing.profilefiles that source the.bashrcfile and causing an infinity loop when opam asks users to make sure to source their.bashrcfile into their.profilefile. (#5819, #4201, #3990) - The opam install script now installs an appropriate apparmor profile on systems configured with apparmor (this is enabled by default on Ubuntu). This change is not strictly speaking related to this release as it is deployed for every versions. (#5968).
- Many more UI additions and improvements, bug fixes, …
You can read our blog post for more information about these changes and more, and for even more details you can take a look at the release note or the changelog.
Try it!
The upgrade instructions are unchanged:
For Unix systems
bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.5.0"
or from PowerShell for Windows systems
Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.5.0"
Please report any issues to the bug-tracker.
Happy hacking,
<> <> The opam team <> <>
See full changelog
2.5.0:
- (no difference compared to 2.5.0~rc1)
2.5.0~rc1:
- (no difference compared to 2.5.0~beta1)
2.5.0~beta1:
- Allow the macOS sandbox to write in the
/var/folders/and/var/db/mds/directories as it is required by some of macOS core tools [#4797 @kit-ty-kate - fix #4389 #6460] - Fixed a bug occuring on version-equivalent package rename
(i.e.
pkg.00 -> pkg.0) leading to the package being completely removed [#6774 @arozovyk - fix #6754] - Stop
opam switch create --dry-runfrom creating switch root directory by stopping the creation of build directory and writing the switch-state cache [#6540 @hannesm - fix #5918] - Stop cleaning the build directory when installing packages with
--dry-run[#6540 @hannesm] - Build changes:
- Add the upcoming OCaml 5.5 (trunk) support when using dune's dev profile [#6670 @kit-ty-kate]
- opam no longer depends on
cmdliner[#6755 @kit-ty-kate - fix #6425] - Clean variables before calling
makeon different projects (e.g. downlodad-if-missing OCaml compiler) to avoid clashes with other variables set by these projects [#6769 @kit-ty-kate] - Improve the release script:
- Fix the placement of the vendored archives in the release tarball [#6765 @kit-ty-kate - fix #6762]
- Fix the Windows build [#6769 @kit-ty-kate]
- Improve and extend the testsuite [#6540 #6774 @arozovyk @kit-ty-kate]
- Improve and extend the test infrastructure [#6732 @kit-ty-kate]
- API changes in
opam-state: OpamRepositoryState.load_opams_from_diff: track added packages to avoid removing version-equivalent packages [#6774 @arozovyk - fix #6754]- API changes in
opam-core: OpamCmdlinerwas added. It is the new internal interface forCmdliner, accessible through a newopam-core.cmdlinersub-library, however it is meant for internal use only. [#6755 @kit-ty-kate]
2.5.0~alpha1:
- Implement incremental opam file loading to process only changed files during repository updates and repository state loading [#6614 @arozovyk - fix #5824]
- The
variables.*shscript used for shell hooks now only updates the environment ifOPAM_SWITCH_PREFIXis unset-or-empty [#6729 @dra27 - fix dbuenzli/topkg#142, #4649, #5761] - Default to the
.bashrcfile instead of the.profilewhen writing the shell hook withbashduringopam init[#6603 @kit-ty-kate - fix #5819 #4201 #3990] - Remove
getconffrom the list of required runtime tools, which allowsopam initto work out-of-the-box on Haiku [#6634 @kit-ty-kate - fix #6632] - Archives without checksums now fetch only once per call of
opam installif their url match [#6627 @psafont - fix #5638] - Do not ignore extra-files whose name is invalid and fail early in that case [#6679 @rjbou @kit-ty-kate]
- Refine the specification of
pkg:opamfilevariable and update its computation accordingly [#6659 @kit-ty-kate - fix #5346] - Make global option
default-invariantmodifiable [#6730 @rjbou] - Raise a warning instead of a fatal uncaught exception when an item of
extra-filesis missing [#6696 @rjbou] - No longer ignore
extra-fileswhose name is invalid and raise a warning in that case [#6679 @rjbou @kit-ty-kate] - csh: Don't double-set unconditional variables in
variables.cshandenv_hook.csh[#6729 @dra27] - The
shell/install.shscript now installs an appropriate apparmor profile on systems configured with apparmor [#6647 @kit-ty-kate - fix #5968] - Improve the UI:
- Show the invalid character when detecting an erroneous package name [#6638 @lefessan - fix #6396]
- Improve the error messages on
opam source, especially in case ofFailure[#6696 @rjbou] - The name of missing or erroneous
extra-filesare now displayed instead of their path in error messages [#6679 @kit-ty-kate @rjbou] - Remove duplicated directory separator when displaying some rare filenames [#6703 @rjbou]
- Handle non-displayable characters when detecting an erroneous package name or version [#6640 @kit-ty-kate]
- More fine grained error message in
opam installin case of bad hash or missingextra-fileserror (and remove raw fatal error) [#6696 @rjbou] - Update warning messages when the git remote is not found and when skipping local pins [#6422 @rjbou]
- Add an upgrade advice if the repository is 1.2 version, for all
opam admincommands exceptupgrade[#6385 @rjbou] - Bug fixes:
- Fix erroneous recompilations on opam files with empty but present
build/runtest/install/removefield [#6505 @kit-ty-kate - fix #5814] - Fix parsing of
OPAMFETCH(support quotes / proper POSIX shell syntax) [#5492 @kit-ty-kate - fix #5490] - Fix
opam remove --forcethat was launching commands in current directory [#6672 @rjbou - fix #6570] - Fix
opam lock's error message on pinned packages with no git remote by handling exit code 2 fromgit remote get-url[#6422 @rjbou] - Fix
opam install pkg --depext-onlyexiting with code 0 instead of 20 (not found) [#6516 @rjbou - fix #6488] - Fix the false-positive mismatch debug warning during
opam updatewhen faced with nested extra-files on Windows [#6715 @kit-ty-kate] - Check the status of git submodules when checking if a repository is up-to-date [#6132 @kit-ty-kate]
- Harden the parsing of
apk policyon Alpine [#6742 @kit-ty-kate] - Build changes:
- Update the dependency constraint on
patchto now require its stable version [#6663 @kit-ty-kate] - Update the download-if-missing dependencies to their latest version (re.1.14.0, dune.3.20.2, menhir.20250903) [#6700 @kit-ty-kate]
- Remove
seqfrom the list of packages to download-if-missing as it is no longer a dependency ofre[#6700 @kit-ty-kate] ./configure --enable-staticis now supported on OpenBSD [#6705 @flumf]- Add missing constraints to avoid cmdliner 2.0.0 [#6707 @kit-ty-kate]
- Add patch library dependency to opam-state [#6614 @arozovyk]
- Update the bootstrap compiler's flexdll to 0.44 [#6592 @MisterDA]
- Update the
msvs-detectscript used on Windows during compiler bootstrap to 0.7.0 [#6592 @MisterDA] - Improve the release script:
- The OpenBSD binary now a full static binary [#6705 @flumf @kit-ty-kate - fix #6241]
- The release archive (
opam-full-*.tar.gz) is now reproducible [#6706 @kit-ty-kate - fix #6619] - Various internal changes:
- Replace every polymorphic uses of
List.memby a version that doesn't useRepr.equal[#6644 @kit-ty-kate] - Simplify the
src_ext/update-sources.shscript [#6701 @kit-ty-kate] - Homogeneise verbose command output between sandboxed and non sandboxed one [#6675 @rjbou]
- Add the
install-pin-depends,ignore-pin-depends,proceed-actionsandswitch-clean-upnamed questions (for opam developers use only) [#6611 @kit-ty-kate @rjbou] - Add logging for file reads and writes [#6679 @rjbou]
- Add cli version 2.5 [#6709 @kit-ty-kate]
- Add mechanism for the
OPAMAUTOANSWERenvironment variable (for opam developers use only) [#6709 @kit-ty-kate] - Complete upgrade mechanism to permit on the fly upgrade and write upgrade from repo and switch level [#6416 @rjbou]
- Enforce repository root check for every
opam admincommands [#6385 @rjbou] - Improve and extend the testsuite [#6673 #6450 #6638 #6627 #6640 #6671 #6690 #6688 #6691 #6659 #6659 #6675 #6715 #6614 #6719 #6611 #6679 #6153 #6516 #6672 #6741 #6729 #6505 #6422 #5492 #6385 @rjbou @kit-ty-kate @arozovyk @dra27]
- Improve and extend the benchmarks [#6681 @arozovyk]
- Improve and extend the test infrastructure [#6624 #6450 #6663 #6675 #6710 #6708 #6734 #6643 #6652 #6648 #6582 #6394 #6656 #6655 #6657 #6666 #6676 #6701 #6741 #6745 @kit-ty-kate @rjbou @arozovyk]
- Improve and extend the documentation [#6620 #6631 #6650 #6653 #6653 #6596 #6364 #6660 @kit-ty-kate @jmid @gahr @mbarbin @arozovyk]
- API changes in
opam-client: OpamAdminRepoUpgrade: addupgradefrom_versionthat have version "1.2" hardcoded [#6391 @rjbou]OpamClientConfig.opam_init: now takes an optionalauto_answerargument [#6709 @kit-ty-kate]- API changes in
opam-repository: OpamLocal.rsync_*: change the return type fromOpamFilename.*tounit[#6658 @kit-ty-kate]OpamRepository.update: changed the'Changesreturn type to includePatch.operation listof changes. [#6614 @arozovyk]OpamRepositoryBackend.updatetype : include thePatch.t listinUpdate_patchvariant [#6614 @arozovyk]OpamRepositoryBackend.get_diff: includePatch.t listin the return type (along withfilename) [#6614 @arozovyk]- API changes in
opam-state: OpamRepositoryState: addload_opams_from_diffto update package definitions based on file change operations (diff) [#6614 @arozovyk]OpamRepositoryState.get_repo_files: was added [#6679 @kit-ty-kate @rjbou]OpamSwitchState.files: was removed [#6662 @kit-ty-kate]OpamSwitchState.overlay_opam_file: was added [6679 @rjbou]- API changes in
opam-format: OpamFile.OPAM.get_metadata_dir: was removed [#6679 @kit-ty-kate]OpamFile.OPAM.get_extra_files: no longer takes a namedrepos_rootsargument and instead takes a namedget_repo_filesargument. It also now returns the content of the files instead of their path [#6679 @kit-ty-kate @rjbou]OpamFormula: addequalfunction forOpamFormula.t[#6730 @rjbou]OpamFormula.equal_relop: was added [#6644 @kit-ty-kate]OpamTypesBase.{action,pkg_flag,simple_arg,arg,filter,command}_equal: were added [#6644 @kit-ty-kate]OpamVariable.variable_contents_equal: was added [#6644 @kit-ty-kate]- API changes in
opam-core: OpamConsole.confirm: now takes an optionalnameargument (for opam developers use only) [#6709 @kit-ty-kate]OpamConsole.log: does not keep log messages before initialization if the code is ran through a library [#6487 @kit-ty-kate]OpamCoreConfig.auto_answer: field and arguments were added [#6709 @kit-ty-kate]OpamCoreConfig.{answer,anwser_is,answer_is_yes}: now take anamelabeled argument (for opam developers use only) [#6709 @kit-ty-kate]OpamCoreConfig.in_opam: was added [#6487 @kit-ty-kate]OpamCompat.Lazy: addmap_val[#6679 @rjbou]OpamCompat.List.fold_left_map: was added [#6442 @kit-ty-kate]OpamCompat.List.equal: was added [#6644 @kit-ty-kate]OpamCompat.Map.filter_map: was added [#6442 @kit-ty-kate]OpamCompat.MAP: was added [#6442 @kit-ty-kate]OpamCompat.Pair.equal: was added [#6644 @kit-ty-kate]OpamCompat.String.{starts_with,ends_with,for_all,fold_left}: were added [#6442 @kit-ty-kate]OpamFilename.create: deduplicate the directory separator character when the basename starts with one [#6703 @rjbou]OpamFilename: addparse_patchthat preprocesses and parses a patch file. [#6614 @arozovyk]OpamFilename.patch: use variants to make the input eitherFilename.tor reusePatch.diffsdirectly. Remove the?preprocessargument since the preprocess logic is moved to theOpamFilename.parse_patchfunction that is called only inOpamVCS(mirroring the previous logic). [#6614 @arozovyk]OpamHash.check_string: was added [#6661 @kit-ty-kate]OpamHash.equal_kind: was added [#6644 @kit-ty-kate]OpamShellCommand: create the module and addof_string[#5492 @kit-ty-kate]OpamStd.Char: Create the module and exportis_whitespace[#5492 @kit-ty-kate]OpamStd.Config.auto_answer: was added (for opam developers use only) [#6709 @kit-ty-kate]OpamStd.List.fold_left_map: was moved toOpamCompat.List.fold_left_map[#6442 @kit-ty-kate]OpamStd.List.{cons,find_opt,filter_map}: were removed. UseStdlib.Listinstead. [#6442 @kit-ty-kate]OpamStd.List.mem: was added, having as argument the equality function [#6644 @kit-ty-kate]OpamStd.Map.filter_map: is now the implementation fromStdlib.Mapwhen using OCaml >= 4.11 [#6442 @kit-ty-kate]OpamStd.Map.{find_opt,choose_opt,fold,map,mapi}: are now the implementation fromStdlib.Map[#6442 @kit-ty-kate]OpamStd.Op.{(@@),(|>)}: were removed. UseStdlibinstead. [#6442 @kit-ty-kate]OpamStd.Option.{map,iter,compare,equal,to_string,some}: were removed. UseStdlib.Optioninstead. [#6442 @kit-ty-kate]OpamStd.Set.{map,choose_opt,fold}: are now the implementation fromStdlib.Set[#6442 @kit-ty-kate]OpamStd.String.contains_char: was removed. UseStdlib.String.containsinstead. [#6442 @kit-ty-kate]OpamStd.String.map: was removed. UseStdlib.String.mapinstead. [#6442 @kit-ty-kate]OpamStd.String.{starts_with,ends_with,for_all,fold_left}: were moved toOpamCompat.String[#6442 @kit-ty-kate]OpamSystem.cpu_count: now uses a C binding instead of system utilities to get the number of cores of the current machine [#6634 @kit-ty-kate]OpamSystem.is_reg_dir: is now exposed, which returnstrueonly if its parameter is a directory, exists and is not a symlink. It returnsfalseotherwise [#6450 @kit-ty-kate]OpamSystem.patch: change the signature to work directly withPatch.diffs(implementation is now the previouslyinternal_patchfunction), parsing is now done separately. [#6614 @arozovyk]OpamSystem: add lower-levelparse_patchthat preprocesses and parses a patch file. [#6614 @arozovyk]