cli: Fix rhsm feature propagation and manpage build order#1807
cli: Fix rhsm feature propagation and manpage build order#1807cgwalters merged 1 commit intobootc-dev:mainfrom
Conversation
The rhsm feature was not being propagated from the CLI crate to the lib crate, causing `bootc internals publish-rhsm-facts` to never be compiled in even when building with CARGO_FEATURES=rhsm. I think this was broken when I refactored the build recently. Change things so we build the manpages before the production binary, ensuring the production binary always ends up with the right feature flags. Fixes: https://issues.redhat.com/browse/RHEL-130799 Assisted-by: Claude Code (Sonnet 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where the rhsm feature was not correctly enabled in the final binary. This was caused by the manpage generation task rebuilding the release binary without the necessary features. The fix involves changing the build order in the Makefile and bootc.spec to generate manpages before building the final binaries. This prevents the final artifact from being overwritten. A new test is also added to verify that the rhsm-gated command is present in the final binary.
The changes are logical and address the main bug. However, I've noted that while the binary is now correct, the manpages will still be generated without the rhsm-gated commands. I've added a suggestion to the Makefile to show how the features could be propagated to the manpage generation process, which would provide a more complete fix.
| .PHONY: manpages | ||
| manpages: | ||
| cargo run --package xtask -- manpages | ||
| cargo run --release --package xtask -- manpages |
There was a problem hiding this comment.
While this change correctly builds xtask in release mode, the manpages target is still run without knowledge of CARGO_FEATURES. This means the generated manpages will not include documentation for commands behind feature flags, such as publish-rhsm-facts under the rhsm feature.
To ensure the manpages are complete, you could pass CARGO_FEATURES as an environment variable to the xtask process. Note that the xtask crate would also need to be updated to read this environment variable and use it when generating the CLI data.
CARGO_FEATURES="$(CARGO_FEATURES)" cargo run --release --package xtask -- manpages
There was a problem hiding this comment.
This means the generated manpages will not include documentation for commands behind feature flags, such as publish-rhsm-facts under the rhsm feature.
Yes good observation, but that is an internal only feature so it doesn't matter.
The rhsm feature was not being propagated from the CLI crate to the lib crate, causing
bootc internals publish-rhsm-factsto never be compiled in even when building with CARGO_FEATURES=rhsm.I think this was broken when I refactored the build recently.
Change things so we build the manpages before the production binary, ensuring the production binary always ends up with the right feature flags.
Fixes: https://issues.redhat.com/browse/RHEL-130799
Assisted-by: Claude Code (Sonnet 4.5)