Skip to content

Commit

Permalink
Add missing changelog for opam 2.2.0 (#2598)
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate authored Jul 18, 2024
1 parent bc89a21 commit 9b04498
Show file tree
Hide file tree
Showing 2 changed files with 291 additions and 0 deletions.
61 changes: 61 additions & 0 deletions data/changelog/opam/2024-06-21-opam-2-2-0-rc1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: opam 2.2.0~rc1
authors: [
"Raja Boujbel",
"Kate Deplaix",
"David Allsopp",
]
description: "RC1 release of opam 2.2.0"
tags: [opam, platform]
---

_Feedback on this post is welcomed on [Discuss](https://discuss.ocaml.org/t/ann-opam-2-2-0-rc1-release/14842)!_

We are very excited to announce the first (and hopefully only) release candidate for opam 2.2.0.

We've squashed a few more bugs and we consider this to be ready for the final release. You can view the full list of changes in the [release note](https://github.com/ocaml/opam/releases/tag/2.2.0-rc1).

We invite users to test it one final time just in case there are any previously unnoticed bugs!

## Changes

* Fix `opam upgrade` wanting to keep rebuilding the compiler (as now it contains an `x-env-path-rewrite` field)
* Provide defaults so `opam init -y` no longer asks questions on Windows
* Fix `OpamConsole.menu` when there are more than 9 options (can happen on Windows)

A couple more improvements were made and bugs were fixed.
The single API change is also denoted in the
[release note](https://github.com/ocaml/opam/releases/tag/2.2.0-rc1).
This release also includes PRs extending the tests.

## 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:

1. Either from binaries: run

For Unix systems
```
bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --version 2.2.0~rc1"
```
or from PowerShell for Windows systems
```
Invoke-Expression "& { $(Invoke-RestMethod https://raw.githubusercontent.com/ocaml/opam/master/shell/install.ps1) }"
```
or download manually from [the Github "Releases" page](https://github.com/ocaml/opam/releases/tag/2.2.0-rc1) to your PATH.

2. Or from source, manually: see the instructions in the [README](https://github.com/ocaml/opam/tree/2.2.0-rc1#compiling-this-repo).


You should then run:
```
opam init --reinit -ni
```


Please report any issues to [the bug-tracker](https://github.com/ocaml/opam/issues).

Thanks for trying this new release out, and we hope you will enjoy the new features of opam 2.2!
230 changes: 230 additions & 0 deletions data/changelog/opam/2024-07-01-opam-2-2-0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
---
title: opam 2.2.0
authors: [
"Raja Boujbel",
"Kate Deplaix",
"David Allsopp",
]
description: "Release of opam 2.2.0"
tags: [opam, platform]
---

_Feedback on this post is welcomed on [Discuss](https://discuss.ocaml.org/t/ann-opam-2-2-0-is-out/14893)!_

We are very pleased to announce the release of opam 2.2.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:

1. Either from binaries: run

For Unix systems
```
bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --version 2.2.0"
```
or from PowerShell for Windows systems
```
Invoke-Expression "& { $(Invoke-RestMethod https://raw.githubusercontent.com/ocaml/opam/master/shell/install.ps1) }"
```
or download manually from [the Github "Releases" page](https://github.com/ocaml/opam/releases/tag/2.2.0) to your PATH.

2. Or from source, manually: see the instructions in the [README](https://github.com/ocaml/opam/tree/2.2.0#compiling-this-repo).


You should then run:
```
opam init --reinit -ni
```

## Changes

### Major change: Windows support

After 8 years' effort, opam and opam-repository now have official native Windows
support! A big thank you is due to Andreas Hauptmann ([@fdopen](https://github.com/fdopen)),
whose [WODI](https://github.com/fdopen/godi-repo) and [OCaml for Windows](https://fdopen.github.io/opam-repository-mingw/)
projects were for many years the principal downstream way to obtain OCaml on
Windows, Jun Furuse ([@camlspotter](https://github.com/camlspotter)) whose
[initial experimentation with OPAM from Cygwin](https://inbox.vuxu.org/caml-list/CAAoLEWsQK7=qER66Uixx5pq4wLExXovrQWM6b69_fyMmjYFiZA@mail.gmail.com/)
formed the basis of opam-repository-mingw, and, most recently,
Jonah Beckford ([@jonahbeckford](https://github.com/JonahBeckford)) whose
[DkML](https://diskuv.com/dkmlbook/) distribution kept - and keeps - a full
development experience for OCaml available on Windows.

OCaml when used on native Windows requires certain tools from the Unix world
which are provided by either [Cygwin](https://cygwin.com) or [MSYS2](https://msys2.org).
We have engineered `opam init` so that it is possible for a user not to need to
worry about this, with `opam` managing the Unix world, and the user being able
to use OCaml from either the Command Prompt or PowerShell. However, for the Unix
user coming over to Windows to test their software, it is also possible to have
your own Cygwin/MSYS2 installation and use native Windows opam from that. Please
see the [previous blog post](https://opam.ocaml.org/blog/opam-2-2-0-windows/)
for more information.

There are two "ports" of OCaml on native Windows, referred to by the name of
provider of the C compiler. The mingw-w64 port is [GCC-based](https://www.mingw-w64.org/).
opam's external dependency (depext) system works for this port (including
providing GCC itself), and many packages are already well-supported in
opam-repository, thanks to the previous efforts in [opam-repository-mingw](https://github.com/fdopen/opam-repository-mingw).
The MSVC port is [Visual Studio-based](https://visualstudio.microsoft.com/). At
present, there is less support in this ecosystem for external dependencies,
though this is something we expect to work on both in opam-repository and in
subsequent opam releases. In particular, it is necessary to install
Visual Studio or Visual Studio BuildTools separately, but opam will then
automatically find and use the C compiler from Visual Studio.

### Major change: opam tree / opam why

`opam tree` is a new command showing packages and their dependencies with a tree view.
It is very helpful to determine which packages bring which dependencies in your installed switch.
```
$ opam tree cppo
cppo.1.6.9
├── base-unix.base
├── dune.3.8.2 (>= 1.10)
│ ├── base-threads.base
│ ├── base-unix.base [*]
│ └── ocaml.4.14.1 (>= 4.08)
│ ├── ocaml-base-compiler.4.14.1 (>= 4.14.1~ & < 4.14.2~)
│ └── ocaml-config.2 (>= 2)
│ └── ocaml-base-compiler.4.14.1 (>= 4.12.0~) [*]
└── ocaml.4.14.1 (>= 4.02.3) [*]
```

Reverse-dependencies can also be displayed using the new `opam why` command.
This is useful to examine how dependency versions get constrained.
```
$ opam why cmdliner
cmdliner.1.2.0
├── (>= 1.1.0) b0.0.0.5
│ └── (= 0.0.5) odig.0.0.9
├── (>= 1.1.0) ocp-browser.1.3.4
├── (>= 1.0.0) ocp-indent.1.8.1
│ └── (>= 1.4.2) ocp-index.1.3.4
│ └── (= version) ocp-browser.1.3.4 [*]
├── (>= 1.1.0) ocp-index.1.3.4 [*]
├── (>= 1.1.0) odig.0.0.9 [*]
├── (>= 1.0.0) odoc.2.2.0
│ └── (>= 2.0.0) odig.0.0.9 [*]
├── (>= 1.1.0) opam-client.2.2.0~alpha
│ ├── (= version) opam.2.2.0~alpha
│ └── (= version) opam-devel.2.2.0~alpha
├── (>= 1.1.0) opam-devel.2.2.0~alpha [*]
├── (>= 0.9.8) opam-installer.2.2.0~alpha
└── user-setup.0.7
```

> Special thanks to [@cannorin](https://github.com/cannorin) for contributing this feature.
### Major change: with-dev-setup

There is now a way for a project maintainer to share their project development
tools: the `with-dev-setup` dependency flag. It is used in the same way as
`with-doc` and `with-test`: by adding a `{with-dev-setup}` filter after a
dependency. It will be ignored when installing normally, but it's pulled in when the
package is explicitly installed with the `--with-dev-setup` flag specified on
the command line.

For example
```
opam-version: "2.0"
depends: [
"ocaml"
"ocp-indent" {with-dev-setup}
]
build: [make]
install: [make "install"]
post-messages:
[ "Thanks for installing the package"
"as well as its development setup. It will help with your future contributions" {with-dev-setup} ]
```

### Major change: opam pin --recursive

When pinning a package using `opam pin`, opam looks for opam files in the root directory only.
With recursive pinning, you can now instruct opam to look for `.opam` files in
subdirectories as well, while maintaining the correct relationship between the `.opam`
files and the package root for versioning and build purposes.

Recursive pinning is enabled by the following options to `opam pin` and `opam install`:
* With `--recursive`, opam will look for `.opam` files recursively in all subdirectories.
* With `--subpath <path>`, opam will only look for `.opam` files in the subdirectory `<path>`.

The two options can be combined: for instance, if your opam packages are stored
as a deep hierarchy in the `mylib` subdirectory of your project you can try
`opam pin . --recursive --subpath mylib`.

These options are useful when dealing with a large monorepo-type repository with many
opam libraries spread about.

### New Options

* `opam switch -`, inspired by `git switch -`, makes opam switch back to the previously
selected global switch.

* `opam pin --current` fixes a package to its current state (disabling pending
reinstallations or removals from the repository). The installed package will
be pinned to its current installed state, i.e. the pinned opam file is the
one installed.

* `opam pin remove --all` removes all the pinned packages from a switch.

* `opam exec --no-switch` removes the opam environment when running a command.
It is useful when you want to launch a command without opam environment changes.

* `opam clean --untracked` removes untracked files interactively remaining
from previous packages removal.

* `opam admin add-constraint <cst> --packages pkg1,pkg2,pkg3` applies the given constraint
to a given set of packages

* `opam list --base` has been renamed into `--invariant`, reflecting the fact that since opam 2.1 the "base" packages of a switch are instead expressed using a switch invariant.

* `opam install --formula <formula>` installs a formula instead of a list of packages. This can be useful if you would like to install one package or another one. For example `opam install --formula '"extlib" |"extlib-compat"'` will install either `extlib` or `extlib-compat` depending on what's best for the current switch.

### Miscellaneous changes

* The UI now displays a status when extracting an archive or reloading a repository
* Overhauled the implementation of `opam env`, fixing many corner cases for environment updates and making the reverting of package environment variables precise. As a result, using `setenv` in an opam file no longer triggers a lint warning.
* Fix parsing pre-opam 2.1.4 switch import files containing extra-files
* Add a new `sys-ocaml-system` default global eval variable
* Hijack the `"%{var?string-if-true:string-if-false-or-undefined}%"` syntax to
support extending the variables of packages with `+` in their name
(`conf-c++` and `conf-g++` already exist) using `"%{?pgkname:var:}%"`
* Fix issues when using fish as shell
* Sandbox: Mark the user temporary directory
(as returned by `getconf DARWIN_USER_TEMP_DIR`) as writable when TMPDIR
is not defined on macOS
* Add Warning 69: Warn for new syntax when package name in variable in string
interpolation contains several '+' (this is related to the "hijack" item above)
* Add support for Wolfi OS, treating it like Alpine family as it also uses apk
* Sandbox: `/tmp` is now writable again, restoring POSIX compliance
* Add a new `opam admin: new add-extrafiles` command to add/check/update the `extra-files:` field according to the files present in the `files/` directory
* Add a new `opam lint -W @1..9` syntax to allow marking a set of warnings as errors
* Fix bugs in the handling of the `OPAMCURL`, `OPAMFETCH` and `OPAMVERBOSE` environment variables
* Fix bugs in the handling of the `--assume-built` argument
* Software Heritage fallbacks is now supported, but is disabled-by-default for now. For more information you can read one of our [previous blog post](https://opam.ocaml.org/blog/opam-2-2-0-alpha/#Software-Heritage-Binding)

And many other general and performance 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.2.0~alpha](https://github.com/ocaml/opam/releases/tag/2.2.0-alpha)
- [the release note for 2.2.0~alpha2](https://github.com/ocaml/opam/releases/tag/2.2.0-alpha2)
- [the release note for 2.2.0~alpha3](https://github.com/ocaml/opam/releases/tag/2.2.0-alpha3)
- [the release note for 2.2.0~beta1](https://github.com/ocaml/opam/releases/tag/2.2.0-beta1)
- [the release note for 2.2.0~beta2](https://github.com/ocaml/opam/releases/tag/2.2.0-beta2)
- [the release note for 2.2.0~beta3](https://github.com/ocaml/opam/releases/tag/2.2.0-beta3)
- [the release note for 2.2.0~rc1](https://github.com/ocaml/opam/releases/tag/2.2.0-rc1)
- [the release note for 2.2.0](https://github.com/ocaml/opam/releases/tag/2.2.0)

This release also includes PRs improving the documentation and improving
and extending the tests.


Please report any issues to [the bug-tracker](https://github.com/ocaml/opam/issues).

We hope you will enjoy the new features of opam 2.2! 📯

0 comments on commit 9b04498

Please sign in to comment.