Skip to content

Commit

Permalink
Support for split layers
Browse files Browse the repository at this point in the history
Closes: ostreedev#69

This is initial basic support for splitting files (objects) from
a commit into separate container image layers, and reassembling
those layers into a commit on the client.

We retain our present logic around e.g. GPG signature verification.

There's a new `chunking.rs` file which has logic to automatically
factor out things like the kernel/initramfs and large files.

In order to fetch these images client side, we now heavily
intermix/cross the previous code for fetching non-ostree layers.
  • Loading branch information
cgwalters committed Mar 7, 2022
1 parent 7a0462e commit b6d2c7d
Show file tree
Hide file tree
Showing 14 changed files with 1,368 additions and 262 deletions.
3 changes: 1 addition & 2 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version = "0.6.5"

[dependencies]
anyhow = "1.0"
containers-image-proxy = "0.4.0"
containers-image-proxy = { features = ["proxy_v0_2_3"], version = "0.4.0" }

async-compression = { version = "0.3", features = ["gzip", "tokio"] }
bitflags = "1"
Expand Down Expand Up @@ -58,4 +58,3 @@ features = ["dox"]
[features]
dox = ["ostree/dox"]
internal-testing-api = ["sh-inline", "indoc"]
proxy_v0_2_3 = ["containers-image-proxy/proxy_v0_2_3"]
29 changes: 29 additions & 0 deletions lib/src/bootabletree.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//! Helper functions for bootable OSTrees.

use anyhow::Result;
use ostree::gio;
use ostree::prelude::*;

const MODULES: &str = "/usr/lib/modules";

/// Find the kernel modules directory in a bootable OSTree commit.
pub fn find_kernel_dir(
root: &gio::File,
cancellable: Option<&gio::Cancellable>,
) -> Result<Option<gio::File>> {
let moddir = root.resolve_relative_path(MODULES);
let e = moddir.enumerate_children(
"standard::name",
gio::FileQueryInfoFlags::NOFOLLOW_SYMLINKS,
cancellable,
)?;
let mut r = None;
for child in e.clone() {
let child = &child?;
let childpath = e.child(child);
if child.file_type() == gio::FileType::Directory && r.replace(childpath).is_some() {
anyhow::bail!("Found multiple subdirectories in {}", MODULES);
}
}
Ok(r)
}
Loading

0 comments on commit b6d2c7d

Please sign in to comment.