ocaml-ci-scripts icon indicating copy to clipboard operation
ocaml-ci-scripts copied to clipboard

Breaks with dune 1.10 autogenerated opam file

Open Leonidas-from-XIV opened this issue 6 years ago • 3 comments

I was curious to try out the new dune 1.10 feature where it autogenerates the opam file, so I made a branch in my project https://github.com/Leonidas-from-XIV/orewa/pull/4

Unfortunately (but unsurprisingly) the build fails because the repo does not have an opam file anymore and the CI scripts don't know that they have to generate it first.

I'm opening this as an issue, since I don't really know how to tackle this at all, since the existence of an opam file was the underlying premise of this repo. With the new dune we'd need to check for a dune-project file, install dune and attempt to generate an opam file I assume.

If it were for another build system I'd say why bother but since we're talking about dune it would be good to support this usecase which I could imagine becoming popular in the near future.

Leonidas-from-XIV avatar Jun 15 '19 14:06 Leonidas-from-XIV

You do need to check in the autogenerated opam file at this stage, until https://github.com/ocaml/opam/issues/3797 is addressed in opam (cc @AltGr @dra27 @rjbou). It uses dune promotion so this should hopefully not be too bad.

We could build the opam file here for dev packages though... any opinion on this @rgrinberg?

avsm avatar Jun 25 '19 11:06 avsm

You'll always need to check in an opam file, even when support is added for auto-generation - what will change is that with Dune you would never have change the opam file again.

Note, however, that once the feature does land, you'd still want to be updating the opam file in the repo for a while with fields to remain compatible with users on an earlier version of opam.

(note that you could have no opam file in your repo, but this would depend on the package being published in a repository and having the correct instructions for the repo, so it's not likely to be a recommended thing to do)

dra27 avatar Jun 25 '19 11:06 dra27

@avsm well I do think it should be a CI failure if you forgot to check in the generated opam file. After all, it's a packaging error.

I wish there was a better way to warn users about this, but in theory this can happen with any file the user can forget to check in.

rgrinberg avatar Jun 26 '19 06:06 rgrinberg