FWIW, there is a very similar stumbling block when working on a pinned package that has an opam file in the opam repo but not in the package's own source repo. In this case the problem does not have anything to do with whether the opam file is generated or not, and is independent of dune.

This situation arises if e.g. you `opam pin --dev` (or pin a local git clone of) such a package, and then make source changes that also require changes to the opam file. At that point, opam uses the opam file from the opam repo whether or not there is a local one (that is not in source control).

Perhaps this situation is too uncommon to warrant the time to address it, but I have hit it and don't know a satisfactory work-around.

Cheers, Josh

On 8 Aug 2019, at 19:05, Yawar Amin wrote:

Checking in generated build system files is fairly common practice now. Lots of build systems/package managers have 'lockfiles' that are generated to help with reproducible builds. These need to be checked in. In fact I think opam has two different ways of generating 'lockfiles'.

Regards,

Yawar

On Wed, Aug 7, 2019 at 4:32 PM Ian Zimmerman <itz@very.loosely.org> wrote:
On 2019-08-06 11:47, Ian Zimmerman wrote:

> So, for now, I'm sticking with Makefiles. :-P

I decided to give dune a try, mostly to give myself an excuse to
procrastinate with other projects.  After some rough going but being
able to figure it out, I hit what seems like an impassable strait.

dune generates the $package.opam file, therefore that file should not be
on version control.  _But_ then "opam pin ." insists on getting that
very file from the version control repo, instead of using the local one:

 matica!179 aaa$ opam pin .
[NOTE] Package aaa is already pinned to git+file:///home/itz/git/aaa#master (version 0.0.8~dev).
[aaa.0.0.8~dev] no changes from git+file:///home/itz/git/aaa#master
[WARNING] aaa's opam file has uncommitted changes, using the versioned one
aaa is now pinned to git+file:///home/itz/git/aaa#master (version 0.0.8~dev)
The following actions will be performed:
  - install aaa 0.0.8~dev*
Do you want to continue? [Y/n] y
[aaa.0.0.8~dev] synchronised from git+file:///home/itz/git/aaa#master

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] The compilation of aaa failed at "/home/itz/.local/packages/opam/opam-init/hooks/sandbox.sh build dune
        subst".

#=== ERROR while compiling aaa.0.0.8~dev ======================================#
# context     2.0.4 | linux/x86_64 | ocaml-base-compiler.4.07.1 | pinned(git+file:///home/itz/git/aaa#master#193ad3bd)
# path        ~/.local/packages/opam/default/.opam-switch/build/aaa.0.0.8~dev
# command     ~/.local/packages/opam/opam-init/hooks/sandbox.sh build dune subst
# exit-code   1
# env-file    ~/.local/packages/opam/log/aaa-10257-b76d46.env
# output-file ~/.local/packages/opam/log/aaa-10257-b76d46.out
### output ###
# Error: No <package>.opam files found.



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
+- The following actions failed
| - build aaa 0.0.8~dev
+-
- No changes have been performed

So how do you get around this?

--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.