Skip to content

Commit 1faa5ce

Browse files
committed
fix(deps): Use cap_std_ext re-exports instead of ocidir
The cap-std-ext upgrade from 4.0.3 to 5.0.0 introduced a version mismatch: ocidir v0.6.0 depends on cap-std-ext v4.0.7 (cap-std v3.4.5), while the workspace now uses cap-std-ext v5.0.0 (cap-std v4.0.2). Using ocidir::cap_std re-exports caused type mismatches when combined with traits from the workspace's cap-std-ext. Fix by using cap_std_ext::cap_std re-exports consistently. Assisted-by: Claude Code (Opus 4.5) Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
1 parent 06b3317 commit 1faa5ce

12 files changed

Lines changed: 202 additions & 60 deletions

File tree

Cargo.lock

Lines changed: 170 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/lib/src/bootc_composefs/update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use anyhow::{Context, Result};
22
use camino::Utf8PathBuf;
3+
use cap_std_ext::cap_std::ambient_authority;
34
use cap_std_ext::{cap_std::fs::Dir, dirext::CapStdExtDirExt};
45
use composefs::fsverity::{FsVerityHashValue, Sha512HashValue};
56
use composefs_boot::BootOps;
67
use composefs_oci::image::create_filesystem;
78
use fn_error_context::context;
8-
use ocidir::cap_std::ambient_authority;
99
use ostree_ext::container::ManifestDiff;
1010

1111
use crate::{

crates/ostree-ext/src/container/deploy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ pub async fn deploy(
148148
#[cfg(feature = "bootc")]
149149
if !options.skip_completion {
150150
use bootc_utils::CommandRunExt;
151+
use cap_std_ext::cap_std::fs::Dir;
151152
use cap_std_ext::cmdext::CapStdExtCommandExt;
152-
use ocidir::cap_std::fs::Dir;
153153

154154
let sysroot_dir = &Dir::reopen_dir(&crate::sysroot::sysroot_fd(sysroot))?;
155155

crates/ostree-ext/src/container/encapsulate.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@ use crate::objectsource::ContentID;
88
use crate::tar as ostree_tar;
99
use anyhow::{Context, Result, anyhow};
1010
use camino::{Utf8Path, Utf8PathBuf};
11-
use cap_std::fs::Dir;
1211
use cap_std_ext::cap_std;
12+
use cap_std_ext::cap_std::fs::Dir;
1313
use chrono::DateTime;
1414
use containers_image_proxy::oci_spec;
1515
use flate2::Compression;
1616
use fn_error_context::context;
1717
use gio::glib;
1818
use oci_spec::image as oci_image;
19+
use ocidir::cap_std::fs::Dir as OciCapDir;
1920
use ocidir::{Layer, OciDir};
2021
use ostree::gio;
2122
use std::borrow::Cow;
2223
use std::collections::{BTreeMap, HashMap};
2324
use std::num::NonZeroU32;
25+
use std::os::fd::AsFd;
2426
use tracing::instrument;
2527

2628
/// The label which may be used in addition to the standard OCI label.
@@ -355,7 +357,7 @@ async fn build_impl(
355357
if !Utf8Path::new(path).exists() {
356358
std::fs::create_dir(path).with_context(|| format!("Creating {path}"))?;
357359
}
358-
let ocidir = Dir::open_ambient_dir(path, cap_std::ambient_authority())
360+
let ocidir = OciCapDir::open_ambient_dir(path, ocidir::cap_std::ambient_authority())
359361
.with_context(|| format!("Opening {path}"))?;
360362
let mut ocidir = OciDir::ensure(ocidir).context("Opening OCI")?;
361363
build_oci(repo, ostree_ref, &mut ocidir, tag, config, opts)?;
@@ -365,7 +367,7 @@ async fn build_impl(
365367
let vartmp = Dir::open_ambient_dir("/var/tmp", cap_std::ambient_authority())?;
366368
cap_std_ext::cap_tempfile::tempdir_in(&vartmp)?
367369
};
368-
let mut ocidir = OciDir::ensure(tempdir.try_clone()?)?;
370+
let mut ocidir = OciDir::ensure(OciCapDir::reopen_dir(&tempdir.as_fd())?)?;
369371

370372
// Minor TODO: refactor to avoid clone
371373
let authfile = opts.authfile.clone();

crates/ostree-ext/src/container/store.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ use camino::{Utf8Path, Utf8PathBuf};
137137
use canon_json::CanonJsonSerialize;
138138
use cap_std_ext::cap_std;
139139
use cap_std_ext::cap_std::fs::{Dir, MetadataExt};
140+
use ocidir::cap_std::fs::Dir as OciCapDir;
141+
use std::os::fd::AsFd;
140142

141143
use cap_std_ext::dirext::CapStdExtDirExt;
142144
use containers_image_proxy::{ImageProxy, OpenedImage};
@@ -1652,7 +1654,7 @@ pub(crate) fn export_to_oci(
16521654

16531655
let mut labels = HashMap::new();
16541656

1655-
let mut dest_oci = ocidir::OciDir::ensure(dest_oci.try_clone()?)?;
1657+
let mut dest_oci = ocidir::OciDir::ensure(OciCapDir::reopen_dir(&dest_oci.as_fd())?)?;
16561658

16571659
let commit_chunk_ref = commit_layer
16581660
.as_ref()

crates/ostree-ext/src/container/update_detachedmeta.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ use crate::container::{DIFFID_LABEL, skopeo};
33
use crate::container::{Transport, store as container_store};
44
use anyhow::{Context, Result, anyhow};
55
use camino::Utf8Path;
6-
use cap_std::fs::Dir;
7-
use cap_std_ext::cap_std;
86
use containers_image_proxy::oci_spec::image as oci_image;
7+
use ocidir::cap_std::fs::Dir;
98
use std::io::{BufReader, BufWriter};
109

1110
/// Given an OSTree container image reference, update the detached metadata (e.g. GPG signature)
@@ -39,7 +38,7 @@ pub async fn update_detached_metadata(
3938
// Fork a thread to do the heavy lifting of filtering the tar stream, rewriting the manifest/config.
4039
crate::tokio_util::spawn_blocking_cancellable_flatten(move |cancellable| {
4140
// Open the temporary OCI directory.
42-
let tempsrc = Dir::open_ambient_dir(tempsrc_ref_path, cap_std::ambient_authority())
41+
let tempsrc = Dir::open_ambient_dir(tempsrc_ref_path, ocidir::cap_std::ambient_authority())
4342
.context("Opening src")?;
4443
let tempsrc = ocidir::OciDir::open(tempsrc)?;
4544

crates/ostree-ext/src/container_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::io::Read;
55
use std::path::Path;
66

77
use anyhow::Result;
8-
use ocidir::cap_std::fs::Dir;
8+
use cap_std_ext::cap_std::fs::Dir;
99
use ostree::glib;
1010

1111
use crate::keyfileext::KeyFileExt;

crates/ostree-ext/src/fixture.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ use bootc_utils::CommandRunExt;
1515
use camino::{Utf8Component, Utf8Path, Utf8PathBuf};
1616
use cap_std::fs::Dir;
1717
use cap_std_ext::cap_std;
18+
use cap_std_ext::cap_std::fs::{DirBuilder, DirBuilderExt as _};
1819
use cap_std_ext::prelude::CapStdExtCommandExt;
1920
use chrono::TimeZone;
2021
use containers_image_proxy::oci_spec::image as oci_image;
2122
use fn_error_context::context;
2223
use gvariant::aligned_bytes::TryAsAligned;
2324
use gvariant::{Marker, Structure};
2425
use io_lifetimes::AsFd;
25-
use ocidir::cap_std::fs::{DirBuilder, DirBuilderExt as _};
26+
use ocidir::cap_std::fs::Dir as OciCapDir;
2627
use ocidir::oci_spec::image::ImageConfigurationBuilder;
2728
use regex::Regex;
2829
use std::borrow::Cow;
@@ -977,7 +978,7 @@ impl NonOstreeFixture {
977978
// Create the src/ directory
978979
dir.create_dir_all(Self::SRCOCI)?;
979980
let src_oci = dir.open_dir(Self::SRCOCI)?;
980-
let src_oci = ocidir::OciDir::ensure(src_oci)?;
981+
let src_oci = ocidir::OciDir::ensure(OciCapDir::reopen_dir(&src_oci.as_fd())?)?;
981982

982983
dir.create_dir("dest")?;
983984
let destrepo = ostree::Repo::create_at_dir(

crates/ostree-ext/src/integrationtest.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ use std::path::Path;
55
use crate::container_utils::{is_ostree_container, ostree_booted};
66
use anyhow::{Context, Result, anyhow};
77
use camino::Utf8Path;
8-
use cap_std::fs::Dir;
9-
use cap_std_ext::cap_std;
108
use containers_image_proxy::oci_spec;
119
use flate2::write::GzEncoder;
1210
use fn_error_context::context;
1311
use gio::prelude::*;
1412
use oci_spec::image as oci_image;
13+
use ocidir::cap_std::fs::Dir;
1514
use ocidir::{
1615
LayerWriter,
1716
oci_spec::image::{Arch, Platform},
@@ -67,7 +66,7 @@ where
6766
F: for<'a> FnOnce(&mut LayerWriter<'a, GzEncoder<ocidir::BlobWriter<'a>>>) -> Result<()>,
6867
{
6968
let src = src.as_ref();
70-
let src = Dir::open_ambient_dir(src, cap_std::ambient_authority())?;
69+
let src = Dir::open_ambient_dir(src, ocidir::cap_std::ambient_authority())?;
7170
let src = ocidir::OciDir::open(src)?;
7271

7372
let idx = src.read_index()?;

crates/ostree-ext/src/ostree_prepareroot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use std::str::FromStr;
88

99
use anyhow::{Context, Result};
1010
use camino::Utf8Path;
11+
use cap_std_ext::cap_std::fs::Dir;
1112
use cap_std_ext::dirext::CapStdExtDirExt;
1213
use fn_error_context::context;
13-
use ocidir::cap_std::fs::Dir;
1414
use ostree::glib::object::Cast;
1515
use ostree::prelude::FileExt;
1616
use ostree::{gio, glib};

0 commit comments

Comments
 (0)