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

osbuild-depsolve-dnf: refactor into osbuild.solver module #1776

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bcl
Copy link
Contributor

@bcl bcl commented May 7, 2024

This moves the dnf and dnf5 code into a new osbuild module called
solver. The dnf specific code is in dnf.py and dnf5 is in dnf5.py

At runtime the osbuild-depsolve-dnf script reads a config file from
/usr/lib/osbuild/solver.json and imports the selected solver. This
currently just contains a 'use_dnf5' bool but can be extended to support
other configuration options or depsolvers.

At build time a config file is selected from tools/solver-dnf.json or
tools/solver-dnf5.json and installed. Currently dnf5 is not installed,
it will be added when dnf5 5.2.1.0 becomes available in rawhide (Fedora
41).

The error messages have been normalized since the top level functions in
osbuild-depsolve-dnf do not know which version of dnf is being used.

@supakeen
Copy link
Member

supakeen commented May 7, 2024

🔥

@bcl bcl force-pushed the main-solver branch 2 times, most recently from 532284f to 54d69c3 Compare May 10, 2024 23:18
@bcl bcl requested review from supakeen and mvo5 May 10, 2024 23:18
@bcl bcl marked this pull request as ready for review May 10, 2024 23:19
@bcl bcl changed the title WIP on dnf solver splitting osbuild-depsolve-dnf: refactor into osbuild.solver module May 10, 2024
@achilleas-k achilleas-k self-requested a review May 14, 2024 17:29
@ondrejbudai
Copy link
Member

FTR, we are currently relying on the fact that osbuild-depsolve-dnf is just one file in bootc-image-builder, see: https://github.com/osbuild/bootc-image-builder/blob/f972d4cdeca075e2096f0374f2d188c1d736898c/bib/cmd/bootc-image-builder/main.go#L265

I really love this PR, but we need to make sure that we have a way forward in the b-i-b world before merging this. :)

@achilleas-k
Copy link
Member

we need to make sure that we have a way forward in the b-i-b world before merging this. :)

I'm still not entirely sure why we need to copy the script into the base OS container (buildroot) to run it in BIB. What happens when we call it from the outside and point it to the buildroot for the repo configs?

@bcl
Copy link
Contributor Author

bcl commented May 23, 2024

I'm still not entirely sure why we need to copy the script into the base OS container (buildroot) to run it in BIB. What happens when we call it from the outside and point it to the buildroot for the repo configs?

IMO this is a bib bug, it should be installing osbuild in the container and using it properly.

@achilleas-k
Copy link
Member

I'm still not entirely sure why we need to copy the script into the base OS container (buildroot) to run it in BIB. What happens when we call it from the outside and point it to the buildroot for the repo configs?

IMO this is a bib bug, it should be installing osbuild in the container and using it properly.

It's already in the BIB container. It gets copied into the target image container (the user's extracted container) and run within that container's root.

Because we're container native I guess.

mvo5
mvo5 previously approved these changes May 29, 2024
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I really like this! I have some ideas/suggestions inline but they are totally optional. Hope they are still useful :)

tools/osbuild-depsolve-dnf Show resolved Hide resolved
tools/test/test_depsolve.py Show resolved Hide resolved
tools/test/test_depsolve.py Outdated Show resolved Hide resolved
tools/test/test_depsolve.py Show resolved Hide resolved
mvo5 added a commit to mvo5/images that referenced this pull request Jun 3, 2024
With the new "dnf5" solver is seems useful to allow the dnfjson
code return what solver was actually used in the transaction.

This commit allows an (optional) "solver" field in the json
that is returned from the dnfjson helper. It does not do more
yet but we should (probably) make it avaialble for the higher
layers too so that it can be e.g. logged.

See also osbuild/osbuild#1776
mvo5 added a commit to mvo5/images that referenced this pull request Jun 3, 2024
With the new "dnf5" solver is seems useful to allow the dnfjson
code return what solver was actually used in the transaction.

This commit allows an (optional) "solver" field in the json
that is returned from the dnfjson helper. It does not do more
yet but we should (probably) make it avaialble for the higher
layers too so that it can be e.g. logged.

See also osbuild/osbuild#1776
mvo5
mvo5 previously approved these changes Jun 4, 2024
mvo5 added a commit to mvo5/images that referenced this pull request Jun 4, 2024
With the new "dnf5" solver is seems useful to allow the dnfjson
code return what solver was actually used in the transaction.

This commit allows an (optional) "solver" field in the json
that is returned from the dnfjson helper. It does not do more
yet but we should (probably) make it avaialble for the higher
layers too so that it can be e.g. logged.

See also osbuild/osbuild#1776
supakeen
supakeen previously approved these changes Jun 4, 2024
Copy link
Member

@supakeen supakeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving but with the remark that this means we can't ship the depsolvers separately from osbuild anymore.

bcl added 3 commits June 4, 2024 15:51
This moves the dnf and dnf5 code into a new osbuild module called
solver. The dnf specific code is in dnf.py and dnf5 is in dnf5.py

At runtime the osbuild-depsolve-dnf script reads a config file from
/usr/lib/osbuild/solver.json and imports the selected solver. This
currently just contains a 'use_dnf5' bool but can be extended to support
other configuration options or depsolvers.

At build time a config file is selected from tools/solver-dnf.json or
tools/solver-dnf5.json and installed. Currently dnf5 is not installed,
it will be added when dnf5 5.2.1.0 becomes available in rawhide (Fedora
41).

The error messages have been normalized since the top level functions in
osbuild-depsolve-dnf do not know which version of dnf is being used.
Test with no config file (libdnf), with use_dnf5 set to false, and with
it set to true. Make sure the correct dnf library was used.
@bcl
Copy link
Contributor Author

bcl commented Jun 4, 2024

Approving but with the remark that this means we can't ship the depsolvers separately from osbuild anymore.

I don't think we ever have, the depsolve-dnf subpackage requires osbuild with a matching version.

@bcl bcl dismissed stale reviews from supakeen and mvo5 via e21d434 June 4, 2024 22:59
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

Successfully merging this pull request may close these issues.

None yet

5 participants