dune developer preview: automatic depext handling?
Desired Behavior
I was trying out the Dune preview on OBuilder, and it has shown this message:
File "dune.lock/conf-sqlite3.pkg", line 4, characters 6-16:
4 | (run pkg-config sqlite3))
^^^^^^^^^^
Error: Logs for package conf-sqlite3
You may want to verify the following depexts are installed:
- sqlite-devel
This is good (I installed the package, and tried again), but opam has this functionality built-in with opam depext.
It would be good if dune pkg had a similar feature: it can already print the depexts, so would be good if there was a command to either automatically install them, or query them all so that one can manually install them.
Example
dune pkg depext should print a list of packages that need to be installed with the distro's package manager, such that $distro_package_manager $(dune pkg depext) would install all the missing depexts of the current dune project.
Alternatively dune pkg depext --install could also attempt to automatically invoke the appropriate package manager with sudo, but I'm not sure whether it is worth duplicating all that code from opam (could perhaps the opam depext code be moved to a package that both opam and dune share so that improvements to one are not lost in the other?
This can be tested using OBuilder's dune-project as a starting point https://github.com/ocurrent/obuilder/blob/v0.6.0/dune-project, which includes the dependency on sqlite3 (make sure you don't already have sqlite3 installed, e.g. by trying to run this in a fresh container).
I agree having the command dune pkg depext which print the list of the packages.
The opam depext solution was dismissed, it was one of the solution presented here https://github.com/ocaml/dune/issues/9294.
Alternatively dune pkg depext --install could also attempt to automatically invoke the appropriate package manager with sudo, but I'm not sure whether it is worth duplicating all that code from opam (could perhaps the opam depext code be moved to a package that both opam and dune share so that improvements to one are not lost in the other?
Agreed that it's definitely not worth it.
A command to print all the depexts in a way that is easy to consume by opam depext sounds like the way to go.
@moyodiallo could you have a look at this?
We could do this, opam-depexts package already exist but it's frozen because already integrated in opam.
This is my proposition how it could be done.
- introduce
dune pkg depexts - next adding the flag to get
dune pkg depexts --installby copying the code that we need fromopam. (itt is not a huge code). - try to figure out how we could maintain that code in the long-term. IMHO, I doubt that
opamwill rely on a package that have common usage withdunefor this.
What do you think ?
next adding the flag to get dune pkg depexts --install by copying the code that we need from opam. (itt is not a huge code).
Or, we can just let the user install the depexts manually or using the opam command. Copying code from opam doesn't buy us much. None of the installation is done within dune's sandbox anyway, and the command requires sudo, so the user needs to see it before its executed.
- introduce
dune pkg depexts
Or, we can just let the user install the depexts manually or using the opam command. Copying code from opam doesn't buy us much. None of the installation is done within dune's sandbox anyway, and the command requires sudo, so the user needs to see it before its executed.
Having a command that prints all depexts for the current OS in a machine parseable form (e.g. one per line or separated by spaces) would be useful. The user can then call the package manager themselves, e.g. sudo dnf install $(dune pkg depexts).
OK, let's go for dune pkg depexts then.