##Description
With the latest version of Dune, running:
opam pin -k path .
fails when the project contains a watermark such as:
let version = "%%VERSION%%"
The failure occurs during the dune subst step automatically invoked by opam:
[ERROR] The compilation of dune-watermark-demo.~dev failed at "dune subst".
=== ERROR while compiling dune-watermark-demo.~dev ===========================#
context 2.1.5 | linux/x86_64 | ocaml.5.3.0 | pinned(file:///home/abdelghani/Repos/playwith/dune-watermark-demo)
path ~/.opam/default/.opam-switch/build/dune-watermark-demo.~dev
command ~/.opam/opam-init/hooks/sandbox.sh build dune subst
exit-code 1
output
File "bin/main.ml", line 1, characters 15-26:
1 | let version = "%%VERSION%%"
^^^^^^^^^^^
Error: repository does not contain any version information
Expected Behavior
opam pin -k path . should not fail merely because Dune cannot determine a version for the repository.
In particular, the presence of %%VERSION%% should not make a local path pin unusable when the repository is initialized, regardless of whether a Git tag exists.
Actual Behavior
dune subst fails as soon as it encounters %%VERSION%% and cannot derive version information from the repository:
Error: repository does not contain any version information
This prevents the pinned package from being built.
Reproduction
The issue can be reproduced with the dune-watermark-demo example:
dune-watermark-demo/
├── dune-project
├── bin/
│ ├── dune
│ └── main.ml
└── .git/
dune-project:
(lang dune 3.20)
(name dune_watermark_demo)
bin/dune:
(executable
(name main))
bin/main.ml:
let version = "%%VERSION%%"
let () =
Printf.printf "Version : %s\n" version
The problem occurs in both of the following situations:
The Git repository is initialized, but no tag has been created.
The Git repository is initialized and a tag has been created.
In both cases, running:
opam pin -k path .
ultimately invokes:
dune subst
which fails with:
Error: repository does not contain any version information
Specifications
- Version of
dune (output of dune --version): 3.23.0
- Version of
ocaml (output of ocamlc --version): 5.3.0
- Operating system (distribution and version): Ubuntu 22.04.5 LTS. 64 bits
Additional information
This affects projects using Dune watermarks such as %%VERSION%% and relying on:
opam pin -k path ...
for local development.
The issue is especially surprising because the repository may already be a valid Git repository and may even contain a tag, yet dune subst still reports that no version information is available.
##Description
With the latest version of Dune, running:
opam pin -k path .
fails when the project contains a watermark such as:
let version = "%%VERSION%%"
The failure occurs during the dune subst step automatically invoked by opam:
[ERROR] The compilation of dune-watermark-demo.~dev failed at "dune subst".
=== ERROR while compiling dune-watermark-demo.~dev ===========================#
context 2.1.5 | linux/x86_64 | ocaml.5.3.0 | pinned(file:///home/abdelghani/Repos/playwith/dune-watermark-demo)
path ~/.opam/default/.opam-switch/build/dune-watermark-demo.~dev
command ~/.opam/opam-init/hooks/sandbox.sh build dune subst
exit-code 1
output
File "bin/main.ml", line 1, characters 15-26:
1 | let version = "%%VERSION%%"
^^^^^^^^^^^
Error: repository does not contain any version information
Expected Behavior
opam pin -k path . should not fail merely because Dune cannot determine a version for the repository.
In particular, the presence of %%VERSION%% should not make a local path pin unusable when the repository is initialized, regardless of whether a Git tag exists.
Actual Behavior
dune subst fails as soon as it encounters %%VERSION%% and cannot derive version information from the repository:
Error: repository does not contain any version information
This prevents the pinned package from being built.
Reproduction
The issue can be reproduced with the dune-watermark-demo example:
dune-watermark-demo/
├── dune-project
├── bin/
│ ├── dune
│ └── main.ml
└── .git/
dune-project:
(lang dune 3.20)
(name dune_watermark_demo)
bin/dune:
(executable
(name main))
bin/main.ml:
let version = "%%VERSION%%"
let () =
Printf.printf "Version : %s\n" version
The problem occurs in both of the following situations:
The Git repository is initialized, but no tag has been created.
The Git repository is initialized and a tag has been created.
In both cases, running:
opam pin -k path .
ultimately invokes:
dune subst
which fails with:
Error: repository does not contain any version information
Specifications
dune(output ofdune --version): 3.23.0ocaml(output ofocamlc --version): 5.3.0Additional information
This affects projects using Dune watermarks such as %%VERSION%% and relying on:
opam pin -k path ...
for local development.
The issue is especially surprising because the repository may already be a valid Git repository and may even contain a tag, yet dune subst still reports that no version information is available.