sysroot: Add a flag to suppress post-deploy cleanup

I noticed seeing the output of `prune` twice in rpm-ostree, and had
always wondered why.  When reading the rpm-ostree code to fix
something else, reasons, I noticed the reason - we were pruning once
here, and then once after rpm-ostree regenerates its "base" refs.

There's no reason to clean twice, so let's add a flag so rpm-ostree
can suppress doing it inside libostree.

Closes: #474
Approved by: giuseppe
This commit is contained in:
Colin Walters 2016-08-28 22:22:59 -04:00 committed by Atomic Bot
parent cfc3934e81
commit 8ece4d6d51
2 changed files with 8 additions and 3 deletions

View File

@ -1540,6 +1540,7 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot,
OstreeDeployment *booted_deployment = NULL;
g_autoptr(GPtrArray) deployments = NULL;
g_autoptr(GPtrArray) new_deployments = g_ptr_array_new_with_free_func (g_object_unref);
const gboolean postclean = (flags & OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN) == 0;
gboolean retain = (flags & OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN) > 0;
const gboolean make_default = !((flags & OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT) > 0);
gboolean added_new = FALSE;
@ -1593,8 +1594,11 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot,
if (!ostree_sysroot_write_deployments (sysroot, new_deployments, cancellable, error))
goto out;
if (postclean)
{
if (!ostree_sysroot_cleanup (sysroot, cancellable, error))
goto out;
}
ret = TRUE;
out:

View File

@ -182,7 +182,8 @@ GKeyFile *ostree_sysroot_origin_new_from_refspec (OstreeSysroot *self,
typedef enum {
OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE = 0,
OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN = (1 << 0),
OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT = (1 << 1)
OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT = (1 << 1),
OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN = (1 << 2),
} OstreeSysrootSimpleWriteDeploymentFlags;
_OSTREE_PUBLIC