Repository navigation
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The non-container build’s new rpm Cargo profile assumption needs maintainer validation for older supported RHEL 9 rust-toolsets because the macro definitions needed to check legacy-branch compatibility are absent from this snapshot.
No open issues 🎉
What changed in this PR
This PR reduces redundant Cargo compilation during RPM packaging while preserving the binaries built with Fedora’s rpm profile and keeping ordinary make install behavior unchanged.
Changes:
- Align release and test builds by removing
panic = "abort"and enabling Tokio’stest-utilfeature at workspace level. - Add
SKIP_BUILD=1so RPM installation reuses existing build artifacts. - Generate man pages without rebuilding bootc, using the RPM Cargo environment and profile for xtask.
| File | Description |
|---|---|
| Makefile | Adds build-skipping controls, configurable Cargo invocation, and a no-sync man-page target. |
| crates/xtask/src/xtask.rs | Adds and dispatches the manpages --no-sync option. |
| crates/xtask/src/man.rs | Adds man-page generation from existing Markdown without CLI synchronization. |
| crates/lib/Cargo.toml | Removes the redundant Tokio dev-dependency configuration. |
| contrib/packaging/bootc.spec | Uses no-sync man-page generation and skips rebuilding during installation. |
| Cargo.toml | Removes release panic-abort behavior and enables Tokio test-util workspace-wide. |
Review effort: Balanced
Good to consider that. Poked around a bit with an agent and came up with this: So I think this is fine as-is |
|
ballpark comparison, over here the f44 package job took 31m20s whereas the same job here took 19m47s. But CI uses the "container" packaging flow which previously was already a bit better optimized than the "real" builds in koji. For me a local mockbuild went from about 15m down to 5m. |
|
@jmarrero-bot review this and explain how is the rpm produced with this change different from the current ones. |
This was added in 6792973 (Aug 2023) because a panic unwinding across an `extern "C"` boundary was undefined behavior. Since Rust 1.81.0, panics reaching a non-unwind ABI boundary abort automatically, so the profile setting is no longer needed for FFI safety. Our MSRV is 1.85.0. - https://blog.rust-lang.org/2024/09/05/Rust-1.81.0/ - https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html Keeping it has a real cost: the test harness requires unwinding, so `cargo test --release` (and `%cargo_test` in the RPM build) rebuilds every dependency with a different panic strategy instead of reusing the release build. See https://doc.rust-lang.org/cargo/reference/profiles.html#panic Spawned threads/tasks have their join handles awaited, so a panic in one is propagated as an error. The one exception is the hyper connection driver task for the podman API client, where a panic would surface as a failed request instead. Assisted-by: AI Signed-off-by: John Eckersberg <dev@eckersberg.com>
The `test-util` feature was only enabled via a dev-dependency in bootc-lib (for the `start_paused` retry tests in deploy.rs). Cargo unifies dev-dependency features when building tests, so tokio and everything depending on it (hyper, tokio-util, composefs, etc.) was compiled twice: once for `cargo build --release` and again for `cargo test --release`. Enabling it in the workspace dependency means both use the same tokio build. After `cargo build --release`, `cargo test --release` now rebuilds 20 crates (workspace members and dev-only deps) instead of 36. The cost to the shipped binary is negligible: the stripped `bootc` binary grows by ~28KB (0.1%), within normal build-to-build variance. Assisted-by: AI Signed-off-by: John Eckersberg <dev@eckersberg.com>
`make install` depends on `completion` -> `bin` -> `manpages`, so the RPM %install phase re-ran cargo three times: rebuilding xtask, building bootc with the docgen feature to dump the CLI, then building the binaries again without docgen. In the Koji build log this accounted for roughly 12 minutes. Worse, `%cargo_prep` symlinks `target/release` to `target/rpm`, so these `--release` builds overwrote the `%cargo_build` output, and the RPM actually shipped binaries built with our `release` profile rather than Fedora's `rpm` profile. Add a `SKIP_BUILD=1` option to the Makefile that drops the build dependency from `completion`, and use it from the spec's %install so it only installs what %build produced. Plain `make install` is unchanged. Assisted-by: AI Signed-off-by: John Eckersberg <dev@eckersberg.com>
`make manpages` builds bootc with the docgen feature, dumps its CLI as
JSON and syncs the generated options/subcommands sections of
docs/src/man/*.md before converting them to roff. The CI `validate`
job already enforces (via `update-generated from-code --check`) that
those committed sections match the CLI, so in a release build the sync
is a no-op that costs a full extra build of bootc (~7 minutes in Koji).
Add `xtask manpages --no-sync` and a `make manpages-no-sync` target
that only do the conversion, and use it from the spec. The output is
identical to `make manpages`.
xtask itself still needs to be built, and it must not disturb the
%cargo_build state that %cargo_test reuses. %cargo_prep symlinks
target/release to target/rpm, and the %cargo_* macros run cargo with
RUSTC_BOOTSTRAP=1, which some build scripts (proc-macro2, anyhow,
thiserror) track. Building xtask with plain `cargo run --release`
therefore caused %cargo_test to rebuild 100+ crates. Add XTASK_PROFILE
and CARGO variables to the Makefile, and have the spec build xtask with
the `rpm` profile and `%{__cargo}`.
Assisted-by: AI
Signed-off-by: John Eckersberg <dev@eckersberg.com>
4962df3 to
a7f0421
Compare
|
@jmarrero The packaging changes look good to merge. Two things are worth a decision first: dropping I built both RPMs Koji-style (
Findings:
Commands, logs, readelf output and tables: https://gist.github.com/jmarrero-bot/23ecd97acbd9cabb70d4f0c56f8092c9 Generated-by: https://github.com/jmarrero-bot#llms |
The Koji RPM build was spending a lot of time recompiling the same code
over and over. This series removes those duplicate builds:
panic = "abort"from the release profile. Since Rust 1.81(we need at least 1.85), a panic that reaches an
extern "C"boundaryaborts on its own, so this setting is no longer needed for safety. The
test harness can't use it, so
cargo test --release/%cargo_testwas rebuilding every dependency with a different panic setting.
test-utilin the workspace dependency. Before, onlya dev-dependency turned it on, so tokio and everything that depends on
it was compiled once for build and again for test. With this change,
cargo test --releaseaftercargo build --releaserebuilds 20 cratesinstead of 36. The binary grows by ~28KB (0.1%).
%install.make installre-ran cargothree times (~12 minutes in Koji). These
--releasebuilds also wroteover the
%cargo_buildoutput through thetarget/release->target/rpmsymlink, so the RPM shipped binaries built with ourreleaseprofile instead of Fedora'srpmprofile. AddSKIP_BUILD=1to the Makefile and use it from the spec. Plain
make installworksthe same as before.
checks that the generated sections of the man pages match the CLI, so
re-syncing them in a release build changes nothing and costs a full
extra build (~7 minutes). Add
xtask manpages --no-sync/make manpages-no-syncand build xtask with therpmprofile and%{__cargo}so it doesn't trigger a rebuild in%cargo_test.The output is identical to
make manpages.Assisted-by: AI