Skip to content

Commit

Permalink
fixup! deploy: Keep last deployment version during stage
Browse files Browse the repository at this point in the history
Check also booted and merge deployments
  • Loading branch information
r4f4 committed Jan 27, 2020
1 parent a4d7b33 commit 583f49f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/libostree/ostree-sysroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -1745,13 +1745,27 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot,

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

gboolean retained_previous_version = FALSE;
if (booted_deployment)
{
const gchar *booted_version =
_ostree_deployment_get_version (booted_deployment, repo, error);
retained_previous_version = (g_strcmp0 (booted_deployment, new_version) != 0);
}

if (!retained_previous_version && merge_deployment)
{
const gchar *merge_version =
_ostree_deployment_get_version (merge_deployment, repo, error);
retained_previous_version = (g_strcmp0 (merge_deployment, new_version) != 0);
}

/* tracks when we come across the booted deployment */
gboolean before_booted = TRUE;
gboolean before_merge = TRUE;
gboolean retained_previous_version = FALSE;
for (guint i = 0; i < deployments->len; i++)
{
OstreeDeployment *deployment = deployments->pdata[i];
Expand All @@ -1773,7 +1787,7 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot,
if (passed_crossover && osname_matches && !retained_previous_version)
{
const gchar *version = _ostree_deployment_get_version (deployment, repo, error);
is_previous_version = version && (!last_version || (g_strcmp0 (version, last_version) < 0));
is_previous_version = (g_strcmp0 (version, new_version) != 0);
}

/* Retain deployment if:
Expand Down

0 comments on commit 583f49f

Please sign in to comment.