Skip to content

Conversation

@Conan-Kudo
Copy link
Member

This is pretty much the same solution we used back when we supported YUM and had to deal with yum vs yum-deprecated.

@Conan-Kudo Conan-Kudo marked this pull request as ready for review January 23, 2026 15:14
@Conan-Kudo Conan-Kudo requested a review from schaefi January 23, 2026 15:16
@Conan-Kudo Conan-Kudo enabled auto-merge January 23, 2026 15:18
@Conan-Kudo Conan-Kudo disabled auto-merge January 23, 2026 15:19
This is pretty much the same solution we used back when we supported
YUM and had to deal with yum vs yum-deprecated.
Copy link
Collaborator

@schaefi schaefi left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this 👍 I think one code part could be done a bit simpler and I have a few questions regarding the change

Comment on lines +102 to +113
dnf4_binary = 'dnf-3'
dnf4_search_env = {
'PATH': os.sep.join([root, 'usr', 'bin'])
} if root else None

# Python interpreter specific path
if Path.which(
filename='dnf4',
custom_env=dnf4_search_env,
access_mode=os.X_OK
):
dnf4_binary = 'dnf4'
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can change this to

dnf_binary = 'dnf-4' if Path.which(
    filename='dnf4', access_mode=os.X_OK, root_dir=root
) else 'dnf-3'

return dnf_binary

Copy link
Collaborator

Choose a reason for hiding this comment

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

It actually means that we are using dnf-4 if that exists in the root tree of the image and else we are using dnf-3 unconditionally. Doesn't this open some room for issues ? What if dnf-3 doesn't exist ? Also when checking inside the root tree then checking outside of it would also be needed as the bootstrap phase will use the package manager from the host. The decision logic here is not quite clear to me

Copy link
Collaborator

Choose a reason for hiding this comment

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

If the idea was to lookup PATH (host) and in $root then the code needs to run two lookup calls, because the first call would be happy if there is just one hit in the given PATH

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the exact implementation we used in the old yum one: https://github.com/OSInside/kiwi/blob/v9.16.36/kiwi/package_manager/yum.py#L89-L110

Copy link
Member Author

Choose a reason for hiding this comment

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

At least with all the current supported distributions, the dnf-3 binary exists unless the per-Python version suffixed binaries don't exist, and those have dnf4 instead.

Copy link
Member Author

Choose a reason for hiding this comment

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

We just can't check for dnf because it's an ambiguous binary now.

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.

3 participants