Skip to content

Commit ba65dd2

Browse files
authored
Merge pull request #1318 from cgwalters/minor-unused
ostree-ext: Squash some unused warnings
2 parents 9e76bad + 9e1d9eb commit ba65dd2

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ CLIPPY_CONFIG = -A clippy::all -D clippy::correctness -D clippy::suspicious -Dun
7575
validate-rust:
7676
cargo fmt -- --check -l
7777
cargo test --no-run
78+
(cd ostree-ext && cargo check --no-default-features)
7879
(cd lib && cargo check --no-default-features)
7980
cargo clippy -- $(CLIPPY_CONFIG)
8081
env RUSTDOCFLAGS='-D warnings' cargo doc --lib

ostree-ext/src/container/deploy.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
//! Perform initial setup for a container image based system root
22
33
use std::collections::HashSet;
4+
#[cfg(feature = "bootc")]
45
use std::os::fd::BorrowedFd;
5-
use std::process::Command;
66

77
use anyhow::Result;
8-
use bootc_utils::CommandRunExt;
9-
use cap_std_ext::cmdext::CapStdExtCommandExt;
108
use fn_error_context::context;
11-
use ocidir::cap_std::fs::Dir;
129
use ostree::glib;
1310

1411
use super::store::{gc_image_layers, LayeredImageState};
@@ -58,6 +55,7 @@ pub struct DeployOpts<'a> {
5855

5956
// Access the file descriptor for a sysroot
6057
#[allow(unsafe_code)]
58+
#[cfg(feature = "bootc")]
6159
pub(crate) fn sysroot_fd(sysroot: &ostree::Sysroot) -> BorrowedFd {
6260
unsafe { BorrowedFd::borrow_raw(sysroot.fd()) }
6361
}
@@ -72,7 +70,6 @@ pub async fn deploy(
7270
imgref: &OstreeImageReference,
7371
options: Option<DeployOpts<'_>>,
7472
) -> Result<Box<LayeredImageState>> {
75-
let sysroot_dir = &Dir::reopen_dir(&sysroot_fd(sysroot))?;
7673
let cancellable = ostree::gio::Cancellable::NONE;
7774
let options = options.unwrap_or_default();
7875
let repo = &sysroot.repo();
@@ -147,9 +144,15 @@ pub async fn deploy(
147144
// doesn't try to invoke this, as that won't work right now.
148145
#[cfg(feature = "bootc")]
149146
if !options.skip_completion {
147+
use bootc_utils::CommandRunExt;
148+
use cap_std_ext::cmdext::CapStdExtCommandExt;
149+
use ocidir::cap_std::fs::Dir;
150+
151+
let sysroot_dir = &Dir::reopen_dir(&sysroot_fd(sysroot))?;
152+
150153
// Note that the sysroot is provided as `.` but we use cwd_dir to
151154
// make the process current working directory the sysroot.
152-
let st = Command::new("/proc/self/exe")
155+
let st = std::process::Command::new("/proc/self/exe")
153156
.args(["internals", "bootc-install-completion", ".", stateroot])
154157
.cwd_dir(sysroot_dir.try_clone()?)
155158
.lifecycle_bind()

0 commit comments

Comments
 (0)