From 06b3317e2b9fbe7dd381133e673bc19356da2305 Mon Sep 17 00:00:00 2001 From: "bootc-bot[bot]" <225049296+bootc-bot[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 11:23:30 +0000 Subject: [PATCH 1/2] fix(deps): update rust Signed-off-by: bootc-bot[bot] <225049296+bootc-bot[bot]@users.noreply.github.com> --- Cargo.toml | 6 +++--- crates/tests-integration/Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8dec00aa8..975c4d6e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,11 +31,11 @@ inherits = "release" lto = "yes" [workspace.dependencies] -anstream = "0.6" +anstream = "1.0" anyhow = "1.0.82" camino = "1.1.6" canon-json = "0.2.1" -cap-std-ext = "4.0.3" +cap-std-ext = "5.0.0" cfg-if = "1.0" chrono = { version = "0.4.38", default-features = false } clap = "4.5.4" @@ -72,7 +72,7 @@ tempfile = "3.10.1" thiserror = "2.0.11" tokio = ">= 1.37.0" tokio-util = { features = ["io-util"], version = "0.7.10" } -toml = "0.9.5" +toml = "1.0.0" tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } tracing-journald = "0.3.1" diff --git a/crates/tests-integration/Cargo.toml b/crates/tests-integration/Cargo.toml index a2e66662a..19e98b236 100644 --- a/crates/tests-integration/Cargo.toml +++ b/crates/tests-integration/Cargo.toml @@ -27,7 +27,7 @@ bootc-kernel-cmdline = { path = "../kernel_cmdline", version = "0.0.0" } # Crate-specific dependencies libtest-mimic = "0.8.0" -oci-spec = "0.8.0" +oci-spec = "0.9.0" rexpect = "0.6" scopeguard = "1.2.0" From e66c4a6dc8d35b8edbc0736bdb3f4fb850cac710 Mon Sep 17 00:00:00 2001 From: Xiaofeng Wang Date: Tue, 24 Feb 2026 17:22:30 +0800 Subject: [PATCH 2/2] 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 --- Cargo.lock | 209 ++++++++++++++---- crates/lib/src/bootc_composefs/export.rs | 4 +- crates/lib/src/bootc_composefs/update.rs | 2 +- crates/ostree-ext/src/container/deploy.rs | 2 +- .../ostree-ext/src/container/encapsulate.rs | 8 +- crates/ostree-ext/src/container/store.rs | 4 +- .../src/container/update_detachedmeta.rs | 5 +- crates/ostree-ext/src/container_utils.rs | 2 +- crates/ostree-ext/src/fixture.rs | 5 +- crates/ostree-ext/src/integrationtest.rs | 5 +- crates/ostree-ext/src/ostree_prepareroot.rs | 2 +- crates/ostree-ext/src/sysroot.rs | 2 +- crates/ostree-ext/tests/it/main.rs | 16 +- 13 files changed, 205 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fdcd53be6..08447cdfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,7 +39,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", - "anstyle-parse", + "anstyle-parse 0.2.7", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse 1.0.0", "anstyle-query", "anstyle-wincon", "colorchoice", @@ -62,6 +77,15 @@ dependencies = [ "utf8parse", ] +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + [[package]] name = "anstyle-query" version = "1.1.5" @@ -144,7 +168,7 @@ dependencies = [ name = "bootc" version = "0.0.0" dependencies = [ - "anstream", + "anstream 1.0.0", "anyhow", "bootc-internal-utils", "bootc-lib", @@ -166,7 +190,7 @@ dependencies = [ "libc", "rustix", "serde", - "toml", + "toml 1.0.3+spec-1.1.0", ] [[package]] @@ -192,9 +216,9 @@ dependencies = [ name = "bootc-internal-utils" version = "0.1.0" dependencies = [ - "anstream", + "anstream 1.0.0", "anyhow", - "cap-std-ext", + "cap-std-ext 5.0.0", "chrono", "owo-colors", "rustix", @@ -224,7 +248,7 @@ dependencies = [ name = "bootc-lib" version = "1.12.1" dependencies = [ - "anstream", + "anstream 1.0.0", "anstyle", "anyhow", "bootc-initramfs-setup", @@ -236,7 +260,7 @@ dependencies = [ "bootc-tmpfiles", "camino", "canon-json", - "cap-std-ext", + "cap-std-ext 5.0.0", "cfg-if", "chrono", "clap", @@ -274,7 +298,7 @@ dependencies = [ "tini", "tokio", "tokio-util", - "toml", + "toml 1.0.3+spec-1.1.0", "tracing", "uapi-version", "unicode-width", @@ -289,7 +313,7 @@ dependencies = [ "anyhow", "bootc-internal-utils", "camino", - "cap-std-ext", + "cap-std-ext 5.0.0", "fn-error-context", "indoc", "libc", @@ -306,7 +330,7 @@ dependencies = [ "anyhow", "bootc-internal-utils", "camino", - "cap-std-ext", + "cap-std-ext 5.0.0", "fn-error-context", "hex", "indoc", @@ -324,7 +348,7 @@ dependencies = [ "anyhow", "bootc-internal-utils", "camino", - "cap-std-ext", + "cap-std-ext 5.0.0", "fn-error-context", "indoc", "rustix", @@ -392,7 +416,7 @@ checksum = "b6cf3aea8a5081171859ef57bc1606b1df6999df4f1110f8eef68b30098d1d3a" dependencies = [ "ambient-authority", "fs-set-times", - "io-extras", + "io-extras 0.18.4", "io-lifetimes 2.0.4", "ipnet", "maybe-owned", @@ -402,27 +426,69 @@ dependencies = [ "winx", ] +[[package]] +name = "cap-primitives" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdadbd7c002d3a484b35243669abdae85a0ebaded5a61117169dc3400f9a7ff0" +dependencies = [ + "ambient-authority", + "fs-set-times", + "io-extras 0.19.0", + "io-lifetimes 3.0.1", + "ipnet", + "maybe-owned", + "rustix", + "rustix-linux-procfs", + "windows-sys 0.61.2", + "winx", +] + [[package]] name = "cap-std" version = "3.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6dc3090992a735d23219de5c204927163d922f42f575a0189b005c62d37549a" dependencies = [ - "camino", - "cap-primitives", - "io-extras", + "cap-primitives 3.4.5", + "io-extras 0.18.4", "io-lifetimes 2.0.4", "rustix", ] +[[package]] +name = "cap-std" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7281235d6e96d3544ca18bba9049be92f4190f8d923e3caef1b5f66cfa752608" +dependencies = [ + "camino", + "cap-primitives 4.0.2", + "io-extras 0.19.0", + "io-lifetimes 3.0.1", + "rustix", +] + [[package]] name = "cap-std-ext" version = "4.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe962d42e07c22aec2618191c3683412735b7e6dcd7bab2eec811ab4697c58e" dependencies = [ - "cap-primitives", - "cap-tempfile", + "cap-primitives 3.4.5", + "cap-tempfile 3.4.5", + "libc", + "rustix", +] + +[[package]] +name = "cap-std-ext" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d201b8b353bc963f2e8c374be7866dba47082ff041fb0db2d7543f2b9c8367ce" +dependencies = [ + "cap-primitives 4.0.2", + "cap-tempfile 4.0.2", "libc", "rustix", ] @@ -433,14 +499,28 @@ version = "3.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68d8ad5cfac469e58e632590f033d45c66415ef7a8aa801409884818036706f5" dependencies = [ - "camino", - "cap-std", + "cap-std 3.4.5", "rand 0.8.5", "rustix", "rustix-linux-procfs", "uuid", ] +[[package]] +name = "cap-tempfile" +version = "4.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f22d5c0b1147e8bd9105fa004450f673c139d7e632f7edc3980f94a51f20f3" +dependencies = [ + "camino", + "cap-std 4.0.2", + "rand 0.9.2", + "rustix", + "rustix-linux-procfs", + "uuid", + "windows-sys 0.61.2", +] + [[package]] name = "cargo-platform" version = "0.3.2" @@ -540,7 +620,7 @@ version = "4.5.54" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa42cf4d2b7a41bc8f663a7cab4031ebafa1bf3875705bfaf8466dc60ab52c00" dependencies = [ - "anstream", + "anstream 0.6.21", "anstyle", "clap_lex", "strsim", @@ -651,7 +731,7 @@ dependencies = [ "containers-image-proxy", "hex", "indicatif 0.17.11", - "oci-spec", + "oci-spec 0.8.4", "rustix", "sha2", "tar", @@ -729,10 +809,10 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4efbec7ca93c60462005402029839fcc8958eb5239bab1dd09f6d3e5165911a" dependencies = [ - "cap-std-ext", + "cap-std-ext 4.0.7", "futures-util", "itertools", - "oci-spec", + "oci-spec 0.8.4", "rustix", "semver", "serde", @@ -1007,9 +1087,9 @@ checksum = "5692dd7b5a1978a5aeb0ce83b7655c58ca8efdcb79d21036ea249da95afec2c6" name = "etc-merge" version = "0.1.0" dependencies = [ - "anstream", + "anstream 1.0.0", "anyhow", - "cap-std-ext", + "cap-std-ext 5.0.0", "composefs", "fn-error-context", "hex", @@ -1474,6 +1554,16 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "io-extras" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20fd6de4ccfcc187e38bc21cfa543cb5a302cb86a8b114eb7f0bf0dc9f8ac00f" +dependencies = [ + "io-lifetimes 3.0.1", + "windows-sys 0.60.2", +] + [[package]] name = "io-lifetimes" version = "2.0.4" @@ -1595,7 +1685,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5297962ef19edda4ce33aaa484386e0a5b3d7f2f4e037cbeee00503ef6b29d33" dependencies = [ - "anstream", + "anstream 0.6.21", "anstyle", "clap", "escape8259", @@ -1806,6 +1896,23 @@ dependencies = [ "thiserror 2.0.17", ] +[[package]] +name = "oci-spec" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8445a2631507cec628a15fdd6154b54a3ab3f20ed4fe9d73a3b8b7a4e1ba03a" +dependencies = [ + "const_format", + "derive_builder", + "getset", + "regex", + "serde", + "serde_json", + "strum", + "strum_macros", + "thiserror 2.0.17", +] + [[package]] name = "ocidir" version = "0.6.0" @@ -1814,11 +1921,11 @@ checksum = "92e746e3e6a7bb57a72ea4f0b8085f84aedaab1d537a5dc5488fd3cd5af0cd67" dependencies = [ "camino", "canon-json", - "cap-std-ext", + "cap-std-ext 4.0.7", "chrono", "flate2", "hex", - "oci-spec", + "oci-spec 0.8.4", "openssl", "serde", "serde_json", @@ -1914,7 +2021,7 @@ dependencies = [ "bootc-internal-utils", "camino", "canon-json", - "cap-std-ext", + "cap-std-ext 5.0.0", "chrono", "clap", "clap_mangen", @@ -2657,7 +2764,7 @@ dependencies = [ "cfg-expr", "heck", "pkg-config", - "toml", + "toml 0.9.10+spec-1.1.0", "version-compare", ] @@ -2665,7 +2772,7 @@ dependencies = [ name = "system-reinstall-bootc" version = "0.1.9" dependencies = [ - "anstream", + "anstream 1.0.0", "anyhow", "bootc-internal-utils", "bootc-mount", @@ -2723,12 +2830,12 @@ dependencies = [ "anyhow", "bootc-kernel-cmdline", "camino", - "cap-std-ext", + "cap-std-ext 5.0.0", "clap", "fn-error-context", "indoc", "libtest-mimic", - "oci-spec", + "oci-spec 0.9.0", "rexpect", "rustix", "scopeguard", @@ -2854,7 +2961,22 @@ dependencies = [ "indexmap", "serde_core", "serde_spanned", - "toml_datetime", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow", +] + +[[package]] +name = "toml" +version = "1.0.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7614eaf19ad818347db24addfa201729cf2a9b6fdfd9eb0ab870fcacc606c0c" +dependencies = [ + "indexmap", + "serde_core", + "serde_spanned", + "toml_datetime 1.0.0+spec-1.1.0", "toml_parser", "toml_writer", "winnow", @@ -2869,6 +2991,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "toml_datetime" +version = "1.0.0+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e" +dependencies = [ + "serde_core", +] + [[package]] name = "toml_edit" version = "0.23.10+spec-1.0.0" @@ -2876,16 +3007,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" dependencies = [ "indexmap", - "toml_datetime", + "toml_datetime 0.7.5+spec-1.1.0", "toml_parser", "winnow", ] [[package]] name = "toml_parser" -version = "1.0.6+spec-1.1.0" +version = "1.0.9+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" dependencies = [ "winnow", ] @@ -3583,7 +3714,7 @@ checksum = "32ac00cd3f8ec9c1d33fb3e7958a82df6989c42d747bd326c822b1d625283547" name = "xtask" version = "0.1.0" dependencies = [ - "anstream", + "anstream 1.0.0", "anyhow", "camino", "cargo_metadata", @@ -3599,7 +3730,7 @@ dependencies = [ "serde_yaml", "tar", "tempfile", - "toml", + "toml 1.0.3+spec-1.1.0", "xshell", ] diff --git a/crates/lib/src/bootc_composefs/export.rs b/crates/lib/src/bootc_composefs/export.rs index f86392421..cbbbfbe8d 100644 --- a/crates/lib/src/bootc_composefs/export.rs +++ b/crates/lib/src/bootc_composefs/export.rs @@ -1,9 +1,11 @@ +use std::os::fd::AsFd; use std::{fs::File, os::fd::AsRawFd}; use anyhow::{Context, Result}; use cap_std_ext::cap_std::{ambient_authority, fs::Dir}; use composefs::splitstream::SplitStreamData; use composefs_oci::open_config; +use ocidir::cap_std::fs::Dir as OciCapDir; use ocidir::{OciDir, oci_spec::image::Platform}; use ostree_ext::container::Transport; use ostree_ext::container::skopeo; @@ -57,7 +59,7 @@ pub async fn export_repo_to_image( Dir::open_ambient_dir("/var/tmp", ambient_authority()).context("Opening /var/tmp")?; let tmpdir = cap_std_ext::cap_tempfile::tempdir_in(&var_tmp)?; - let oci_dir = OciDir::ensure(tmpdir.try_clone()?).context("Opening OCI")?; + let oci_dir = OciDir::ensure(OciCapDir::reopen_dir(&tmpdir.as_fd())?).context("Opening OCI")?; // Use composefs_oci::open_config to get the config and layer map let (config, layer_map) = diff --git a/crates/lib/src/bootc_composefs/update.rs b/crates/lib/src/bootc_composefs/update.rs index 978a45360..a59afe636 100644 --- a/crates/lib/src/bootc_composefs/update.rs +++ b/crates/lib/src/bootc_composefs/update.rs @@ -1,11 +1,11 @@ use anyhow::{Context, Result}; use camino::Utf8PathBuf; +use cap_std_ext::cap_std::ambient_authority; use cap_std_ext::{cap_std::fs::Dir, dirext::CapStdExtDirExt}; use composefs::fsverity::{FsVerityHashValue, Sha512HashValue}; use composefs_boot::BootOps; use composefs_oci::image::create_filesystem; use fn_error_context::context; -use ocidir::cap_std::ambient_authority; use ostree_ext::container::ManifestDiff; use crate::{ diff --git a/crates/ostree-ext/src/container/deploy.rs b/crates/ostree-ext/src/container/deploy.rs index 95f49787c..2b59daa21 100644 --- a/crates/ostree-ext/src/container/deploy.rs +++ b/crates/ostree-ext/src/container/deploy.rs @@ -148,8 +148,8 @@ pub async fn deploy( #[cfg(feature = "bootc")] if !options.skip_completion { use bootc_utils::CommandRunExt; + use cap_std_ext::cap_std::fs::Dir; use cap_std_ext::cmdext::CapStdExtCommandExt; - use ocidir::cap_std::fs::Dir; let sysroot_dir = &Dir::reopen_dir(&crate::sysroot::sysroot_fd(sysroot))?; diff --git a/crates/ostree-ext/src/container/encapsulate.rs b/crates/ostree-ext/src/container/encapsulate.rs index c4672cf92..3494b2215 100644 --- a/crates/ostree-ext/src/container/encapsulate.rs +++ b/crates/ostree-ext/src/container/encapsulate.rs @@ -8,19 +8,21 @@ use crate::objectsource::ContentID; use crate::tar as ostree_tar; use anyhow::{Context, Result, anyhow}; use camino::{Utf8Path, Utf8PathBuf}; -use cap_std::fs::Dir; use cap_std_ext::cap_std; +use cap_std_ext::cap_std::fs::Dir; use chrono::DateTime; use containers_image_proxy::oci_spec; use flate2::Compression; use fn_error_context::context; use gio::glib; use oci_spec::image as oci_image; +use ocidir::cap_std::fs::Dir as OciCapDir; use ocidir::{Layer, OciDir}; use ostree::gio; use std::borrow::Cow; use std::collections::{BTreeMap, HashMap}; use std::num::NonZeroU32; +use std::os::fd::AsFd; use tracing::instrument; /// The label which may be used in addition to the standard OCI label. @@ -355,7 +357,7 @@ async fn build_impl( if !Utf8Path::new(path).exists() { std::fs::create_dir(path).with_context(|| format!("Creating {path}"))?; } - let ocidir = Dir::open_ambient_dir(path, cap_std::ambient_authority()) + let ocidir = OciCapDir::open_ambient_dir(path, ocidir::cap_std::ambient_authority()) .with_context(|| format!("Opening {path}"))?; let mut ocidir = OciDir::ensure(ocidir).context("Opening OCI")?; build_oci(repo, ostree_ref, &mut ocidir, tag, config, opts)?; @@ -365,7 +367,7 @@ async fn build_impl( let vartmp = Dir::open_ambient_dir("/var/tmp", cap_std::ambient_authority())?; cap_std_ext::cap_tempfile::tempdir_in(&vartmp)? }; - let mut ocidir = OciDir::ensure(tempdir.try_clone()?)?; + let mut ocidir = OciDir::ensure(OciCapDir::reopen_dir(&tempdir.as_fd())?)?; // Minor TODO: refactor to avoid clone let authfile = opts.authfile.clone(); diff --git a/crates/ostree-ext/src/container/store.rs b/crates/ostree-ext/src/container/store.rs index 284b1168c..eda577b92 100644 --- a/crates/ostree-ext/src/container/store.rs +++ b/crates/ostree-ext/src/container/store.rs @@ -137,6 +137,8 @@ use camino::{Utf8Path, Utf8PathBuf}; use canon_json::CanonJsonSerialize; use cap_std_ext::cap_std; use cap_std_ext::cap_std::fs::{Dir, MetadataExt}; +use ocidir::cap_std::fs::Dir as OciCapDir; +use std::os::fd::AsFd; use cap_std_ext::dirext::CapStdExtDirExt; use containers_image_proxy::{ImageProxy, OpenedImage}; @@ -1652,7 +1654,7 @@ pub(crate) fn export_to_oci( let mut labels = HashMap::new(); - let mut dest_oci = ocidir::OciDir::ensure(dest_oci.try_clone()?)?; + let mut dest_oci = ocidir::OciDir::ensure(OciCapDir::reopen_dir(&dest_oci.as_fd())?)?; let commit_chunk_ref = commit_layer .as_ref() diff --git a/crates/ostree-ext/src/container/update_detachedmeta.rs b/crates/ostree-ext/src/container/update_detachedmeta.rs index e80934bdf..d214d77e7 100644 --- a/crates/ostree-ext/src/container/update_detachedmeta.rs +++ b/crates/ostree-ext/src/container/update_detachedmeta.rs @@ -3,9 +3,8 @@ use crate::container::{DIFFID_LABEL, skopeo}; use crate::container::{Transport, store as container_store}; use anyhow::{Context, Result, anyhow}; use camino::Utf8Path; -use cap_std::fs::Dir; -use cap_std_ext::cap_std; use containers_image_proxy::oci_spec::image as oci_image; +use ocidir::cap_std::fs::Dir; use std::io::{BufReader, BufWriter}; /// Given an OSTree container image reference, update the detached metadata (e.g. GPG signature) @@ -39,7 +38,7 @@ pub async fn update_detached_metadata( // Fork a thread to do the heavy lifting of filtering the tar stream, rewriting the manifest/config. crate::tokio_util::spawn_blocking_cancellable_flatten(move |cancellable| { // Open the temporary OCI directory. - let tempsrc = Dir::open_ambient_dir(tempsrc_ref_path, cap_std::ambient_authority()) + let tempsrc = Dir::open_ambient_dir(tempsrc_ref_path, ocidir::cap_std::ambient_authority()) .context("Opening src")?; let tempsrc = ocidir::OciDir::open(tempsrc)?; diff --git a/crates/ostree-ext/src/container_utils.rs b/crates/ostree-ext/src/container_utils.rs index 7737e986c..2ea0fae2f 100644 --- a/crates/ostree-ext/src/container_utils.rs +++ b/crates/ostree-ext/src/container_utils.rs @@ -5,7 +5,7 @@ use std::io::Read; use std::path::Path; use anyhow::Result; -use ocidir::cap_std::fs::Dir; +use cap_std_ext::cap_std::fs::Dir; use ostree::glib; use crate::keyfileext::KeyFileExt; diff --git a/crates/ostree-ext/src/fixture.rs b/crates/ostree-ext/src/fixture.rs index 20a349f67..743a62b46 100644 --- a/crates/ostree-ext/src/fixture.rs +++ b/crates/ostree-ext/src/fixture.rs @@ -15,6 +15,7 @@ use bootc_utils::CommandRunExt; use camino::{Utf8Component, Utf8Path, Utf8PathBuf}; use cap_std::fs::Dir; use cap_std_ext::cap_std; +use cap_std_ext::cap_std::fs::{DirBuilder, DirBuilderExt as _}; use cap_std_ext::prelude::CapStdExtCommandExt; use chrono::TimeZone; use containers_image_proxy::oci_spec::image as oci_image; @@ -22,7 +23,7 @@ use fn_error_context::context; use gvariant::aligned_bytes::TryAsAligned; use gvariant::{Marker, Structure}; use io_lifetimes::AsFd; -use ocidir::cap_std::fs::{DirBuilder, DirBuilderExt as _}; +use ocidir::cap_std::fs::Dir as OciCapDir; use ocidir::oci_spec::image::ImageConfigurationBuilder; use regex::Regex; use std::borrow::Cow; @@ -977,7 +978,7 @@ impl NonOstreeFixture { // Create the src/ directory dir.create_dir_all(Self::SRCOCI)?; let src_oci = dir.open_dir(Self::SRCOCI)?; - let src_oci = ocidir::OciDir::ensure(src_oci)?; + let src_oci = ocidir::OciDir::ensure(OciCapDir::reopen_dir(&src_oci.as_fd())?)?; dir.create_dir("dest")?; let destrepo = ostree::Repo::create_at_dir( diff --git a/crates/ostree-ext/src/integrationtest.rs b/crates/ostree-ext/src/integrationtest.rs index 34ac182c0..02ff518ad 100644 --- a/crates/ostree-ext/src/integrationtest.rs +++ b/crates/ostree-ext/src/integrationtest.rs @@ -5,13 +5,12 @@ use std::path::Path; use crate::container_utils::{is_ostree_container, ostree_booted}; use anyhow::{Context, Result, anyhow}; use camino::Utf8Path; -use cap_std::fs::Dir; -use cap_std_ext::cap_std; use containers_image_proxy::oci_spec; use flate2::write::GzEncoder; use fn_error_context::context; use gio::prelude::*; use oci_spec::image as oci_image; +use ocidir::cap_std::fs::Dir; use ocidir::{ LayerWriter, oci_spec::image::{Arch, Platform}, @@ -67,7 +66,7 @@ where F: for<'a> FnOnce(&mut LayerWriter<'a, GzEncoder>>) -> Result<()>, { let src = src.as_ref(); - let src = Dir::open_ambient_dir(src, cap_std::ambient_authority())?; + let src = Dir::open_ambient_dir(src, ocidir::cap_std::ambient_authority())?; let src = ocidir::OciDir::open(src)?; let idx = src.read_index()?; diff --git a/crates/ostree-ext/src/ostree_prepareroot.rs b/crates/ostree-ext/src/ostree_prepareroot.rs index d6178cde2..963d8cadf 100644 --- a/crates/ostree-ext/src/ostree_prepareroot.rs +++ b/crates/ostree-ext/src/ostree_prepareroot.rs @@ -8,9 +8,9 @@ use std::str::FromStr; use anyhow::{Context, Result}; use camino::Utf8Path; +use cap_std_ext::cap_std::fs::Dir; use cap_std_ext::dirext::CapStdExtDirExt; use fn_error_context::context; -use ocidir::cap_std::fs::Dir; use ostree::glib::object::Cast; use ostree::prelude::FileExt; use ostree::{gio, glib}; diff --git a/crates/ostree-ext/src/sysroot.rs b/crates/ostree-ext/src/sysroot.rs index f2a1ae3eb..d7bcd619e 100644 --- a/crates/ostree-ext/src/sysroot.rs +++ b/crates/ostree-ext/src/sysroot.rs @@ -3,8 +3,8 @@ use std::{ops::Deref, os::fd::BorrowedFd, time::SystemTime}; use anyhow::Result; +use cap_std_ext::cap_std::fs_utf8::Dir; use chrono::Datelike as _; -use ocidir::cap_std::fs_utf8::Dir; use ostree::gio; /// We may automatically allocate stateroots, this string is the prefix. diff --git a/crates/ostree-ext/tests/it/main.rs b/crates/ostree-ext/tests/it/main.rs index 282985cf2..712f1fa08 100644 --- a/crates/ostree-ext/tests/it/main.rs +++ b/crates/ostree-ext/tests/it/main.rs @@ -9,6 +9,7 @@ use gvariant::aligned_bytes::TryAsAligned; use gvariant::{Marker, Structure}; use oci_image::ImageManifest; use oci_spec::image as oci_image; +use ocidir::cap_std::fs::Dir as OciCapDir; use ocidir::oci_spec::distribution::Reference; use ocidir::oci_spec::image::{Arch, DigestAlgorithm}; use ostree_ext::chunking::ObjectMetaSized; @@ -23,6 +24,7 @@ use ostree_ext::{gio, glib}; use std::borrow::Cow; use std::collections::{HashMap, HashSet}; use std::io::{BufReader, BufWriter}; +use std::os::fd::AsFd; use std::process::{Command, Stdio}; use std::sync::{LazyLock, OnceLock}; use std::time::SystemTime; @@ -686,7 +688,9 @@ async fn test_export_as_container_nonderived() -> Result<()> { name: format!("{}:exported-test", fixture.path.join(exported_ocidir_name)), }; fixture.dir.create_dir(exported_ocidir_name)?; - let ocidir = ocidir::OciDir::ensure(fixture.dir.open_dir(exported_ocidir_name)?)?; + let ocidir = ocidir::OciDir::ensure(OciCapDir::reopen_dir( + &fixture.dir.open_dir(exported_ocidir_name)?.as_fd(), + )?)?; let exported = store::export(fixture.destrepo(), &src_imgref, &dest, None) .await .unwrap(); @@ -790,7 +794,9 @@ async fn test_export_as_container_derived() -> Result<()> { name: format!("{}:exported-test", fixture.path.join(exported_ocidir_name)), }; fixture.dir.create_dir(exported_ocidir_name)?; - let ocidir = ocidir::OciDir::ensure(fixture.dir.open_dir(exported_ocidir_name)?)?; + let ocidir = ocidir::OciDir::ensure(OciCapDir::reopen_dir( + &fixture.dir.open_dir(exported_ocidir_name)?.as_fd(), + )?)?; let exported = store::export(fixture.destrepo(), &derived_imgref, &dest, None) .await .unwrap(); @@ -883,7 +889,9 @@ async fn test_export_etc_remapping() -> Result<()> { name: format!("{}:exported-test", fixture.path.join(exported_ocidir_name)), }; fixture.dir.create_dir(exported_ocidir_name)?; - let ocidir = ocidir::OciDir::ensure(fixture.dir.open_dir(exported_ocidir_name)?)?; + let ocidir = ocidir::OciDir::ensure(OciCapDir::reopen_dir( + &fixture.dir.open_dir(exported_ocidir_name)?.as_fd(), + )?)?; let _exported = store::export(fixture.destrepo(), &derived_imgref, &dest, None) .await .unwrap(); @@ -986,7 +994,7 @@ async fn test_unencapsulate_unbootable() -> Result<()> { fn validate_chunked_structure(oci_path: &Utf8Path) -> Result<()> { use tar::EntryType::Link; - let d = Dir::open_ambient_dir(oci_path, cap_std::ambient_authority())?; + let d = OciCapDir::open_ambient_dir(oci_path, ocidir::cap_std::ambient_authority())?; let d = ocidir::OciDir::open(d)?; let idx = d.read_index()?; let desc = idx.manifests().first().unwrap();