Skip to content

Commit

Permalink
cli: Correctly no-op unchanged updates
Browse files Browse the repository at this point in the history
Regression from previous rework around staged diffs;
we were incorectly re-staging the same thing.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Nov 2, 2023
1 parent d5990b3 commit c3c3d3e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,14 @@ async fn upgrade(opts: UpgradeOpts) -> Result<()> {
let staged_unchanged = staged_digest
.map(|d| d == fetched_digest)
.unwrap_or_default();
let booted_unchanged = booted_image
.as_ref()
.map(|img| img.manifest_digest.as_str() == fetched_digest)
.unwrap_or_default();
if staged_unchanged {
println!("Staged update present, not changed.");
} else if booted_unchanged {
println!("No update available.")
} else {
let osname = booted_deployment.osname();
crate::deploy::stage(sysroot, &osname, &fetched, &spec).await?;
Expand Down
5 changes: 5 additions & 0 deletions tests/kolainst/basic
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ case "${AUTOPKGTEST_REBOOT_MARK:-}" in
echo "booted into $image"
echo "ok status test"

assert_streq "null" $(jq '.status.staged' < status.json)
# Should be a no-op
bootc update
assert_streq "null" $(jq '.status.staged' < status.json)

test '!' -w /usr
bootc usroverlay
test -w /usr
Expand Down

0 comments on commit c3c3d3e

Please sign in to comment.