Skip to content

ostree-ext: update ostree rust bindings and use new feature #1401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ install-to-disk = []
rhsm = []
# Implementation detail of man page generation.
docgen = ["clap_mangen"]
ostree-2025-3 = ["ostree-ext/ostree-2025-3"]

[lints]
workspace = true
4 changes: 4 additions & 0 deletions crates/lib/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,10 @@ async fn deploy(
&opts,
Some(cancellable),
)?;
tracing::debug!(
"Soft reboot capable: {:?}",
ostree_ext::deployment_can_soft_reboot(&sysroot, &d)
);
Ok(d.index())
}),
)
Expand Down
4 changes: 3 additions & 1 deletion crates/ostree-ext/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ version = "0.15.3"
[dependencies]
containers-image-proxy = "0.8.0"
# We re-export this library too.
ostree = { features = ["v2025_2"], version = "0.20" }
# Default to v2025_2, upgrade to v2025_3 when feature is enabled
ostree = { version = "0.20", features = ["v2025_2"] }

# Private dependencies
anyhow = { workspace = true }
Expand Down Expand Up @@ -65,6 +66,7 @@ features = ["dox"]
docgen = ["clap_mangen"]
dox = ["ostree/dox"]
internal-testing-api = ["xshell", "indoc", "similar-asserts"]
ostree-2025-3 = ["ostree/v2025_3"]
# Enable calling back into bootc
bootc = []

Expand Down
17 changes: 17 additions & 0 deletions crates/ostree-ext/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,20 @@ pub mod prelude {
pub mod fixture;
#[cfg(feature = "internal-testing-api")]
pub mod integrationtest;

/// Dynamic detection wrapper for soft reboots, if the installed ostree is too old
/// then we return `None`.
pub fn deployment_can_soft_reboot(
sysroot: &ostree::Sysroot,
deployment: &ostree::Deployment,
) -> Option<bool> {
#[cfg(feature = "ostree-2025-3")]
{
Some(sysroot.deployment_can_soft_reboot(deployment))
}
#[cfg(not(feature = "ostree-2025-3"))]
{
let _ = (sysroot, deployment);
None
}
}