Skip to content

Commit

Permalink
fixup! deploy: keep last deployment version during stage
Browse files Browse the repository at this point in the history
  • Loading branch information
r4f4 committed Aug 2, 2021
1 parent f6b2ce7 commit b811f7e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/libostree/ostree-sysroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1890,22 +1890,29 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot,

/* tracks current versioned deployment */
OstreeRepo *repo = ostree_sysroot_repo (sysroot);
const gchar *new_version =
_ostree_deployment_get_version (new_deployment, repo, error);
const gchar *new_version = _ostree_deployment_get_version (new_deployment, repo);

gboolean retained_previous_version = FALSE;

/* we never prune booted and merge deployments, so if they exist and are of a
* different version from `new_version`, they already fulfill the criteria of
* retaining the previous version */
if (booted_deployment)
{
const gchar *booted_version =
_ostree_deployment_get_version (booted_deployment, repo, error);
_ostree_deployment_get_version (booted_deployment, repo);
retained_previous_version = (g_strcmp0 (booted_version, new_version) != 0);
}

/* checking also that booted and merge are not the same although that's not a
* big deal since we cache the version now (though this will still work in
* the NULL case)
*/
if (!retained_previous_version && merge_deployment &&
!ostree_deployment_equal (merge_deployment, booted_deployment))
{
const gchar *merge_version =
_ostree_deployment_get_version (merge_deployment, repo, error);
_ostree_deployment_get_version (merge_deployment, repo);
retained_previous_version = (g_strcmp0 (merge_version, new_version) != 0);
}

Expand All @@ -1932,7 +1939,7 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot,
gboolean is_previous_version = FALSE;
if (passed_crossover && osname_matches && !retained_previous_version)
{
const gchar *version = _ostree_deployment_get_version (deployment, repo, error);
const gchar *version = _ostree_deployment_get_version (deployment, repo);
is_previous_version = (g_strcmp0 (version, new_version) != 0);
}

Expand Down

0 comments on commit b811f7e

Please sign in to comment.