-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add /usr/libexec/podman/qemu-system-arch #27773
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
rpm/podman.spec
Outdated
| %ifarch %{machine_arches} | ||
| # symlink virtiofsd in %%{name} libexecdir for machine subpackage | ||
| ln -s ../virtiofsd %{buildroot}%{_libexecdir}/%{name} | ||
| %if %{defined rhel} |
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 this can be replaced with %if %{defined qemu} itself. See the qemu conditional at the top of spec file.
Same for the %files change.
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.
@lsm5 I don't think %if %{defined qemu} would work correctly here. Looking at the spec file, the qemu macro is defined on Fedora (line 15, inside the %if %{defined fedora} block), but this symlink is specifically needed on RHEL where qemu-kvm is used instead of the qemu-system-* packages.
Using %if %{defined qemu} would create the symlink on Fedora (where it's not needed since qemu-system-%{arch} already exists), while skipping it on RHEL (where it's actually needed).
I think %if %{defined rhel} is more explicit and clearer here - it directly expresses the intent that this symlink is a RHEL-specific workaround for the different qemu package naming. It also makes the code more maintainable if the qemu macro definition logic changes in the future.
Unless I'm misunderstanding something about the qemu macro usage?
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.
my bad. Should be %if !%{defined qemu} for RHEL envs. If the qemu itself sounds confusing, we could switch to some other symbol.
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.
@lsm5 You're right, I'll use %if !%{defined qemu} to stay consistent with the existing pattern in the spec.
However, I'd like to raise a broader concern: the increasing use of macro indirection in this spec makes it harder to port and maintain, especially for RHEL-specific work. When I see %if !%{defined qemu}, I have to:
- Search for where qemu is defined
- Find it's defined only on Fedora (line 15)
- Apply inverse logic to understand this means RHEL/CentOS Stream
- Check the comment to understand it's about package naming differences
For someone maintaining the RHEL spec or doing distro-specific work, %if %{defined rhel} would be immediately clear without requiring this detective work.
I'll make this change for consistency, but I'd like to propose we consider re-engineering the spec to reduce these kinds of indirections and use more explicit distro conditionals (%{defined rhel}, %{defined fedora}) for platform-specific sections.
This would make the spec more self-documenting and easier to maintain across distributions. What do you think?
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.
There are also cases when conditionals don't apply across all fedora or all rhel, and in those cases stating out those same conditionals in multiple places can become unmanageable.
Having the indirection using a macro / symbol / whatever specified at the top makes the justification about the environment clear and reusable IMO. This is useful when we're using a single spec file to build for multiple distro-release-arch combinations as is the case in rpm/podman.spec .
If %if !%{defined qemu} can be hard to read, I dunno, maybe %if "%qemu" == "0" or something, where qemu is defined for all envs and set to 1 or 0 depending on what env supports it ??
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.
btw, what's the harm in copying the conditionals specified on top and the other changes from upstream / fedora spec file to rhel? Is there a case where it'll fail to build or build the wrong way?
Signed-off-by: Jindrich Novy <[email protected]>
ccdb36b to
c186a33
Compare
|
[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore. |
|
Why are we doing this? I assume something related to machine packaging, but what does this solve? |
If the user is on a RHEL host, podman machine currently only searches for the |
Checklist
Ensure you have completed the following checklist for your pull request to be reviewed:
commits. (
git commit -s). (If needed, usegit commit -s --amend). The author email must matchthe sign-off email address. See CONTRIBUTING.md
for more information.
Fixes: #00000in commit message (if applicable)make validatepr(format/lint checks)Noneif no user-facing changes)Does this PR introduce a user-facing change?