diff --git a/Makefile b/Makefile index 9b2d29619..5697d7dc1 100644 --- a/Makefile +++ b/Makefile @@ -75,6 +75,7 @@ CLIPPY_CONFIG = -A clippy::all -D clippy::correctness -D clippy::suspicious -Dun validate-rust: cargo fmt -- --check -l cargo test --no-run + (cd ostree-ext && cargo check --no-default-features) (cd lib && cargo check --no-default-features) cargo clippy -- $(CLIPPY_CONFIG) env RUSTDOCFLAGS='-D warnings' cargo doc --lib diff --git a/ostree-ext/src/container/deploy.rs b/ostree-ext/src/container/deploy.rs index aaadda782..90001581b 100644 --- a/ostree-ext/src/container/deploy.rs +++ b/ostree-ext/src/container/deploy.rs @@ -1,14 +1,11 @@ //! Perform initial setup for a container image based system root use std::collections::HashSet; +#[cfg(feature = "bootc")] use std::os::fd::BorrowedFd; -use std::process::Command; use anyhow::Result; -use bootc_utils::CommandRunExt; -use cap_std_ext::cmdext::CapStdExtCommandExt; use fn_error_context::context; -use ocidir::cap_std::fs::Dir; use ostree::glib; use super::store::{gc_image_layers, LayeredImageState}; @@ -58,6 +55,7 @@ pub struct DeployOpts<'a> { // Access the file descriptor for a sysroot #[allow(unsafe_code)] +#[cfg(feature = "bootc")] pub(crate) fn sysroot_fd(sysroot: &ostree::Sysroot) -> BorrowedFd { unsafe { BorrowedFd::borrow_raw(sysroot.fd()) } } @@ -72,7 +70,6 @@ pub async fn deploy( imgref: &OstreeImageReference, options: Option>, ) -> Result> { - let sysroot_dir = &Dir::reopen_dir(&sysroot_fd(sysroot))?; let cancellable = ostree::gio::Cancellable::NONE; let options = options.unwrap_or_default(); let repo = &sysroot.repo(); @@ -147,9 +144,15 @@ pub async fn deploy( // doesn't try to invoke this, as that won't work right now. #[cfg(feature = "bootc")] if !options.skip_completion { + use bootc_utils::CommandRunExt; + use cap_std_ext::cmdext::CapStdExtCommandExt; + use ocidir::cap_std::fs::Dir; + + let sysroot_dir = &Dir::reopen_dir(&sysroot_fd(sysroot))?; + // Note that the sysroot is provided as `.` but we use cwd_dir to // make the process current working directory the sysroot. - let st = Command::new("/proc/self/exe") + let st = std::process::Command::new("/proc/self/exe") .args(["internals", "bootc-install-completion", ".", stateroot]) .cwd_dir(sysroot_dir.try_clone()?) .lifecycle_bind()