Skip to content

Spec for opam file generation

David Allsopp edited this page Jul 19, 2021 · 2 revisions

In 2019 there were various proposals for allowing opam files to be automatically generated. The principal aim was to allow generated opam files not be committed into project repositories.

Two issues tracked designs around this:

  • #3793 defined a format for specifying multiple packages in a single .opam file. This was proposed following discussions with the Dune team where a possible "protocol" for running a command with an opam spec was discussed.
  • #3797 defines additional fields which could be specified in an opam file to allow that opam file to be regenerated.

Wind forward to 2020/21, the current thinking is to maintain opam files as the "source of truth" - so while they may be generated, the view is that the dune-project file (or whatever else may be being used) is out-of-sync with the opam file, rather than the other way around, so for the time being this idea is abandoned (though not rejected).

It is possible that #3797 may be resurrected as a way of having opam check that the opam file on pinning is up-to-date. The concern at not committing the entire file is as to what happens if for any reason the build system cannot be installed (i.e. the proposed define-depends cannot be installed). In particular, it means that any utility attempting to trawl information about the repository would be required to execute code just in order to determine metadata fields, and we'd like to avoid that.