Skip to content

Commit d74531c

Browse files
jmarrerocgwalters
authored andcommitted
ostree-ext: Update ostree bindings and *conditionally* use v2025_3
Add machinery to do dynamic build time detection of ostree, and only enable use of the feature if we have a new enough version. Signed-off-by: Colin Walters <[email protected]>
1 parent 97e5ca2 commit d74531c

File tree

4 files changed

+30
-5
lines changed

4 files changed

+30
-5
lines changed

Cargo.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/deploy.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,10 @@ async fn deploy(
587587
&opts,
588588
Some(cancellable),
589589
)?;
590+
tracing::debug!(
591+
"Soft reboot capable: {:?}",
592+
ostree_ext::deployment_can_soft_reboot(&sysroot, &d)
593+
);
590594
Ok(d.index())
591595
}),
592596
)

ostree-ext/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ version = "0.15.3"
1111
[dependencies]
1212
containers-image-proxy = "0.8.0"
1313
# We re-export this library too.
14-
ostree = { features = ["v2025_2"], version = "0.20" }
14+
# Default to v2025_2, upgrade to v2025_3 when feature is enabled
15+
ostree = { version = "0.20", features = ["v2025_2"] }
1516

1617
# Private dependencies
1718
anyhow = { workspace = true }
@@ -59,6 +60,9 @@ quickcheck = "1"
5960
# https://github.com/rust-lang/rfcs/pull/1956
6061
ostree-ext = { path = ".", features = ["internal-testing-api"] }
6162

63+
[build-dependencies]
64+
pkg-config = "0.3"
65+
6266
[package.metadata.docs.rs]
6367
features = ["dox"]
6468

ostree-ext/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,19 @@ pub mod prelude {
7777
pub mod fixture;
7878
#[cfg(feature = "internal-testing-api")]
7979
pub mod integrationtest;
80+
81+
/// Dynamic detection wrapper for soft reboots, if the installed ostree is too old
82+
/// then we return `None`.
83+
pub fn deployment_can_soft_reboot(
84+
sysroot: &ostree::Sysroot,
85+
deployment: &ostree::Deployment,
86+
) -> Option<bool> {
87+
#[cfg(have_ostree_2025_3)]
88+
{
89+
Some(ostree::Sysroot::deployment_can_soft_reboot(
90+
sysroot, deployment,
91+
))
92+
}
93+
#[cfg(not(have_ostree_2025_3))]
94+
None
95+
}

0 commit comments

Comments
 (0)