drom
drom copied to clipboard
Novice user experience
I'm just trying out drom
for a small project and wanted to open an issue with the various problems / issues I'm encountering. I hope this will be useful for the maintainers.
- The
README
in this project contains no example of the installation / usage ofdrom
. I think a simple:opam install drom; drom new project; drom build
example would be great. Could also be on the website homepage. - My
drom
generated project fails to build with the following error:
drom: Entering directory '/Users/xavier/Code/why3-tools'
# Run eval $(opam env) to update the current shell environment
[NOTE] It seems you have not updated your repositories for a while. Consider updating them with:
opam update
[ERROR] Package conflict!
* Missing dependency:
- ocaml-base-compiler = 4.10.0 | ocaml-system < 4.10.1~ | ocaml-variants < 4.10.1~
unmet availability conditions: '!(os = "macos" & arch = "arm64")'
unmet availability conditions, e.g. 'sys-ocaml-version = "4.10.0"'
unmet availability conditions, e.g. '!(os = "macos" & arch = "arm64")'
No solution found, exiting
Error: Command 'opam install -y ocaml.4.10.0' exited with error code 20
I would have expected drom
to set up my project specific opam switch and load it if necessary.
- No lockfiles? One of the biggest things I was hoping
drom
would do is fix one of the major issues withopam
by enabling lock files by default but this does not seem to be the case? - No way to specify pinned dependencies in
package.toml
?
Thanks for your feedback !
- Good advice ! I am going to improve the README.md in a few days with such a simple example.
- I don't really understand the error. By default,
drom
sets up a local Opam switch_opam
, but not a localopam
installation (it still relies on$HOME/.opam/
). Version 4.10.0 of OCaml is not available on macos anymore ? - I didn't know how
cargo
dealt with lockfiles until recently. It sounds quite easy to implement, I will try in the next day before the official release of0.9.0
. - I think the current way would be to use
[fields]
opam-trailer = """
pin-depends: [...]
"""
Thanks for your feedback !
Good advice ! I am going to improve the README.md in a few days with such a simple example.
I don't really understand the error. By default,
drom
sets up a local Opam switch_opam
, but not a localopam
installation (it still relies on$HOME/.opam/
). Version 4.10.0 of OCaml is not available on macos anymore ?
It was probably never available for ARM macs, might I suggest to defaulting for the latest stable ocaml when generating a fresh project? It seems like that should be the correct choice in new projects.
- I didn't know how
cargo
dealt with lockfiles until recently. It sounds quite easy to implement, I will try in the next day before the official release of0.9.0
.
Awesome! This is one of the core features of cargo
/bundler
to me.
If there were an additional way to prevent any manually installed opam packages from infecting the build that would be ideal (though probably harder).
The core problem I'm hoping to solve is that I should be able to clone a project on any random machine that has installed drom
, run drom build
and have a working compilation.
No missing deps, bad pins etc...
- I think the current way would be to use
[fields] opam-trailer = """ pin-depends: [...] """
Do you think it would make sense if the package.toml
adopts a similar dependency syntax to rust, in cargo you can have
Lib-foo = { version = "blah", git = "url" }
To specify a git dependency. I would imagine that drom handles creating the pin if necessary.
I think the current way would be to use:
opam-trailer = "[...]
Actually, after revisiting the code, I think it does not work for pin-depends. drom
creates an opam
file gathering information from all the other opam files to install the dependencies, so the opam-trailer
is not considered.
Clearly, the solution is around what you propose, Lib-foo = { version = "blah", git = "url" }
that would generate the corresponding pin-depend
in the opam
files.
In the new master
version:
-
Lockfiles:
-
opam
is always called with--locked
to use lockfiles -
opam lock
is called after dependency installation, and a file$PROJECT-deps.opam.locked
is created in the root directory. If it is present at the next install (or committed in git), it will be used byopam install --locked
-
-
For
pin-depends
, I usedlibXXX = { pin = "https://..." }
, andlibXXX = { pin = "...", version = "=VERSION" }
for versioned pinning. This should generatepin-depends
field in the correspondingopam
file.
Oups, PR not merged yet...
Now, it was merged :-)