-
Notifications
You must be signed in to change notification settings - Fork 175
Identify the correct binary for DNF4 #2936
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
base: main
Are you sure you want to change the base?
Conversation
def9d8f to
4b38720
Compare
4b38720 to
1a8bf27
Compare
schaefi
left a comment
There was a problem hiding this 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
| 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' |
There was a problem hiding this comment.
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_binaryThere was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
This is pretty much the same solution we used back when we supported YUM and had to deal with yum vs yum-deprecated.