Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dune developer preview: automatic depext handling? #11000

Open
edwintorok opened this issue Oct 7, 2024 · 7 comments
Open

dune developer preview: automatic depext handling? #11000

edwintorok opened this issue Oct 7, 2024 · 7 comments

Comments

@edwintorok
Copy link
Contributor

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).

@moyodiallo
Copy link
Collaborator

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 #9294.

@rgrinberg
Copy link
Member

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.

@rgrinberg
Copy link
Member

@moyodiallo could you have a look at this?

@moyodiallo
Copy link
Collaborator

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.

  1. introduce dune pkg depexts
  2. 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).
  3. try to figure out how we could maintain that code in the long-term. IMHO, I doubt that opam will rely on a package that have common usage with dune for this.

What do you think ?

@rgrinberg
Copy link
Member

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.

@edwintorok
Copy link
Contributor Author

  1. 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).

@moyodiallo
Copy link
Collaborator

OK, let's go for dune pkg depexts then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants