Skip to content

Commit 9b69dc1

Browse files
jmarrerocgwalters
authored andcommitted
Add a feature for use of ostree v2025.3
This changes things so if a feature flag is passed then we require a new enough ostree. Add a wrapper for a bit of soft reboot state detection. Signed-off-by: Colin Walters <[email protected]>
1 parent 03fa72b commit 9b69dc1

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

Cargo.lock

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

crates/lib/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ install-to-disk = []
7272
rhsm = []
7373
# Implementation detail of man page generation.
7474
docgen = ["clap_mangen"]
75+
ostree-2025-3 = ["ostree-ext/ostree-2025-3"]
7576

7677
[lints]
7778
workspace = true

crates/lib/src/deploy.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,10 @@ async fn deploy(
577577
&opts,
578578
Some(cancellable),
579579
)?;
580+
tracing::debug!(
581+
"Soft reboot capable: {:?}",
582+
ostree_ext::deployment_can_soft_reboot(&sysroot, &d)
583+
);
580584
Ok(d.index())
581585
}),
582586
)

crates/ostree-ext/Cargo.toml

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

1516
# Private dependencies
1617
anyhow = { workspace = true }
@@ -65,6 +66,7 @@ features = ["dox"]
6566
docgen = ["clap_mangen"]
6667
dox = ["ostree/dox"]
6768
internal-testing-api = ["xshell", "indoc", "similar-asserts"]
69+
ostree-2025-3 = ["ostree/v2025_3"]
6870
# Enable calling back into bootc
6971
bootc = []
7072

crates/ostree-ext/src/lib.rs

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

0 commit comments

Comments
 (0)