From d0ece38790586b62e0cd9e30c6c0a476f53e1b82 Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Mon, 14 Sep 2026 11:29:22 -0400 Subject: [PATCH 1/2] Makefile: Don't use `cargo xtask` In https://github.com/bootc-dev/bcvk/pull/346 the manpage generation was changed to mirror bootc, however it missed the important part that bootc does not directly run `cargo xtask` but instead runs `cargo run --release --package xtask -- ...`, which is an important distinction because the former requires the `cargo-xtask` binary to be present in $PATH somewhere. In the RPM buildroot we don't have `cargo-xtask` so this fails to generate manpages via packit (and would eventually FTBFS in Fedora, too). Closes: #355 Signed-off-by: John Eckersberg --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9aa292bc4..6fc4c7d2e 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,7 @@ bin: # - Apostrophe handling fixes .PHONY: manpages manpages: - cargo xtask manpages + cargo run --release --package xtask -- manpages # This gates CI by default. Note that for clippy, we gate on # only the clippy correctness and suspicious lints, plus a select @@ -50,10 +50,10 @@ makesudoinstall: sudo make install sync-manpages: - cargo xtask sync-manpages + cargo run --release --package xtask -- sync-manpages update-manpages: - cargo xtask update-manpages + cargo run --release --package xtask -- update-manpages update-generated: sync-manpages manpages From 453cdcf8cd03e667bb6b1d017b2f405f9454369f Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Mon, 14 Sep 2026 12:32:41 -0400 Subject: [PATCH 2/2] xtask: avoid using `git rev-parse` This mirrors how bootc works, this is important because we might not have git installed (for example, in the buildroot during RPM build). Signed-off-by: John Eckersberg --- crates/xtask/src/xtask.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/crates/xtask/src/xtask.rs b/crates/xtask/src/xtask.rs index 821d01b7c..33e723fd2 100644 --- a/crates/xtask/src/xtask.rs +++ b/crates/xtask/src/xtask.rs @@ -3,6 +3,7 @@ use std::process::Command; +use camino::Utf8Path; use color_eyre::eyre::{eyre, Context, Report}; use color_eyre::Result; use xshell::Shell; @@ -19,6 +20,9 @@ const TASKS: &[(&str, fn(&Shell) -> Result<()>)] = &[ ("spec", spec), ]; +/// File used to identify the bcvk source tree toplevel. +const TOPLEVEL_MARKER: &str = "contrib/packaging/bcvk.spec"; + fn install_tracing() { use tracing_error::ErrorLayer; use tracing_subscriber::fmt; @@ -37,11 +41,23 @@ fn install_tracing() { .init(); } +/// Check if we're in a bcvk source tree by looking for [`TOPLEVEL_MARKER`]. +fn in_bcvk_source_tree() -> Result { + Utf8Path::new(TOPLEVEL_MARKER) + .try_exists() + .context("Checking for toplevel") +} + fn main() -> Result<(), Report> { install_tracing(); color_eyre::install()?; - // Ensure our working directory is the toplevel - { + + // Ensure our working directory is the bcvk source toplevel. + // First check if we're already there (e.g. when invoked from extracted + // tarball during RPM build). Only try git if we're not already in the + // right place - this avoids issues when building inside a different + // git repository. + if !in_bcvk_source_tree()? { let toplevel_path = Command::new("git") .args(["rev-parse", "--show-toplevel"]) .output()