diff --git a/Cargo.lock b/Cargo.lock index 7183d05614..4d340d335c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,17 +100,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -214,7 +203,7 @@ dependencies = [ "io-lifetimes", "ipnet", "maybe-owned", - "rustix 0.37.18", + "rustix 0.37.19", "windows-sys 0.48.0", "winx", ] @@ -229,7 +218,7 @@ dependencies = [ "cap-primitives", "io-extras", "io-lifetimes", - "rustix 0.37.18", + "rustix 0.37.19", ] [[package]] @@ -242,6 +231,16 @@ dependencies = [ "rustix 0.36.13", ] +[[package]] +name = "cap-std-ext" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6012b1e726e3e3ccf8151e2dc9cb454e593e0e7623b0e35464f5e62a15158c27" +dependencies = [ + "cap-tempfile", + "rustix 0.37.19", +] + [[package]] name = "cap-tempfile" version = "1.0.14" @@ -250,7 +249,7 @@ checksum = "92372a5de78a858f20c22a8dbe3ea55e1cc2daeb82016a3150dab8cf51ea3235" dependencies = [ "cap-std", "rand", - "rustix 0.37.18", + "rustix 0.37.19", "uuid 1.3.2", ] @@ -303,23 +302,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "clap" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" -dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_derive 3.2.25", - "clap_lex 0.2.4", - "indexmap", - "once_cell", - "strsim", - "termcolor", - "textwrap", -] - [[package]] name = "clap" version = "4.3.0" @@ -327,7 +309,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" dependencies = [ "clap_builder", - "clap_derive 4.3.0", + "clap_derive", "once_cell", ] @@ -340,23 +322,10 @@ dependencies = [ "anstream", "anstyle", "bitflags 1.3.2", - "clap_lex 0.5.0", + "clap_lex", "strsim", ] -[[package]] -name = "clap_derive" -version = "3.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" -dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "clap_derive" version = "4.3.0" @@ -369,15 +338,6 @@ dependencies = [ "syn 2.0.15", ] -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - [[package]] name = "clap_lex" version = "0.5.0" @@ -451,7 +411,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc8ef9cc4d183f3bfd3c232f304286b91cff5c9aa35665ea2e89499e1e0d021" dependencies = [ "anyhow", - "cap-std-ext", + "cap-std-ext 1.0.3", "cap-tempfile", "capctl", "fn-error-context", @@ -882,7 +842,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7833d0f115a013d51c55950a3b09d30e4b057be9961b709acb9b5b17a1108861" dependencies = [ "io-lifetimes", - "rustix 0.37.18", + "rustix 0.37.19", "windows-sys 0.48.0", ] @@ -1156,15 +1116,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.2.6" @@ -1384,7 +1335,7 @@ checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix 0.37.18", + "rustix 0.37.19", "windows-sys 0.48.0", ] @@ -1538,7 +1489,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.37.18", + "rustix 0.37.19", ] [[package]] @@ -1794,17 +1745,11 @@ dependencies = [ "lazy_static", ] -[[package]] -name = "os_str_bytes" -version = "6.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" - [[package]] name = "ostree" -version = "0.17.1" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f9c3da362376d17ac2e2d5759fe544cdc7471b66e98c324be5efd2c7995672d" +checksum = "054f5bd13c1ac78c922aa05fbf4c55730d7a3fc6490b1b65335b00e880a63334" dependencies = [ "base64 0.20.0", "bitflags 1.3.2", @@ -1821,18 +1766,18 @@ dependencies = [ [[package]] name = "ostree-ext" -version = "0.10.7" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "887272baf181e1e2e9333cb7c57d7ee7b3e1f07278798b0f3e4403a5b823ebd2" +checksum = "8903d59c4a56794b6ef8a2b11a5674fe85b370f1da33ae34450a6de1e39a20d6" dependencies = [ "anyhow", "async-compression", "bitflags 1.3.2", "camino", - "cap-std-ext", + "cap-std-ext 2.0.0", "cap-tempfile", "chrono", - "clap 3.2.25", + "clap", "containers-image-proxy", "flate2", "fn-error-context", @@ -1843,13 +1788,13 @@ dependencies = [ "io-lifetimes", "libc", "libsystemd", - "oci-spec", "olpc-cjson", "once_cell", "openssl", "ostree", "pin-project", "regex", + "rustix 0.37.19", "serde", "serde_json", "tar", @@ -1863,9 +1808,9 @@ dependencies = [ [[package]] name = "ostree-sys" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe57dcbabc3b1ef80f97eb614453d90dc81a39c8f26eb540bd8e68bcae4d0e2f" +checksum = "de67826255aa25d812bcd9b9f9dafb575b0b160adbe34d83d69c73c19d6b3e0c" dependencies = [ "gio-sys", "glib-sys", @@ -2223,10 +2168,10 @@ dependencies = [ "camino", "cap-primitives", "cap-std", - "cap-std-ext", + "cap-std-ext 2.0.0", "cap-tempfile", "chrono", - "clap 4.3.0", + "clap", "containers-image-proxy", "cxx", "either", @@ -2255,7 +2200,7 @@ dependencies = [ "reqwest", "rpmostree-client", "rust-ini", - "rustix 0.36.13", + "rustix 0.37.19", "serde", "serde_derive", "serde_json", @@ -2298,9 +2243,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.18" +version = "0.37.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bbfc1d1c7c40c01715f47d71444744a81669ca84e8b63e25a55e169b1f86433" +checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" dependencies = [ "bitflags 1.3.2", "errno", @@ -2593,7 +2538,7 @@ dependencies = [ "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.18", + "rustix 0.37.19", "windows-sys 0.45.0", ] @@ -2616,12 +2561,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - [[package]] name = "thiserror" version = "1.0.40" diff --git a/Cargo.toml b/Cargo.toml index 82ebb8c11b..ed884fdd2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,12 +45,12 @@ anyhow = "1.0.69" binread = "2.2.0" bitflags = "2.3" camino = "1.1.1" -cap-std-ext = "1.0" +cap-std-ext = "2.0" cap-std = { version = "1.0.3", features = ["fs_utf8"] } containers-image-proxy = "0.5.1" # Explicitly force on libc -rustix = { version = "0.36", features = ["use-libc"] } -cap-primitives = "1.0.15" +rustix = { version = "0.37", features = ["use-libc"] } +cap-primitives = "1.0.3" cap-tempfile = "1.0.1" chrono = { version = "0.4.23", features = ["serde"] } clap = { version = "4.3", features = ["derive"] } @@ -72,7 +72,7 @@ nix = "0.26.1" openssl = "0.10.49" once_cell = "1.16.0" os-release = "0.1.0" -ostree-ext = "0.10.0" +ostree-ext = "0.11.0" paste = "1.0" phf = { version = "0.11", features = ["macros"] } rand = "0.8.5" diff --git a/rust/src/builtins/apply_live.rs b/rust/src/builtins/apply_live.rs index 04dee2ae3e..0816fe1e5f 100644 --- a/rust/src/builtins/apply_live.rs +++ b/rust/src/builtins/apply_live.rs @@ -36,7 +36,7 @@ fn get_args_variant(sysroot: &ostree::Sysroot, opts: &Opts) -> Result CxxResult let sysroot = sysroot.glib_reborrow(); let cancellable = gio::Cancellable::NONE; sysroot.load_if_changed(cancellable)?; - let repo = &sysroot.repo().unwrap(); + let repo = &sysroot.repo(); let booted = &sysroot.require_booted_deployment()?; - let booted_commit = booted.csum().expect("csum"); + let booted_commit = booted.csum(); let booted_commit = booted_commit.as_str(); let live_state = live::get_live_state(repo, booted)? diff --git a/rust/src/builtins/compose/mod.rs b/rust/src/builtins/compose/mod.rs index e4f033322e..ce916ba3f7 100644 --- a/rust/src/builtins/compose/mod.rs +++ b/rust/src/builtins/compose/mod.rs @@ -9,9 +9,8 @@ use anyhow::{Context, Result}; use cap_std::fs::{Dir, DirBuilder, Permissions}; use cap_std_ext::cap_std; use cap_std_ext::dirext::CapStdExtDirExt; -use cap_std_ext::rustix; -use cap_std_ext::rustix::fd::AsFd; use fn_error_context::context; +use rustix::fd::AsFd; use rustix::fs::{FileType, MetadataExt}; use std::io::Read; use std::os::unix::fs::DirBuilderExt; diff --git a/rust/src/bwrap.rs b/rust/src/bwrap.rs index a6370dbf55..5bf6cdff28 100644 --- a/rust/src/bwrap.rs +++ b/rust/src/bwrap.rs @@ -8,7 +8,6 @@ use crate::normalization; use anyhow::{Context, Result}; use cap_std::fs::Dir; use cap_std_ext::prelude::{CapStdExtCommandExt, CapStdExtDirExt}; -use cap_std_ext::rustix; use fn_error_context::context; use ostree_ext::{gio, glib}; use std::num::NonZeroUsize; diff --git a/rust/src/client.rs b/rust/src/client.rs index 35c08c6b7d..35efd4ef70 100644 --- a/rust/src/client.rs +++ b/rust/src/client.rs @@ -7,7 +7,6 @@ use crate::cxxrsutil::*; use crate::ffi::SystemHostType; use crate::utils; use anyhow::{anyhow, Result}; -use cap_std_ext::rustix; use fn_error_context::context; use gio::prelude::*; use ostree_ext::{gio, glib}; diff --git a/rust/src/cliwrap/cliutil.rs b/rust/src/cliwrap/cliutil.rs index bd4599f447..5cfb9d525b 100644 --- a/rust/src/cliwrap/cliutil.rs +++ b/rust/src/cliwrap/cliutil.rs @@ -1,7 +1,6 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT use anyhow::Result; -use cap_std_ext::rustix; use nix::sys::statvfs; use std::os::unix::process::CommandExt; use std::{thread, time}; diff --git a/rust/src/compose.rs b/rust/src/compose.rs index 418a2df4b9..eea75b0cf3 100644 --- a/rust/src/compose.rs +++ b/rust/src/compose.rs @@ -292,7 +292,7 @@ pub(crate) fn compose_image(args: Vec) -> CxxResult<()> { Ok::<_, anyhow::Error>(manifest) })?; - let diff = ostree_ext::container::manifest_diff(&previous_meta.manifest, &new_manifest); + let diff = ostree_ext::container::ManifestDiff::new(&previous_meta.manifest, &new_manifest); diff.print(); } @@ -315,8 +315,8 @@ pub(crate) fn configure_build_repo_from_target( let target_repo = &target_repo.glib_reborrow(); let mut changed = false; - let build_config = build_repo.config().unwrap(); - let target_config = target_repo.copy_config().unwrap(); + let build_config = build_repo.config(); + let target_config = target_repo.copy_config(); for (group, key) in propagated_bools { if let Some(v) = target_config.optional_bool(group, key)? { changed = true; diff --git a/rust/src/composepost.rs b/rust/src/composepost.rs index 2dc83e7594..1098bcf664 100644 --- a/rust/src/composepost.rs +++ b/rust/src/composepost.rs @@ -22,12 +22,12 @@ use cap_std::io_lifetimes::AsFilelike; use cap_std_ext::cap_std; use cap_std_ext::cap_std::fs::Permissions; use cap_std_ext::dirext::CapStdExtDirExt; -use cap_std_ext::rustix::fs::MetadataExt; use fn_error_context::context; use gio::prelude::*; use gio::FileType; use ostree_ext::{gio, glib}; use rayon::prelude::*; +use rustix::fs::MetadataExt; use std::borrow::Cow; use std::collections::BTreeSet; use std::fmt::Write as FmtWrite; @@ -1245,7 +1245,7 @@ fn hardlink_recurse( mod tests { use super::*; use cap_std::fs::{Dir, DirBuilder}; - use cap_std_ext::{cap_std, rustix}; + use cap_std_ext::cap_std; #[test] fn stripany() { diff --git a/rust/src/container.rs b/rust/src/container.rs index b703419eda..50fcf25a55 100644 --- a/rust/src/container.rs +++ b/rust/src/container.rs @@ -16,7 +16,7 @@ use chrono::prelude::*; use clap::Parser; use ostree::glib; use ostree_ext::chunking::ObjectMetaSized; -use ostree_ext::container::{Config, ExportLayout, ExportOpts, ImageReference}; +use ostree_ext::container::{Config, ExportOpts, ImageReference}; use ostree_ext::objectsource::{ ContentID, ObjectMeta, ObjectMetaMap, ObjectMetaSet, ObjectSourceMeta, }; @@ -166,13 +166,13 @@ fn build_mapping_recurse( } } - let checksum = child.checksum().unwrap().to_string(); + let checksum = child.checksum().to_string(); match state.content.entry(checksum) { Entry::Vacant(v) => { v.insert(pkgid); } Entry::Occupied(_) => { - let checksum = child.checksum().unwrap().to_string(); + let checksum = child.checksum().to_string(); let v = state.duplicates.entry(checksum).or_default(); v.push(pkgid); } @@ -212,7 +212,7 @@ async fn compare_builds(old_build: &str, new_build: &str) -> Result<()> { let (_, manifest_old) = proxy.fetch_manifest(&oi_old).await?; let oi_now = proxy.open_image(new_build).await?; let (_, new_manifest) = proxy.fetch_manifest(&oi_now).await?; - let diff = ostree_ext::container::manifest_diff(&manifest_old, &new_manifest); + let diff = ostree_ext::container::ManifestDiff::new(&manifest_old, &new_manifest); diff.print(); Ok(()) } @@ -315,7 +315,7 @@ pub fn container_encapsulate(args: Vec) -> CxxResult<()> { .try_into() .map_err(anyhow::Error::msg)?; let initramfs = initramfs.downcast_ref::().unwrap(); - let checksum = initramfs.checksum().unwrap(); + let checksum = initramfs.checksum(); let name = format!("initramfs (kernel {})", kernel_ver).into_boxed_str(); let name = Rc::from(name); state.content.insert(checksum.to_string(), Rc::clone(&name)); @@ -396,16 +396,10 @@ pub fn container_encapsulate(args: Vec) -> CxxResult<()> { labels: Some(labels), cmd: opt.cmd, }; - let format = match opt.format_version { - 0 => ExportLayout::V0, - 1 => ExportLayout::V1, - n => return Err(anyhow::anyhow!("Invalid format version {n}").into()), - }; let opts = ExportOpts { copy_meta_keys, copy_meta_opt_keys, max_layers: opt.max_layers, - format, ..Default::default() }; let handle = tokio::runtime::Handle::current(); diff --git a/rust/src/countme.rs b/rust/src/countme.rs index ca5f13813c..2af6a3be6c 100644 --- a/rust/src/countme.rs +++ b/rust/src/countme.rs @@ -3,7 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT use anyhow::{bail, Context, Result}; -use cap_std_ext::rustix; use os_release::OsRelease; use std::path; diff --git a/rust/src/daemon.rs b/rust/src/daemon.rs index 3bf2178cf7..c78b9e372b 100644 --- a/rust/src/daemon.rs +++ b/rust/src/daemon.rs @@ -10,8 +10,8 @@ use crate::ffi::{ }; use anyhow::{anyhow, format_err, Result}; use cap_std::fs::Dir; +use cap_std_ext::cap_std; use cap_std_ext::dirext::CapStdExtDirExt; -use cap_std_ext::{cap_std, rustix}; use fn_error_context::context; use glib::prelude::*; use ostree_ext::{gio, glib, ostree}; @@ -146,8 +146,8 @@ pub(crate) fn deployment_populate_variant( // First, basic values from ostree dict.insert("id", &id); - dict.insert("osname", &deployment.osname().expect("osname").as_str()); - dict.insert("checksum", &deployment.csum().expect("csum").as_str()); + dict.insert("osname", &deployment.osname().as_str()); + dict.insert("checksum", &deployment.csum().as_str()); dict.insert_value("serial", &(deployment.deployserial() as i32).to_variant()); let booted: bool = sysroot @@ -178,9 +178,7 @@ pub(crate) fn deployment_populate_variant( // Unwrap safety: This always returns a value dict.insert( "unlocked", - &ostree::Deployment::unlocked_state_to_string(unlocked) - .unwrap() - .as_str(), + &ostree::Deployment::unlocked_state_to_string(unlocked).as_str(), ); // Some of the origin-based state. But not all yet; see the rest of the @@ -220,7 +218,7 @@ fn deployment_layeredmeta_from_commit_impl( .unwrap_or_else(|| dict.contains("rpmostree.spec")); if !is_layered { // SAFETY: return value is "not nullable". - let checksum = deployment.csum().unwrap(); + let checksum = deployment.csum(); Ok(crate::ffi::DeploymentLayeredMeta { is_layered, base_commit: checksum.into(), @@ -258,7 +256,7 @@ pub(crate) fn deployment_layeredmeta_load_commit( deployment: &ostree::Deployment, ) -> Result { // SAFETY: return value is "not nullable". - let checksum = deployment.csum().unwrap(); + let checksum = deployment.csum(); let commit = &repo.load_variant(ostree::ObjectType::Commit, &checksum)?; deployment_layeredmeta_from_commit_impl(deployment, commit) } @@ -353,7 +351,7 @@ fn get_cached_signatures_variant( let n = verify_result.count_all(); let mut sigs: Vec = Vec::with_capacity(n as usize); for i in 0..n { - sigs.push(glib::Variant::from_variant(&verify_result.all(i).unwrap())); // we know index is in range + sigs.push(glib::Variant::from_variant(&verify_result.all(i))); // we know index is in range } let v = glib::Variant::array_from_iter_with_type(&*glib::Variant::static_variant_type(), sigs); diff --git a/rust/src/deployment_utils.rs b/rust/src/deployment_utils.rs index 5bf5003861..b284469d4a 100644 --- a/rust/src/deployment_utils.rs +++ b/rust/src/deployment_utils.rs @@ -20,8 +20,8 @@ pub(crate) fn deployment_generate_id_impl(deployment: &ostree::Deployment) -> St // SAFETY: the results of these are not-nullable in the C API. format!( "{}-{}.{}", - deployment.osname().unwrap(), - deployment.csum().unwrap(), + deployment.osname(), + deployment.csum(), deployment.deployserial() ) } @@ -64,7 +64,7 @@ pub fn deployment_checksum_for_id( let deployment = deployment_for_id_impl(sysroot, deploy_id)?; // SAFETY: result is not-nullable in the C API. - let csum = deployment.csum().unwrap(); + let csum = deployment.csum(); Ok(csum.to_string()) } diff --git a/rust/src/fedora_integration.rs b/rust/src/fedora_integration.rs index 3c7ebbbdd7..d94eebfafa 100644 --- a/rust/src/fedora_integration.rs +++ b/rust/src/fedora_integration.rs @@ -232,8 +232,8 @@ fn get_base_package_list() -> Result> { let default = deployments .get(0) .ok_or_else(|| anyhow::anyhow!("No deployments found"))?; - let checksum = default.csum().unwrap(); - let repo = sysroot.repo().unwrap(); + let checksum = default.csum(); + let repo = sysroot.repo(); let pkglist = { let cancellable = gio::Cancellable::new(); let r = crate::ffi::package_variant_list_for_commit( diff --git a/rust/src/ffiutil.rs b/rust/src/ffiutil.rs index 30c1e65712..c73cd09124 100644 --- a/rust/src/ffiutil.rs +++ b/rust/src/ffiutil.rs @@ -31,7 +31,7 @@ //! Functions named `ffi_new_` create a copy of their inputs, and can safely //! outlive the function call. -use cap_std_ext::{cap_std, rustix}; +use cap_std_ext::cap_std; /// Create a new cap_std directory for an openat version. /// This creates a new file descriptor, because we can't guarantee they are diff --git a/rust/src/live.rs b/rust/src/live.rs index 52ecd7ff98..f607db4525 100644 --- a/rust/src/live.rs +++ b/rust/src/live.rs @@ -49,7 +49,7 @@ fn get_runstate_dir(deploy: &ostree::Deployment) -> PathBuf { format!( "{}/{}.{}", OSTREE_RUNSTATE_DIR, - deploy.csum().expect("csum"), + deploy.csum(), deploy.deployserial() ) .into() @@ -233,7 +233,7 @@ fn update_etc( // The labels for /etc and /usr/etc may differ; ensure that we label // the files with the /etc target, even though we're checking out // from /usr/etc. This is the same as what libostree does. - if sepolicy.name().is_some() { + if sepolicy.name().len() > 0 { opts.sepolicy = Some(sepolicy.clone()); } // Added directories and files @@ -344,11 +344,11 @@ pub(crate) fn transaction_apply_live( .lookup(OPT_REPLACE) .map_err(anyhow::Error::msg)? .unwrap_or_default(); - let repo = &sysroot.repo().expect("repo"); + let repo = &sysroot.repo(); let booted = sysroot.require_booted_deployment()?; - let osname = booted.osname().expect("osname"); - let booted_commit = booted.csum().expect("csum"); + let osname = booted.osname(); + let booted_commit = booted.csum(); let booted_commit = booted_commit.as_str(); let target_commit = if let Some(t) = target { @@ -356,7 +356,7 @@ pub(crate) fn transaction_apply_live( } else { match sysroot.query_deployments_for(Some(osname.as_str())) { (Some(pending), _) => { - let pending_commit = pending.csum().expect("csum"); + let pending_commit = pending.csum(); let pending_commit = pending_commit.as_str(); Cow::Owned(pending_commit.to_string()) } @@ -497,7 +497,7 @@ pub(crate) fn transaction_apply_live( /// doesn't have a live apply state in /run. pub(crate) fn applylive_sync_ref(sysroot: &crate::ffi::OstreeSysroot) -> CxxResult<()> { let sysroot = sysroot.glib_reborrow(); - let repo = &sysroot.repo().unwrap(); + let repo = &sysroot.repo(); let booted = if let Some(b) = sysroot.booted_deployment() { b } else { @@ -534,7 +534,7 @@ pub(crate) fn get_live_apply_state( ) -> CxxResult { let sysroot = sysroot.glib_reborrow(); let deployment = deployment.glib_reborrow(); - let repo = &sysroot.repo().unwrap(); + let repo = &sysroot.repo(); if let Some(state) = get_live_state(repo, &deployment)? { Ok(state) } else { diff --git a/rust/src/normalization.rs b/rust/src/normalization.rs index a1faaef96c..eb4eb1e6c9 100644 --- a/rust/src/normalization.rs +++ b/rust/src/normalization.rs @@ -10,9 +10,9 @@ use crate::nameservice::shadow::parse_shadow_content; use anyhow::{anyhow, Result}; use cap_std::fs::{Dir, OpenOptions}; use cap_std_ext::cap_std; -use cap_std_ext::rustix::fs::OpenOptionsExt; use fn_error_context::context; use ostree_ext::gio; +use rustix::fs::OpenOptionsExt; use std::io::{BufReader, Read, Seek, SeekFrom, Write}; use std::path::Path; diff --git a/rust/src/passwd.rs b/rust/src/passwd.rs index 4e8f48db8e..9348f8627d 100644 --- a/rust/src/passwd.rs +++ b/rust/src/passwd.rs @@ -13,13 +13,13 @@ use cap_std::fs::OpenOptions; use cap_std_ext::cap_std; use cap_std_ext::cap_std::fs::Permissions; use cap_std_ext::dirext::CapStdExtDirExt; -use cap_std_ext::rustix::fs::MetadataExt; -use cap_std_ext::rustix::fs::OpenOptionsExt; use fn_error_context::context; use gio::prelude::*; use nix::unistd::{Gid, Uid}; use once_cell::sync::Lazy; use ostree_ext::{gio, ostree}; +use rustix::fs::MetadataExt; +use rustix::fs::OpenOptionsExt; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::io::{BufRead, BufReader, BufWriter, Write}; use std::os::unix::fs::DirBuilderExt; diff --git a/rust/src/sysroot_upgrade.rs b/rust/src/sysroot_upgrade.rs index c77ab09583..8699156ea9 100644 --- a/rust/src/sysroot_upgrade.rs +++ b/rust/src/sysroot_upgrade.rs @@ -59,9 +59,7 @@ async fn layer_progress_print(mut r: Receiver) { fn default_container_pull_config() -> Result { let mut cfg = ImageProxyConfig::default(); let isolation_systemd = crate::utils::running_in_systemd().then(|| "rpm-ostree"); - let isolation_default = cap_std_ext::rustix::process::getuid() - .is_root() - .then(|| "nobody"); + let isolation_default = rustix::process::getuid().is_root().then(|| "nobody"); let isolation_user = isolation_systemd.or(isolation_default); ostree_container::merge_default_container_proxy_opts_with_isolation(&mut cfg, isolation_user)?; Ok(cfg) @@ -79,10 +77,6 @@ async fn pull_container_async( PrepareResult::AlreadyPresent(r) => return Ok(r.into()), PrepareResult::Ready(r) => r, }; - if prep.export_layout == ostree_container::ExportLayout::V0 { - output_message(&format!("warning: pulled image is using deprecated v0 format; support will be dropped in a future release")); - std::thread::sleep(std::time::Duration::from_secs(5)); - } let progress_printer = tokio::task::spawn(async move { layer_progress_print(layer_progress).await }); let digest = prep.manifest_digest.clone(); diff --git a/rust/src/testutils.rs b/rust/src/testutils.rs index 78219dde4a..5d42cd1ede 100644 --- a/rust/src/testutils.rs +++ b/rust/src/testutils.rs @@ -15,12 +15,12 @@ use cap_std::fs::FileType; use cap_std::fs::{Dir, Permissions}; use cap_std_ext::cap_std; use cap_std_ext::prelude::CapStdExtDirExt; -use cap_std_ext::rustix::fs::{MetadataExt, Mode}; use clap::Parser; use fn_error_context::context; use glib::{ToVariant, Variant}; use ostree_ext::{gio, glib, ostree}; use rand::Rng; +use rustix::fs::{MetadataExt, Mode}; use std::fs; use std::fs::File; use std::io::Write as IoWrite; @@ -298,9 +298,9 @@ fn integration_read_only() -> Result<()> { let cancellable = gio::Cancellable::NONE; let sysroot = &ostree::Sysroot::new_default(); sysroot.load(cancellable)?; - let repo = &sysroot.repo().unwrap(); + let repo = &sysroot.repo(); let booted = &sysroot.require_booted_deployment()?; - let booted_commit = &booted.csum().expect("csum"); + let booted_commit = &booted.csum(); let booted_commit = booted_commit.as_str(); sysroot.load(cancellable)?; validate_parse_status()?; diff --git a/tests/kolainst/nondestructive/misc.sh b/tests/kolainst/nondestructive/misc.sh index 758737b253..6965b2f280 100755 --- a/tests/kolainst/nondestructive/misc.sh +++ b/tests/kolainst/nondestructive/misc.sh @@ -20,7 +20,7 @@ if test "${R_O_DIGEST}" != "${O_C_DIGEST}" ; then fi for verb in container ima-sign; do ostree "$verb" --help > cli_help.txt - assert_file_has_content_literal cli_help.txt "USAGE:" + assert_file_has_content_literal cli_help.txt "Usage:" assert_file_has_content_literal cli_help.txt "ostree-$verb $verb" rm cli_help.txt done