No, this kind of failures can happen. We cannot guarantee that all the distributions ship the exact version or package you need for your opam package. In those cases (older/newer versions in a distribution repository or specific packages unavailable in a distribution) the CI will inevitably fail. That should not prevent a package from being merged
Can you elaborate on that? If you run on 4.08 then 4.05 does not matter and both dune-release
as well as the OCaml compiler are unaware of the existence of 4.05. Is your code compatible with 4.08?
mmm, now I’m not sure anymore. I remember I saw the warnings
ocamlc lib/.bogue.objs/byte/bogue__B_chain.{cmi,cmo,cmt}
File "lib/b_chain.ml", line 91, characters 27-45:
91 | let comp (x:int) (y:int) = Pervasives.compare x y;;
^^^^^^^^^^^^^^^^^^
Alert deprecated: module Stdlib.Pervasives
Use Stdlib instead.
If you need to stay compatible with OCaml < 4.07, you can use the
stdlib-shims library: https://github.com/ocaml/stdlib-shims
and I thought this was causing dune
to stop. Actually it was probably a problem between Bytes/String (that I have now corrected). The code compiled with 4.05, but not with 4.08 due to this.
My point was: assume I have a code which compiles with 4.05 but not with 4.08, and I’m fine with this because let’s say I only target ubuntu 18. I want to use dune-release
to publish my package. Problem: dune-release
doesn’t work with 4.05. So I install 4.08 and run dune-release
. But, it seems that dune-release
cannot publish the package without compiling it, and then it stops because the code does not compile with 4.08.
I don’t know if I’m clear enough
You can just add stdlib-shims in your dune (libraries ...)
stanza, and replace all calls for Pervasives
to Stdlib
.
It can be frustrating to fight against upgrades when you just want to release something. Sorry about the experience you’re having right now. There are two problems you’re hitting:
- dune-release works on OCaml >= 4.06 only.
- your codebase is not compatible with OCaml 4.08
Fortunately, it’s possible to fix this step by step. You can install a 4.07.1 switch, in the same way you installed a 4.08.0 one. This compiler version should be compatible with both dune-release and your package, making it possible to release it without any errors.
Then, if you want to support OCaml >= 4.08, say, in a future release, you can install stdlib-shims
or another solution and make sure it builds on 4.08. But that’s not strictly required for releasing it.
Hope that helps!
the package is published! thanks everyone for the help.
So, which tool between dune-release
and opam-publish
is recommended in 2024 for newcomers?
Is there way to exclude building of the bin
directory when trying to publish a package? I’m getting an error that i’m not sure how to resolve: Opam-CI
I’ve been using dune-release for some years and it works well. After initial setup, my process is:
- Tag my new release and push the tag to my upstream
- Run the commands shown here: dream-html/Makefile at eb711891cb676b595a9e25289c0a02fef12b40ae · yawaramin/dream-html · GitHub
If one wants a shortcut, those commands are basically what dune-release bistro
is doing btw. The help of bistro details the whole process to make a release.
I was looking at the source code of your project and got confused before to check the log of commits. The fix is Ensure bin directory is not install with package. · zoj613/bitgenerators@c2b010a · GitHub which removes the public name on the binaries.
Basically everything that has a public name will be installed. So if you don’t want something to get built during a dune build @install
(which is the command opam install
will run for your package), that thing shouldn’t have a public name.
In case it helps someone, I’ve written about dune-release in some detail, and a few of my colleagues gave me good feedback about this document. Sharing here in case it’s helpful to anyone dune-release.md · GitHub
I only realized I should not be using public_name
for the bin directory after I posted here. Thanks for the clarification. I was able to submit a different PR on opam-repository
that passed all the CI checks.
There is not really a complete answer to your question (and I’m not sure there is) but the official documentation has a table showing the differences and explaining how to use both tools.