From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id A45975D4 for ; Tue, 16 Feb 2021 13:53:55 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.81,183,1610406000"; d="scan'208,217";a="493282016" Received: from prod-listesu18.inria.fr (HELO sympa.inria.fr) ([128.93.162.160]) by mail2-relais-roc.national.inria.fr with ESMTP; 16 Feb 2021 14:53:53 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id EDEC3E037D; Tue, 16 Feb 2021 14:53:53 +0100 (CET) Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 914B4E0210 for ; Tue, 16 Feb 2021 14:53:47 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.81,183,1610406000"; d="scan'208,217";a="373225640" Received: from cbg35-2-78-242-14-140.fbx.proxad.net (HELO set) ([78.242.14.140]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 14:53:46 +0100 From: Alan Schmitt To: "lwn" , "cwn" , caml-list@inria.fr, comp@lists.orbitalfox.eu Date: Tue, 16 Feb 2021 14:53:46 +0100 Message-ID: <87sg5wt8yd.fsf@m4x.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-=-=" Subject: [Caml-list] Attn: Development Editor, Latest OCaml Weekly News Reply-To: Alan Schmitt X-Loop: caml-list@inria.fr X-Sequence: 18401 Errors-To: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello Here is the latest OCaml Weekly News, for the week of February 09 to 16, 2021. Table of Contents =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80 opam 2.0.8 release opam 2.1.0~beta4 Set up OCaml 1.1.6 Set up OCaml 1.1.7 Old CWN opam 2.0.8 release =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90 Archive: R. Boujbel announced =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80 We are pleased to announce the minor release of [opam 2.0.8]. This new version contains some fixes, mainly for sandbox and fish scripts. You can find more information in this [blog post], and more detailed in the [release note]. /opam is a source-based package manager for OCaml. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow./ [opam 2.0.8] [blog post] [release note] opam 2.1.0~beta4 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90 Archive: David Allsopp announced =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80 On behalf of the opam team, it gives me great pleasure to announce the third beta release of opam 2.1. Don=E2=80=99t worry, you didn=E2=80=99t m= iss beta3 - we had an issue with a configure script that caused beta2 to report as beta3 in some instances, so we skipped to beta4 to avoid any further confusion! We encourage you to try out this new beta release: there are instructions for doing so in [our wiki]. The instructions include taking a backup of your `~/.opam' root as part of the process, which can be restored in order to wind back. _Please note that local switches which are written to by opam 2.1 are upgraded and will need to be rebuilt if you go back to opam 2.0_. This can either be done by removing `_opam' and repeating whatever you use in your build process to create the switch, or you can use `opam switch export switch.export' to backup the switch to a file before installing new packages. Note that opam 2.1 _shouldn=E2=80=99t_ upgrade a local switch u= nless you upgrade the base packages (i.e. the compiler). [our wiki] What=E2=80=99s new in opam 2.1? =E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2= =95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95= =8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C =E2=80=A2 Switch invariants =E2=80=A2 Improved options configuration (see the new `option' and expand= ed `var' sub-commands) =E2=80=A2 Integration of system dependencies (formerly the opam-depext plugin), increasing their reliability as it integrates the solving step =E2=80=A2 Creation of lock files for reproducible installations (formerly= the opam-lock plugin) =E2=80=A2 CLI versioning, allowing cleaner deprecations for opam now and = also improvements to semantics in future without breaking backwards-compatibility =E2=80=A2 Performance improvements to opam-update, conflict messages, and= many other areas =E2=80=A2 New plugins: opam-compiler and opam-monorepo Switch invariants =E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2= =94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94= =84 In opam 2.0, when a switch is created the packages selected are put into the =E2=80=9Cbase=E2=80=9D of the switch. These packages are not nor= mally considered for upgrade, in order to ease pressure on opam=E2=80=99s solver. This was a much bigger concern early on in opam 2.0=E2=80=99s development, but is less of a problem with the default mccs solver. However, it=E2=80=99s a problem for system compilers. opam would detect t= hat your system compiler version had changed, but be unable to upgrade the ocaml-system package unless you went through a slightly convoluted process with `--unlock-base'. In opam 2.1, base packages have been replaced by switch invariants. The switch invariant is a package formula which must be satisfied on every upgrade and install. All existing switches=E2=80=99 ba= se packages could just be expressed as `package1 & package2 & package3' etc. but opam 2.1 recognises many existing patterns and simplifies them, so in most cases the invariant will be `"ocaml-base-compiler" {=3D 4.11.1}', etc. This means that `opam switch create my_switch ocaml-system' now creates a _switch invariant_ of `"ocaml-system"' rather than a specific version of the `ocaml-system' package. If your system OCaml package is updated, `opam upgrade' will seamlessly switch to the new package. This also allows you to have switches which automatically install new point releases of OCaml. For example: =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 opam switch create ocaml-4.11 --formula=3D'"ocaml-base-compiler= " {>=3D "4.11.0" & < "4.12.0~"}' =E2=94=82 --repos=3Dold=3Dgit+https://github.com/ocaml/opam-repository#a1= 1299d81591 =E2=94=82 opam install utop =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 Creates a switch with OCaml 4.11.0 (the `--repos=3D' was just to select a version of opam-repository from before 4.11.1 was released). Now issue: =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 opam repo set-url old git+https://github.com/ocaml/opam-reposit= ory =E2=94=82 opam upgrade =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80 and opam 2.1 will automatically offer to upgrade OCaml 4.11.1 along with a rebuild of the switch. There=E2=80=99s not yet a clean CLI for specifying the formula, but we intend to iterate further on this with future opam releases so that there is an easier way of saying =E2=80=9Cin= stall OCaml 4.11.x=E2=80=9D. opam depext integration =E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2= =94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94= =84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84 opam has long included the ability to install system dependencies automatically via the [depext plugin]. This plugin has been promoted to a native feature of opam 2.1.0 onwards, giving the following benefits: =E2=80=A2 You no longer have to remember to run `opam depext', opam always checks depexts (there are options to disable this or automate it for CI use). Installation of an opam package in a CI system is now as easy as `opam install .', without having to do the dance of `opam pin add -n/depext/install'. Just one command now for the common case! =E2=80=A2 The solver is only called once, which both saves time and also stabilises the behaviour of opam in cases where the solver result is not stable. It was possible to get one package solution for the `opam depext' stage and a different solution for the `opam install' stage, resulting in some depexts missing. =E2=80=A2 opam now has full knowledge of depexts, which means that packag= es can be automatically selected based on whether a system package is already installed. For example, if you have *neither* MariaDB nor MySQL dev libraries installed, `opam install mysql' will offer to install `conf-mysql' and `mysql', but if you have the MariaDB dev libraries installed, opam will offer to install `conf-mariadb' and `mysql'. [depext plugin] opam lock files and reproducibility =E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2= =94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94= =84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84= =E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2= =94=84=E2=94=84 When opam was first released, it had the mission of gathering together scattered OCaml source code to build a [community repository]. As time marches on, the size of the opam repository has grown tremendously, to over 3000 unique packages with over 18000 unique versions. opam looks at all these packages and is designed to solve for the best constraints for a given package, so that your project can keep up with releases of your dependencies. While this works well for libraries, we need a different strategy for projects that need to test and ship using a fixed set of dependencies. To satisfy this use-case, opam 2.0.0 shipped with support for _using_ `project.opam.locked' files. These are normal opam files but with exact versions of dependencies. The lock file can be used as simply as `opam install . --locked' to have a reproducible package installation. With opam 2.1.0, the creation of lock files is also now integrated into the client: =E2=80=A2 `opam lock' will create a `.locked' file for your current switc= h and project, that you can check into the repository. =E2=80=A2 `opam switch create . --locked' can be used by users to reprodu= ce your dependencies in a fresh switch. This lets a project simultaneously keep up with the latest dependencies (without lock files) while providing a stricter set for projects that need it (with lock files). [community repository] CLI Versioning =E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2= =94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84 A new `--cli' switch was added to the first beta release, but it=E2=80=99s only now that it=E2=80=99s being widely used. opam is a complex enough sy= stem that sometimes bug fixes need to change the semantics of some commands. For example: =E2=80=A2 `opam show --file' needed to change behaviour =E2=80=A2 The addition of new controls for setting global variables means= that the `opam config' was becoming cluttered and some things want to move to `opam var' =E2=80=A2 `opam switch create 4.11.1' still works in opam 2.0, but it=E2= =80=99s really an OPAM 1.2.2 syntax. Changing the CLI is exceptionally painful since it can break scripts and tools which themselves need to drive `opam'. CLI versioning is our attempt to solve this. The feature is inspired by the `(lang dune ...)' stanza in `dune-project' files which has allowed the Dune project to rename variables and alter semantics without requiring every single package using Dune to upgrade their `dune' files on each release. Now you can specify which version of opam you expected the command to be run against. In day-to-day use of opam at the terminal, you wouldn=E2=80=99t specify it, and you=E2=80=99ll get the latest version of= the CLI. For example: `opam var --global' is the same as `opam var --cli=3D2.1 --global'. However, if you issue `opam var --cli=3D2.0 --global', you will told that `--global' was added in 2.1 and so is not available to you. You can see similar things with the renaming of `opam upgrade --unlock-base' to `opam upgrade --update-invariant'. The intention is that `--cli' should be used in scripts, user guides (e.g. blog posts), and in software which calls opam. The only decision you have to take is the _oldest_ version of opam which you need to support. If your script is using a new opam 2.1 feature (for example `opam switch create --formula=3D') then you simply don=E2=80=99t support = opam 2.0. If you need to support opam 2.0, then you can=E2=80=99t use `--formu= la' and should use `--packages' instead. opam 2.0 does not have the `--cli' option, so for opam 2.0 instead of `--cli=3D2.0' you should set the environment variable `OPAMCLI' to `2.0'. As with _all_ opam command line switches, `OPAMCLI' is simply the equivalent of `--cli' which opam 2.1 will pick-up but opam 2.0 will quietly ignore (and, as with other options, the command line takes precedence over the environment). Note that opam 2.1 sets `OPAMCLI=3D2.0' when building packages, so on the rare instances where you need to use the `opam' command in a _package_ `build:' command (or in your build system), you _must_ specify `--cli=3D2.1' if you=E2=80=99re using new features. There=E2=80=99s even more detail on this feature [in our wiki]. We=E2=80= =99re still finalising some details on exactly how `opam' behaves when `--cli' is not given, but we=E2=80=99re hoping that this feature will make it much e= asier in future releases for opam to make required changes and improvements to the CLI without breaking existing set-ups and tools. [in our wiki] What=E2=80=99s new since the last beta? =E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2= =95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95= =8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C= =E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C =E2=80=A2 opam now uses CLI versioning ([#4385]) =E2=80=A2 opam now exits with code 31 if all failures were during fetch operations ([#4214]) =E2=80=A2 `opam install' now has a `--download-only' flag ([#4036]), allo= wing opam=E2=80=99s caches to be primed =E2=80=A2 `opam init' now advises the correct shell-specific command for = `eval $(opam env)' ([#4427]) =E2=80=A2 `post-install' hooks are now allowed to modify or remove instal= led files ([#4388]) =E2=80=A2 New package variable `opamfile-loc' with the location of the installed package opam file ([#4402]) =E2=80=A2 `opam update' now has `--depexts' flag ([#4355]), allowing the system package manager to update too =E2=80=A2 depext support NetBSD and DragonFlyBSD added ([#4396]) =E2=80=A2 The format-preserving opam file printer has been overhauled ([#3993], [#4298] and [#4302]) =E2=80=A2 pins are now fetched in parallel ([#4315]) =E2=80=A2 `os-family=3Dubuntu' is now treated as `os-family=3Ddebian' ([#= 4441]) =E2=80=A2 `opam lint' now checks that strings in filtered package formula= e are booleans or variables ([#4439]) and many other bug fixes as listed [on the release page]. [#4385] [#4214] [#4036] [#4427] [#4388] [#4402] [#4355] [#4396] [#3993] [#4298] [#4302] [#4315] [#4441] [#4439] [on the release page] New Plugins =E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2= =95=8C=E2=95=8C=E2=95=8C Several features that were formerly plugins have been integrated into opam 2.1.0. We have also developed some _new_ plugins that satisfy emerging workflows from the community and the core OCaml team. They are available for use with the opam 2.1 beta as well, and feedback on them should be directed to the respective GitHub trackers for those plugins. opam compiler =E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2= =94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84 The [`opam compiler'] plugin can be used to create switches from various sources such as the main opam repository, the ocaml-multicore fork, or a local development directory. It can use Git tag names, branch names, or PR numbers to specify what to install. Once installed, these are normal opam switches, and one can install packages in them. To iterate on a compiler feature and try opam packages at the same time, it supports two ways to reinstall the compiler: either a safe and slow technique that will reinstall all packages, or a quick way that will just overwrite the compiler in place. [`opam compiler'] opam monorepo =E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84=E2= =94=84=E2=94=84=E2=94=84=E2=94=84=E2=94=84 The [`opam monorepo'] plugin lets you assemble standalone dune workspaces with your projects and all of their opam dependencies, letting you build it all from scratch using only Dune and OCaml. This satisfies the =E2=80=9Cmonorepo=E2=80=9D workflow which is commonly reque= sted by large projects that need all of their dependencies in one place. It is also being used by projects that need global cross-compilation for all aspects of a codebase (including C stubs in packages), such as the MirageOS unikernel framework. [`opam monorepo'] Next Steps =E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2= =95=8C=E2=95=8C This is anticipated to be the final beta in the 2.1 series, and we will be moving to release candidate status after this. We could really use your help with testing this release in your infrastructure and projects and let us know if you run into any blockers. If you have feature requests, please also report them on [our issue tracker] =E2=80= =93 we will be planning the next release cycle once we ship opam 2.1.0 shortly. [our issue tracker] Set up OCaml 1.1.6 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90 Archive: Sora Morimoto announced =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80 This release includes a change to make the OCaml CI workflow on Windows faster! I tested this on one of my repos where the build itself is mere seconds. Before this change, setup-ocaml needed an average of 5:39 to install OCaml+opam and 1:53 to build the dependencies of the library. After this change, it needs an average of 3:15 for the installation and 1:27 for the deps. Changed =E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C =E2=80=A2 Windows installs Cygwin to `D:\cygwin', using faster Azure temp= orary storage. Set up OCaml 1.1.7 =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2= =95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90 Archive: Sora Morimoto announced =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80 Changed =E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C=E2=95=8C =E2=80=A2 Ubuntu and macOS runners no longer display "No switch is curren= tly installed." before building the compiler. =E2=80=A2 Ubuntu no longer installs the system ocaml packages. =E2=80=A2 macOS no longer builds two compilers on every run. =E2=80=A2 Upgrade opam to 2.0.8 for Linux VMs. Old CWN =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90 If you happen to miss a CWN, you can [send me a message] and I'll mail it to you, or go take a look at [the archive] or the [RSS feed of the archives]. If you also wish to receive it every week by mail, you may subscribe [online]. [Alan Schmitt] [send me a message] [the archive] [RSS feed of the archives] [online] [Alan Schmitt] --=-=-= Content-Type: text/html; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable OCaml Weekly News

OCaml Weekly News

Previous Week<= /a> Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of February 09 to 16, 20= 21.

opam 2.0.8 release

R. Boujbel announced

We are pleased to announce the minor release of opam 2.0.8.

This new version contains some fixes, mainly for sandbox and fish scripts. = You can find more information in this blog post, and more = detailed in the release note.

opam is a source-based package manager for OCaml. It supports multiple s= imultaneous compiler installations, flexible package constraints, and a Git= -friendly development workflow.

opam 2.1.0~beta4

David Allsopp announced

On behalf of the opam team, it gives me great pleasure to announce the thir= d beta release of opam 2.1. Don=E2=80=99t worry, you didn=E2=80=99t miss beta3 - we had an issue with a configure script tha= t caused beta2 to report as beta3 in some instances, so we skipped to beta4 to avoid any further confusion!

We encourage you to try out this new beta release: there are instructions f= or doing so in our wiki. The instructions include taking a backup of your ~/.opam root as part of the process, which can be restore= d in order to wind back. Please note that local switches which are written to by opam 2.1 are upgraded and will need to be = rebuilt if you go back to opam 2.0. This can either be done by removing _opam and repeating whatever yo= u use in your build process to create the switch, or you can use opam switch export switch.export to backup the swi= tch to a file before installing new packages. Note that opam 2.1 shouldn=E2=80=99t upgrade a = local switch unless you upgrade the base packages (i.e. the compiler).

What=E2=80=99s new in opam 2.1?

  • Switch invariants
  • Improved options configuration (see the new option and exp= anded var sub-commands)
  • Integration of system dependencies (formerly the opam-depext plugin), i= ncreasing their reliability as it integrates the solving step
  • Creation of lock files for reproducible installations (formerly the opa= m-lock plugin)
  • CLI versioning, allowing cleaner deprecations for opam now and also imp= rovements to semantics in future without breaking backwards-compatibility
  • Performance improvements to opam-update, conflict messages, and many ot= her areas
  • New plugins: opam-compiler and opam-monorepo
Switch invariants

In opam 2.0, when a switch is created the packages selected are put into th= e =E2=80=9Cbase=E2=80=9D of the switch. These packages are not normally considered for upgrade, in order to ease pressure on opam=E2= =80=99s solver. This was a much bigger concern early on in opam 2.0=E2=80=99s development, but is less of a problem with the def= ault mccs solver.

However, it=E2=80=99s a problem for system compilers. opam would detect tha= t your system compiler version had changed, but be unable to upgrade the ocaml-system package unless you went through a slight= ly convoluted process with --unlock-base.

In opam 2.1, base packages have been replaced by switch invariants. The swi= tch invariant is a package formula which must be satisfied on every upgrade and install. All existing switches=E2=80= =99 base packages could just be expressed as package1 & package2 & package3 etc. but opam 2.1 recog= nises many existing patterns and simplifies them, so in most cases the invariant will be "ocaml-base-compiler" {=3D 4.11.1}= , etc. This means that opam switch create my_switch ocaml-system now creates a switch invarian= t of "ocaml-system" rather than a specific version of t= he ocaml-system package. If your system OCaml package is updated,= opam upgrade will seamlessly switch to the new package.

This also allows you to have switches which automatically install new point= releases of OCaml. For example:

opam switch create ocaml-4.11 --formula=3D'"ocaml-base-compiler" {>=3D "=
4.11.0" & < "4.12.0~"}'
--repos=3Dold=3Dgit+https://github.com/ocaml/opam-repository#a11299d81591
opam install utop

Creates a switch with OCaml 4.11.0 (the --repos=3D was just to= select a version of opam-repository from before 4.11.1 was released). Now issue:

opam repo set-url old git+https://github.com/ocaml/opam-repository
opam upgrade

and opam 2.1 will automatically offer to upgrade OCaml 4.11.1 along with a = rebuild of the switch. There=E2=80=99s not yet a clean CLI for specifying the formula, but we intend to iterate further on t= his with future opam releases so that there is an easier way of saying =E2=80=9Cinstall OCaml 4.11.x=E2=80=9D.

opam depext integration

opam has long included the ability to install system dependencies automatic= ally via the depext plugin. This plugin has been promoted to a native feature of opam 2.1.0 onwards, giving the following benefits:

  • You no longer have to remember to run opam depext, opam al= ways checks depexts (there are options to disable this or automate it for C= I use). Installation of an opam package in a CI system is now as easy as opam install ., without having to do the dance of opam pin= add -n/depext/install. Just one command now for the common case!
  • The solver is only called once, which both saves time and also stabilis= es the behaviour of opam in cases where the solver result is not stable. It= was possible to get one package solution for the opam depext = stage and a different solution for the opam install stage, res= ulting in some depexts missing.
  • opam now has full knowledge of depexts, which means that packages can b= e automatically selected based on whether a system package is already insta= lled. For example, if you have neither MariaDB nor MySQL dev librari= es installed, opam install mysql will offer to install c= onf-mysql and mysql, but if you have the MariaDB dev li= braries installed, opam will offer to install conf-mariadb and= mysql.
CLI Versioning

A new --cli switch was added to the first beta release, but it= =E2=80=99s only now that it=E2=80=99s being widely used. opam is a complex enough system that sometimes bug fixes need to change the semantics= of some commands. For example:

  • opam show --file needed to change behaviour
  • The addition of new controls for setting global variables means that th= e opam config was becoming cluttered and some things want to m= ove to opam var
  • opam switch create 4.11.1 still works in opam 2.0, but it= =E2=80=99s really an OPAM 1.2.2 syntax.

Changing the CLI is exceptionally painful since it can break scripts and to= ols which themselves need to drive opam. CLI versioning is our attempt to solve this. The feature is inspired by the= (lang dune ...) stanza in dune-project files which has allowed the Dune project to renam= e variables and alter semantics without requiring every single package using Dune to upgrade their dune files on= each release.

Now you can specify which version of opam you expected the command to be ru= n against. In day-to-day use of opam at the terminal, you wouldn=E2=80=99t specify it, and you=E2=80=99ll get the l= atest version of the CLI. For example: opam var --global is the same as opam var --cli=3D2.1 --global. However, if you = issue opam var --cli=3D2.0 --global, you will told that --global was added in 2.1 and so is not available to you. You = can see similar things with the renaming of opam upgrade --unlock-base to opam upgrade --update-invariant.

The intention is that --cli should be used in scripts, user gu= ides (e.g. blog posts), and in software which calls opam. The only decision you have to take is the o= ldest version of opam which you need to support. If your script is using a new opam 2.1 feature (for example opam switch create --formul= a=3D) then you simply don=E2=80=99t support opam 2.0. If you need to support opam 2.0, then you can=E2=80=99t use --formula and should use --packages instead. opam 2.0 does not have the --cli option, so for opam 2.0 instead of --cli= =3D2.0 you should set the environment variable OPAMCLI = to 2.0. As with all opam command= line switches, OPAMCLI is simply the equivalent of --cl= i which opam 2.1 will pick-up but opam 2.0 will quietly ignore (and, as with other options, the c= ommand line takes precedence over the environment).

Note that opam 2.1 sets OPAMCLI=3D2.0 when building packages, = so on the rare instances where you need to use the opam command in a package build: command (or in your build system), you must specify --cli=3D2.1 if you=E2=80=99re using new features.

There=E2=80=99s even more detail on this feature in our wiki. We=E2=80=99re still finalising some details on exactly how opam behaves when --cli is not given,= but we=E2=80=99re hoping that this feature will make it much easier in future releases for opam to make required changes and improvements to the C= LI without breaking existing set-ups and tools.

What=E2=80=99s new since the last beta?

  • opam now uses CLI versioning (#4385)
  • opam now exits with code 31 if all failures were during fetch operation= s (#4214)
  • opam install now has a --download-only flag (= #4036), allowing = opam=E2=80=99s caches to be primed
  • opam init now advises the correct shell-specific command f= or eval $(opam env) (#4427)
  • post-install hooks are now allowed to modify or remove ins= talled files (#4388= )
  • New package variable opamfile-loc with the location of the= installed package opam file (#4402)
  • opam update now has --depexts flag (#4355), allowing the sys= tem package manager to update too
  • depext support NetBSD and DragonFlyBSD added (#4396)
  • The format-preserving opam file printer has been overhauled (#3993, #4298 and #4302)
  • pins are now fetched in parallel (#4315)
  • os-family=3Dubuntu is now treated as os-family=3Ddeb= ian (#4441)<= /li>
  • opam lint now checks that strings in filtered package form= ulae are booleans or variables (#4439)

and many other bug fixes as listed on the release page.

New Plugins

Several features that were formerly plugins have been integrated into opam = 2.1.0. We have also developed some new plugins that satisfy emerging workflows from the community and the core OCa= ml team. They are available for use with the opam 2.1 beta as well, and feedback on them should be directed to the r= espective GitHub trackers for those plugins.

opam compiler

The opam comp= iler plugin can be used to create switches from various sources such as the main opam repository, the ocaml-multicore fork, or a lo= cal development directory. It can use Git tag names, branch names, or PR numbers to specify what to install.

Once installed, these are normal opam switches, and one can install package= s in them. To iterate on a compiler feature and try opam packages at the same time, it supports two ways to rei= nstall the compiler: either a safe and slow technique that will reinstall all packages, or a quick way that will j= ust overwrite the compiler in place.

opam monorepo

The opam monor= epo plugin lets you assemble standalone dune workspaces with your projects and all of their opam dependencies, letting you build it= all from scratch using only Dune and OCaml. This satisfies the =E2=80=9Cmonorepo=E2=80=9D workflow which is comm= only requested by large projects that need all of their dependencies in one place. It is also being used by projects that need glob= al cross-compilation for all aspects of a codebase (including C stubs in packages), such as the MirageOS unikernel fr= amework.

Next Steps

This is anticipated to be the final beta in the 2.1 series, and we will be = moving to release candidate status after this. We could really use your help with testing this release in your infra= structure and projects and let us know if you run into any blockers. If you have feature requests, please also report= them on our issue tracker – we will be planning the next release cycle once we shi= p opam 2.1.0 shortly.

Set up OCaml 1.1.6

Sora Morimoto announced

This release includes a change to make the OCaml CI workflow on Windows fas= ter!

I tested this on one of my repos where the build itself is mere seconds. Be= fore this change, setup-ocaml needed an average of 5:39 to install OCaml+opam and 1:53 to build the dependencies of= the library. After this change, it needs an average of 3:15 for the installation and 1:27 for the deps.

Changed

  • Windows installs Cygwin to D:\cygwin, using faster Azure t= emporary storage.

https:/= /github.com/avsm/setup-ocaml/releases/tag/v1.1.6

Set up OCaml 1.1.7

Sora Morimoto announced

Changed

  • Ubuntu and macOS runners no longer display "No switch is currently inst= alled." before building the compiler.
  • Ubuntu no longer installs the system ocaml packages.
  • macOS no longer builds two compilers on every run.
  • Upgrade opam to 2.0.8 for Linux VMs.

https:/= /github.com/avsm/setup-ocaml/releases/tag/v1.1.7

Old CWN

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a loo= k at the archive or the <= a href=3D"https://alan.petitepomme.net/cwn/cwn.rss">RSS feed of the archive= s.

If you also wish to receive it every week by mail, you may subscribe online.

--=-=-=--