How to use dune-release distrib with 3 packages?

I am using dune-release 1.4.0. I have a repository from which I release 3 packages. I am on a branch, with a tag that I prepared previously (without the help of dune-release):

> git describe
v0.3.1

I have the .opam files for my 3 packages in the current directory (plus a dummy .opam file for my dev deps):

> ls *.opam 
np.opam  requirements_dev.opam  scipy.opam  sklearn.opam

However dune-release cannot find any of my packages:

> dune-release distrib
[-] Building source archive
dune-release: [ERROR] cannot determine name automatically: use `-p <name>`
> dune-release distrib -p np
[-] Building source archive
dune-release: [ERROR] cannot determine name automatically: use `-p <name>`
> dune-release distrib -p np,scipy,sklearn
[-] Building source archive
dune-release: [ERROR] cannot determine name automatically: use `-p <name>`

The documentation for -p says:

The names PKG_NAMES of the opam packages to release. If absent
provided by the *.opam files present in the current directory.

(Looking at strace, it looks like dune-release it not reading any of my .opam files. Rather it reads my README.md, picks up the main title, adds .opam at the end and tries to open that.)

What am I doing wrong?

One can see the branch I am trying to release from here: https://github.com/lehy/ocaml-sklearn/tree/0.3.1

1 Like

Try adding the (name ..) field to your dune-project file.

Thank you for the hint. (I am not completely sure what the name should correspond to though, since I have three packages/libraries in there.) Unfortunately that’s not enough:

> cat dune-project
(lang dune 2.4)
(name ocaml_sklearn)
> dune-release distrib -p np,scipy,sklearn
[-] Building source archive
Error: The project name is not defined, please add a (name <name>) field to
your dune-project file.
dune-release: [ERROR] run ['dune' 'subst']: exited with 1
> dune-release distrib -p np              
[-] Building source archive
Error: The project name is not defined, please add a (name <name>) field to
your dune-project file.
dune-release: [ERROR] run ['dune' 'subst']: exited with 1

Edit: so it turns out that dune-release does not see what is in dune-project unless I commit it. Also, I can’t use ocaml_sklearn as a name, I need to use the name of one of my .opam files. That gets me further: now dune-release complains about missing CHANGES files, tries to build things and fails (it seems it does not like my 3 packages depending on one another), and ends with what looks like success:

[+] Distribution for sklearn 0.3.1-1-gb0703e9
[+] Commit b0703e9753b4e5c7fe50b5c1d79becd23e52fb5f
[+] Archive _build/sklearn-v0.3.1-1-gb0703e9.tbz
dune-release: [WARNING] The repo is dirty. The distribution archive may be
                        inconsistent.

Thanks again Rudi.

That’s a limitation we intend to lift in dune. I’m not sure if dune-release enforces this.

dune-release requires CHANGES.md in a to be formatted a certain way so that it can extract the changes for the release you are intending to publish. See the dune repository for an example.

You should report all of these poor error messages to the dune-release issue tracker. The tool works quite well, but it’s a pain to get stared with.

1 Like