lib/sysroot: Move staged into deployment list, rework handling

Followup to: https://github.com/ostreedev/ostree/pull/1503
After starting some more work on on this in rpm-ostree, it is
actually simpler if the staged deployment just shows up in the list.

It's effectively opt-in today; down the line we may make it the default,
but I worry about breaking things that e.g. assume they can mutate
the deployment before rebooting and have `/etc` already merged.

There's not that many things in libostree that iterate over the deployment
list.  The biggest change here is around the
`ostree_sysroot_write_deployments_with_options` API.  I initially
tried hard to support a use case like "push a rollback" while retaining
the staged deployment, but everything gets very messy because that
function truly is operating on the bootloader list.

For now what I settled on is to just discard the staged deployment;
down the line we can enhance things.

Where we then have some new gymnastics is around implementing
the finalization; we need to go to some effort to pull the staged
deployment out of the list and mark it as unstaged, and then pass
it down to `write_deployments()`.

Closes: #1539
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2018-04-18 18:59:15 +00:00
1 parent 09dc2a8772
commit 16d3359bf8
5 files changed
+113 -32

No files matched your search

-9
View File
@@ -308,15 +308,6 @@ cleanup_old_deployments (OstreeSysroot *self,
g_hash_table_replace (active_boot_checksums, bootcsum, bootcsum);
}
/* And also the staged deployment, if any */
if (self->staged_deployment)
{
char *deployment_path = ostree_sysroot_get_deployment_dirpath (self, self->staged_deployment);
g_hash_table_replace (active_deployment_dirs, deployment_path, deployment_path);
char *bootcsum = g_strdup (ostree_deployment_get_bootcsum (self->staged_deployment));
g_hash_table_replace (active_boot_checksums, bootcsum, bootcsum);
}
/* Find all deployment directories, both active and inactive */
g_autoptr(GPtrArray) all_deployment_dirs = NULL;
if (!list_all_deployment_directories (self, &all_deployment_dirs,