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

feature request: produce a lock file of a package that is not installed in the switch #5426

Open
hannesm opened this issue Jan 24, 2023 · 3 comments
Labels
KIND: FEATURE WISH KIND: PLUGIN CANDIDATE Feature requests that might best be implemented as plugins to opam

Comments

@hannesm
Copy link
Member

hannesm commented Jan 24, 2023

Hey,

I'd like to be able to generate a lockfile from an opam file and several package repositories, and some packages already installed. But I'd at the same time like to not have to install that opam file.

Since to me a major effort of lock is apply the solver and find a good (transitive complete) solution where specific package versions have been selected, this would be great.

Would that be possible (or maybe it is even possible today, and I only missed how to do that)?

Best, and thanks for your excellent work on opam,

Hannes

@dra27
Copy link
Member

dra27 commented Jan 31, 2023

We discussed this yesterday evening - just to clarify what you mean, as we had two possible interpretations of it. For the existing lock command, this would work, but only if all the dependencies of the package being locked are in the switch (i.e. without the package itself being installed). This literally fits the issue description, but I wonder if you are particularly after being able to do this with none of the dependencies installed, or in fact largely independently of the switch completely? opam lock shouldn't be calling the solver at all - it's locking the packages already installed in the switch. That version feels more like locking without any switch at all - so a bit like instructing opam to create a new switch, and then simply writing the package selection from opam switch create to the lockfile?

@hannesm
Copy link
Member Author

hannesm commented Jan 31, 2023

Thanks for your reply. For my purpose, indeed I'm interested in creating a lock file from an opam file and an opam universe (set of opam repositories), without anything installed in the switch. Now that I hear "opam lock shouldn't be calling the solver at all", my feature request may be for some different subcommand, which basically:

  • takes an opam file
  • uses the opam metadata from the repository(ies) of the current switch
  • selects versions and dumps a lock file

@rjbou
Copy link
Collaborator

rjbou commented Mar 9, 2023

This can be an opam plugin that uses the result from api of opam list --resolve to produce an opam file.

@rjbou rjbou added the KIND: PLUGIN CANDIDATE Feature requests that might best be implemented as plugins to opam label Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
KIND: FEATURE WISH KIND: PLUGIN CANDIDATE Feature requests that might best be implemented as plugins to opam
Projects
None yet
Development

No branches or pull requests

4 participants