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

Dependency resolvement on top of simulated installed content #494

Open
j-mracek opened this issue Mar 31, 2022 · 3 comments
Open

Dependency resolvement on top of simulated installed content #494

j-mracek opened this issue Mar 31, 2022 · 3 comments

Comments

@j-mracek
Copy link
Contributor

I am sorry but this is not an issue but request for suggestion whether the following user case is somehow supported in libsolv. I will be very happy to get any help.

Recently we got requests to analyze dependency on top of installed packages without actually installing them. It is something like to simulate that some packages are already installed and then I want to create a job that adds additional packages or modify simulated installed content. The user case is coming from build infrastructure or web services.

I am not happy to crate any fake content in libsolv but I don't see any other option but maybe you do.

We can create additional repository and create inside new solvables (pool_add_solvable(Pool *pool)) and copy features from available solvable. Then we can mark the repo as system repository and make their provide ready. Do you see a better way how to fake installed content?

When all analyses are finished them may be we would like to use the same instance of libsolv or pool data with another installed content. I found pool_free_solvable_block for removal solvable from installed repository but I am not sure whether it is good idea to use it or whether it is too risky? I know that it will make cashed solvable IDs invalid and it will require to recompute provides but there can be other critical issues that I do not see. Be honest I am scared to do it a lot.

Thank you very much for your help and I will also understand if you will close the issue because it is not an issue.

@mlschroe
Copy link
Member

mlschroe commented Apr 1, 2022

I don't know if the following helps you, but we had a "patchcheck" program that checked if a patch that updates installed packages can be installed or not.

To do this, the libsolv bindings have a repo.createshadow("name") method that creates a copy of all repository packages (just the dependencies and main attributes, not the "repodata" parts).
There's also repo.moveshadow( [ ids ]) method that moves the packages into the specified repo. (It can only move between a repo and its shadow.)

The patchcheck tool used this to create a "installed" repo as shadow of the repo containing all packages and then used repo.moveshadow() to move packages around.

See bindings/solv.i for the implementation. This is all a big hack, so handle with care.

@wolfv
Copy link
Contributor

wolfv commented Apr 1, 2022

Yeah, we'd be interested in this as well!
I came up with the following code that loads an installed repo from a Transaction: mamba-org/mamba#1516 (but it's pretty mamba-specific so not sure you can derive much value from it).

@j-mracek
Copy link
Contributor Author

j-mracek commented Apr 5, 2022

Thank you @mlschroe, we will try to play with it.

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

No branches or pull requests

3 participants