tarides / dune-release

Streamlining the release of dune packages to opam
ISC License
114 stars 38 forks source link

distrib does not see `(name <name>)` stanza if not committed #320

Closed lehy closed 3 years ago

lehy commented 3 years ago

Setup

We set up a simple repo with two .opam files. We add a name to dune-project but do not commit it.

> git clone git@github.com:lehy/dune-release-repro.git
[snip]
> cd dune-release-repro
liba/  libb/  CHANGES  dune-project  dune-workspace  liba.opam  libb.opam
> cat dune-project 
(lang dune 2.7)
> echo '(name toto)' >> dune-project
> cat dune-project
(lang dune 2.7)

(name toto)

dune-release tag works:

> dune-release tag        
[-] Extracting tag from first entry in CHANGES
[-] Using tag "1.0.0"
[?] Create git tag 1.0.0 for HEAD? [Y/n]
y
[+] Tagged HEAD with version 1.0.0

Problem

dune-release distrib does not see the uncommitted name. It would be nice if it could complain about it if committing is really necessary, or at least mention that committing is necessary in the error message.

> dune-release distrib
[-] 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

Committing the dune-project file with a name makes dune-release distrib work (however the name must be the name of one of the .opam files).

NathanReb commented 3 years ago

This is intended behaviour since distrib operates on the HEAD commit source tree so any uncomitted changes are ignored. The first step for distrib is to get a clean clone checked out to the right commit.

I agree this can be confusing though. Moving the warning earlier as you did seems like a sensible improvement, I'll also mention it in the documentation.