Skip to content

Commit ddba806

Browse files
committed
cli: Correctly no-op unchanged updates
Regression from previous rework around staged diffs; we were incorectly re-staging the same thing. Signed-off-by: Colin Walters <[email protected]>
1 parent d5990b3 commit ddba806

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/src/cli.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,14 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
342342
let staged_unchanged = staged_digest
343343
.map(|d| d == fetched_digest)
344344
.unwrap_or_default();
345+
let booted_unchanged = booted_image
346+
.as_ref()
347+
.map(|img| img.manifest_digest.as_str() == fetched_digest)
348+
.unwrap_or_default();
345349
if staged_unchanged {
346350
println!("Staged update present, not changed.");
351+
} else if booted_unchanged {
352+
println!("No update available.")
347353
} else {
348354
let osname = booted_deployment.osname();
349355
crate::deploy::stage(sysroot, &osname, &fetched, &spec).await?;

tests/kolainst/basic

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in
1919
echo "booted into $image"
2020
echo "ok status test"
2121

22+
test "null" = $(jq '.status.staged' < status.json)
23+
# Should be a no-op
24+
bootc update
25+
test "null" = $(jq '.status.staged' < status.json)
26+
2227
test '!' -w /usr
2328
bootc usroverlay
2429
test -w /usr

0 commit comments

Comments
 (0)