deploy: Silently do nothing if passed same set of deployments

Prep for handling staged deployments better; if we're not passed
the staged one back, then we just want to delete it but not
touch the bootloader config.

Closes: #1538
Approved by: jlebon
This commit is contained in:
Colin Walters 2018-04-12 12:53:17 -04:00 committed by Atomic Bot
parent 56de631721
commit efdaf1495b
1 changed files with 14 additions and 2 deletions

View File

@ -2158,14 +2158,26 @@ ostree_sysroot_write_deployments_with_options (OstreeSysroot *self,
requires_new_bootversion = TRUE;
else
{
gboolean is_noop = TRUE;
for (guint i = 0; i < new_deployments->len; i++)
{
if (!deployment_bootconfigs_equal (new_deployments->pdata[i],
self->deployments->pdata[i]))
OstreeDeployment *cur_deploy = self->deployments->pdata[i];
OstreeDeployment *new_deploy = new_deployments->pdata[i];
if (!deployment_bootconfigs_equal (cur_deploy, new_deploy))
{
requires_new_bootversion = TRUE;
is_noop = FALSE;
break;
}
if (cur_deploy != new_deploy)
is_noop = FALSE;
}
/* Silently do nothing if we're passed the same set of deployments */
if (is_noop)
{
g_assert (!requires_new_bootversion);
return TRUE;
}
}