mirror of
https://github.com/containers/bootc.git
synced 2026-02-05 15:45:53 +01:00
Update composefs-rs to merged PR #209
The composefs-rs PR 209 has been merged to main. This updates bootc to use the containers/composefs-rs repository at the merge commit. Key API changes: - Directory::default() -> Directory::new(Stat::uninitialized()) - read_filesystem() no longer takes stat_root parameter - New read_container_root() for OCI containers (propagates /usr metadata to root) - stat_root CLI flag renamed to no_propagate_usr_to_root with inverted logic See https://github.com/containers/composefs-rs/pull/209 Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
8
Cargo.lock
generated
8
Cargo.lock
generated
@@ -573,7 +573,7 @@ checksum = "55b672471b4e9f9e95499ea597ff64941a309b2cdbffcc46f2cc5e2d971fd335"
|
||||
[[package]]
|
||||
name = "composefs"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/containers/composefs-rs?rev=e9008489375044022e90d26656960725a76f4620#e9008489375044022e90d26656960725a76f4620"
|
||||
source = "git+https://github.com/containers/composefs-rs?rev=4a060161e0122bd2727e639437c61e05ecc7cab3#4a060161e0122bd2727e639437c61e05ecc7cab3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"hex",
|
||||
@@ -593,7 +593,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "composefs-boot"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/containers/composefs-rs?rev=e9008489375044022e90d26656960725a76f4620#e9008489375044022e90d26656960725a76f4620"
|
||||
source = "git+https://github.com/containers/composefs-rs?rev=4a060161e0122bd2727e639437c61e05ecc7cab3#4a060161e0122bd2727e639437c61e05ecc7cab3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"composefs",
|
||||
@@ -606,10 +606,11 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "composefs-oci"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/containers/composefs-rs?rev=e9008489375044022e90d26656960725a76f4620#e9008489375044022e90d26656960725a76f4620"
|
||||
source = "git+https://github.com/containers/composefs-rs?rev=4a060161e0122bd2727e639437c61e05ecc7cab3#4a060161e0122bd2727e639437c61e05ecc7cab3"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-compression",
|
||||
"bytes",
|
||||
"composefs",
|
||||
"containers-image-proxy",
|
||||
"hex",
|
||||
@@ -619,6 +620,7 @@ dependencies = [
|
||||
"sha2",
|
||||
"tar",
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
||||
@@ -47,9 +47,9 @@ clap_mangen = { version = "0.2.20" }
|
||||
# 1. Set BOOTC_extra_src to your composefs-rs path when building:
|
||||
# BOOTC_extra_src=$HOME/src/composefs-rs just build
|
||||
# 2. Comment out the git refs below and uncomment the path refs:
|
||||
composefs = { git = "https://github.com/containers/composefs-rs", rev = "e9008489375044022e90d26656960725a76f4620", package = "composefs", features = ["rhel9"] }
|
||||
composefs-boot = { git = "https://github.com/containers/composefs-rs", rev = "e9008489375044022e90d26656960725a76f4620", package = "composefs-boot" }
|
||||
composefs-oci = { git = "https://github.com/containers/composefs-rs", rev = "e9008489375044022e90d26656960725a76f4620", package = "composefs-oci" }
|
||||
composefs = { git = "https://github.com/containers/composefs-rs", rev = "4a060161e0122bd2727e639437c61e05ecc7cab3", package = "composefs", features = ["rhel9"] }
|
||||
composefs-boot = { git = "https://github.com/containers/composefs-rs", rev = "4a060161e0122bd2727e639437c61e05ecc7cab3", package = "composefs-boot" }
|
||||
composefs-oci = { git = "https://github.com/containers/composefs-rs", rev = "4a060161e0122bd2727e639437c61e05ecc7cab3", package = "composefs-oci" }
|
||||
# composefs = { path = "/run/extra-src/crates/composefs", package = "composefs", features = ["rhel9"] }
|
||||
# composefs-boot = { path = "/run/extra-src/crates/composefs-boot", package = "composefs-boot" }
|
||||
# composefs-oci = { path = "/run/extra-src/crates/composefs-oci", package = "composefs-oci" }
|
||||
|
||||
@@ -331,17 +331,17 @@ pub fn traverse_etc(
|
||||
Directory<CustomMetadata>,
|
||||
Option<Directory<CustomMetadata>>,
|
||||
)> {
|
||||
let mut pristine_etc_files = Directory::default();
|
||||
let mut pristine_etc_files = Directory::new(Stat::uninitialized());
|
||||
recurse_dir(pristine_etc, &mut pristine_etc_files)
|
||||
.context(format!("Recursing {pristine_etc:?}"))?;
|
||||
|
||||
let mut current_etc_files = Directory::default();
|
||||
let mut current_etc_files = Directory::new(Stat::uninitialized());
|
||||
recurse_dir(current_etc, &mut current_etc_files)
|
||||
.context(format!("Recursing {current_etc:?}"))?;
|
||||
|
||||
let new_etc_files = match new_etc {
|
||||
Some(new_etc) => {
|
||||
let mut new_etc_files = Directory::default();
|
||||
let mut new_etc_files = Directory::new(Stat::uninitialized());
|
||||
recurse_dir(new_etc, &mut new_etc_files).context(format!("Recursing {new_etc:?}"))?;
|
||||
|
||||
Some(new_etc_files)
|
||||
|
||||
@@ -61,7 +61,7 @@ pub(crate) fn compute_composefs_digest(
|
||||
|
||||
// Read filesystem from path, transform for boot, compute digest
|
||||
let mut fs =
|
||||
composefs::fs::read_filesystem(rustix::fs::CWD, path.as_std_path(), Some(&repo), false)?;
|
||||
composefs::fs::read_container_root(rustix::fs::CWD, path.as_std_path(), Some(&repo))?;
|
||||
fs.transform_for_boot(&repo).context("Preparing for boot")?;
|
||||
let id = fs.compute_image_id();
|
||||
let digest = id.to_hex();
|
||||
|
||||
@@ -11,7 +11,7 @@ use bootc_initramfs_setup::mount_composefs_image;
|
||||
use bootc_mount::tempmount::TempMount;
|
||||
use cap_std_ext::cap_std::{ambient_authority, fs::Dir};
|
||||
use cap_std_ext::dirext::CapStdExtDirExt;
|
||||
use composefs::generic_tree::Directory;
|
||||
use composefs::generic_tree::{Directory, Stat};
|
||||
use etc_merge::{compute_diff, merge, print_diff, traverse_etc};
|
||||
use rustix::fs::{fsync, renameat};
|
||||
use rustix::path::Arg;
|
||||
@@ -33,7 +33,11 @@ pub(crate) async fn get_etc_diff(storage: &Storage, booted_cfs: &BootedComposefs
|
||||
let current_etc = Dir::open_ambient_dir("/etc", ambient_authority())?;
|
||||
|
||||
let (pristine_files, current_files, _) = traverse_etc(&pristine_etc, ¤t_etc, None)?;
|
||||
let diff = compute_diff(&pristine_files, ¤t_files, &Directory::default())?;
|
||||
let diff = compute_diff(
|
||||
&pristine_files,
|
||||
¤t_files,
|
||||
&Directory::new(Stat::uninitialized()),
|
||||
)?;
|
||||
|
||||
print_diff(&diff, &mut std::io::stdout());
|
||||
|
||||
|
||||
@@ -123,14 +123,17 @@ enum Command {
|
||||
/// the mountpoint
|
||||
mountpoint: String,
|
||||
},
|
||||
/// Creates a composefs image from a filesystem
|
||||
CreateImage {
|
||||
path: PathBuf,
|
||||
#[clap(long)]
|
||||
bootable: bool,
|
||||
/// Don't copy /usr metadata to root directory (use if root already has well-defined metadata)
|
||||
#[clap(long)]
|
||||
stat_root: bool,
|
||||
no_propagate_usr_to_root: bool,
|
||||
image_name: Option<String>,
|
||||
},
|
||||
/// Computes the composefs image ID for a filesystem
|
||||
ComputeId {
|
||||
path: PathBuf,
|
||||
/// Write the dumpfile to the provided target
|
||||
@@ -138,15 +141,18 @@ enum Command {
|
||||
write_dumpfile_to: Option<Utf8PathBuf>,
|
||||
#[clap(long)]
|
||||
bootable: bool,
|
||||
/// Don't copy /usr metadata to root directory (use if root already has well-defined metadata)
|
||||
#[clap(long)]
|
||||
stat_root: bool,
|
||||
no_propagate_usr_to_root: bool,
|
||||
},
|
||||
/// Outputs the composefs dumpfile format for a filesystem
|
||||
CreateDumpfile {
|
||||
path: PathBuf,
|
||||
#[clap(long)]
|
||||
bootable: bool,
|
||||
/// Don't copy /usr metadata to root directory (use if root already has well-defined metadata)
|
||||
#[clap(long)]
|
||||
stat_root: bool,
|
||||
no_propagate_usr_to_root: bool,
|
||||
},
|
||||
ImageObjects {
|
||||
name: String,
|
||||
@@ -215,7 +221,7 @@ where
|
||||
ref config_verity,
|
||||
} => {
|
||||
let verity = verity_opt(config_verity)?;
|
||||
let mut fs =
|
||||
let fs =
|
||||
composefs_oci::image::create_filesystem(repo, config_name, verity.as_ref())?;
|
||||
fs.print_dumpfile()?;
|
||||
}
|
||||
@@ -316,9 +322,13 @@ where
|
||||
ref path,
|
||||
write_dumpfile_to,
|
||||
bootable,
|
||||
stat_root,
|
||||
no_propagate_usr_to_root,
|
||||
} => {
|
||||
let mut fs = composefs::fs::read_filesystem(CWD, path, Some(repo.as_ref()), stat_root)?;
|
||||
let mut fs = if no_propagate_usr_to_root {
|
||||
composefs::fs::read_filesystem(CWD, path, Some(repo.as_ref()))?
|
||||
} else {
|
||||
composefs::fs::read_container_root(CWD, path, Some(repo.as_ref()))?
|
||||
};
|
||||
if bootable {
|
||||
fs.transform_for_boot(repo)?;
|
||||
}
|
||||
@@ -334,10 +344,14 @@ where
|
||||
Command::CreateImage {
|
||||
ref path,
|
||||
bootable,
|
||||
stat_root,
|
||||
no_propagate_usr_to_root,
|
||||
ref image_name,
|
||||
} => {
|
||||
let mut fs = composefs::fs::read_filesystem(CWD, path, Some(repo.as_ref()), stat_root)?;
|
||||
let mut fs = if no_propagate_usr_to_root {
|
||||
composefs::fs::read_filesystem(CWD, path, Some(repo.as_ref()))?
|
||||
} else {
|
||||
composefs::fs::read_container_root(CWD, path, Some(repo.as_ref()))?
|
||||
};
|
||||
if bootable {
|
||||
fs.transform_for_boot(repo)?;
|
||||
}
|
||||
@@ -347,9 +361,13 @@ where
|
||||
Command::CreateDumpfile {
|
||||
ref path,
|
||||
bootable,
|
||||
stat_root,
|
||||
no_propagate_usr_to_root,
|
||||
} => {
|
||||
let mut fs = composefs::fs::read_filesystem(CWD, path, Some(repo.as_ref()), stat_root)?;
|
||||
let mut fs = if no_propagate_usr_to_root {
|
||||
composefs::fs::read_filesystem(CWD, path, Some(repo.as_ref()))?
|
||||
} else {
|
||||
composefs::fs::read_container_root(CWD, path, Some(repo.as_ref()))?
|
||||
};
|
||||
if bootable {
|
||||
fs.transform_for_boot(repo)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user