Skip to content

Commit 0da907a

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 97e5ca2 commit 0da907a

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.

lib/Cargo.toml

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

7778
[lints]
7879
workspace = true

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: 3 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 }
@@ -66,6 +67,7 @@ features = ["dox"]
6667
docgen = ["clap_mangen"]
6768
dox = ["ostree/dox"]
6869
internal-testing-api = ["xshell", "indoc", "similar-asserts"]
70+
ostree-2025-3 = ["ostree/v2025_3"]
6971
# Enable calling back into bootc
7072
bootc = []
7173

ostree-ext/src/lib.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,20 @@ 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(feature = "ostree-2025-3")]
88+
{
89+
Some(sysroot.deployment_can_soft_reboot(deployment))
90+
}
91+
#[cfg(not(feature = "ostree-2025-3"))]
92+
{
93+
let _ = (sysroot, deployment);
94+
None
95+
}
96+
}

0 commit comments

Comments
 (0)