Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ cap-std-ext = "4.0.3"
chrono = { version = "0.4.38", default-features = false }
clap = "4.5.4"
clap_mangen = { version = "0.2.20" }
composefs = { git = "https://github.com/containers/composefs-rs", rev = "ce28ee8a7b43290941d208c8ca820150a6504d5a", package = "composefs", features = ["rhel9"] }
composefs-boot = { git = "https://github.com/containers/composefs-rs", rev = "ce28ee8a7b43290941d208c8ca820150a6504d5a", package = "composefs-boot" }
composefs-oci = { git = "https://github.com/containers/composefs-rs", rev = "ce28ee8a7b43290941d208c8ca820150a6504d5a", package = "composefs-oci" }
composefs = { git = "https://github.com/containers/composefs-rs", rev = "8402af606ff0866a6c4d891264cfac869da22ed7", package = "composefs", features = ["rhel9"] }
composefs-boot = { git = "https://github.com/containers/composefs-rs", rev = "8402af606ff0866a6c4d891264cfac869da22ed7", package = "composefs-boot" }
composefs-oci = { git = "https://github.com/containers/composefs-rs", rev = "8402af606ff0866a6c4d891264cfac869da22ed7", package = "composefs-oci" }
fn-error-context = "0.2.1"
hex = "0.4.3"
indicatif = "0.18.0"
Expand Down
4 changes: 2 additions & 2 deletions crates/ostree-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ xshell = { workspace = true, optional = true }

# Crate-specific dependencies
comfy-table = "7.1.1"
containers-image-proxy = "0.8.0"
containers-image-proxy = "0.9.0"
flate2 = { features = ["zlib"], default-features = false, version = "1.0.20" }
futures-util = "0.3.13"
gvariant = "0.5.0"
indexmap = { version = "2.2.2", features = ["serde"] }
io-lifetimes = "3"
libsystemd = "0.7.0"
ocidir = "0.4.0"
ocidir = "0.6.0"
# We re-export this library too.
ostree = { features = ["v2025_3"], version = "0.20.3" }
pin-project = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/ostree-ext/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ async fn container_history(repo: &ostree::Repo, imgref: &ImageReference) -> Resu
.set_content_arrangement(comfy_table::ContentArrangement::Dynamic)
.set_header(["ID", "SIZE", "CRCEATED BY"]);

let mut history = img.configuration.history().iter();
let mut history = img.configuration.history().iter().flatten();
let layers = img.manifest.layers().iter();
for layer in layers {
let histent = history.next();
Expand Down
25 changes: 15 additions & 10 deletions crates/ostree-ext/src/container/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,13 @@ impl PreparedImport {
) -> impl Iterator<Item = Result<(&ManifestLayerState, &History)>> {
// FIXME use .filter(|h| h.empty_layer.unwrap_or_default()) after https://github.com/containers/oci-spec-rs/pull/100 lands.
let truncated = std::iter::once_with(|| Err(anyhow::anyhow!("Truncated history")));
let history = self.config.history().iter().map(Ok).chain(truncated);
let history = self
.config
.history()
.iter()
.flatten()
.map(Ok)
.chain(truncated);
self.all_layers()
.zip(history)
.map(|(s, h)| h.map(|h| (s, h)))
Expand Down Expand Up @@ -1486,7 +1492,9 @@ pub(crate) fn export_to_oci(
let mut new_manifest = srcinfo.manifest.clone();
new_manifest.layers_mut().clear();
let mut new_config = srcinfo.configuration.clone();
new_config.history_mut().clear();
if let Some(history) = new_config.history_mut() {
history.clear();
}
new_config.rootfs_mut().diff_ids_mut().clear();

let mut dest_oci = ocidir::OciDir::ensure(dest_oci.try_clone()?)?;
Expand Down Expand Up @@ -1538,17 +1546,14 @@ pub(crate) fn export_to_oci(
.get(i)
.and_then(|l| l.annotations().as_ref())
.cloned();
let previous_description = srcinfo
.configuration
.history()
.get(i)
let history = srcinfo.configuration.history().as_ref();
let history_entry = history.and_then(|v| v.get(i));
let previous_description = history_entry
.clone()
.and_then(|h| h.comment().as_deref())
.unwrap_or_default();

let previous_created = srcinfo
.configuration
.history()
.get(i)
let previous_created = history_entry
.and_then(|h| h.created().as_deref())
.and_then(bootc_utils::try_deserialize_timestamp)
.unwrap_or_default();
Expand Down
7 changes: 4 additions & 3 deletions crates/ostree-ext/src/integrationtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ 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::{
oci_spec::image::{Arch, Platform},
GzipLayerWriter,
LayerWriter,
};
use ostree::gio;
use xshell::cmd;
Expand Down Expand Up @@ -63,7 +64,7 @@ pub fn generate_derived_oci_from_tar<F>(
arch: Option<Arch>,
) -> Result<()>
where
F: FnOnce(&mut GzipLayerWriter) -> Result<()>,
F: for<'a> FnOnce(&mut LayerWriter<'a, GzEncoder<ocidir::BlobWriter<'a>>>) -> Result<()>,
{
let src = src.as_ref();
let src = Dir::open_ambient_dir(src, cap_std::ambient_authority())?;
Expand Down Expand Up @@ -95,7 +96,7 @@ where
.build()
.unwrap(),
);
config.history_mut().push(
config.history_mut().get_or_insert_default().push(
oci_spec::image::HistoryBuilder::default()
.created_by("generate_derived_oci")
.build()
Expand Down
2 changes: 1 addition & 1 deletion crates/ostree-ext/tests/it/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ async fn impl_test_container_import_export(chunked: bool) -> Result<()> {

let n_chunks = if chunked { LAYERS_V0_LEN } else { 1 };
assert_eq!(cfg.rootfs().diff_ids().len(), n_chunks);
assert_eq!(cfg.history().len(), n_chunks);
assert_eq!(cfg.history().as_ref().unwrap().len(), n_chunks);

// Verify exporting to ociarchive
{
Expand Down