diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index a05ca30d..a49428d2 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -1712,6 +1712,18 @@ ostree_sysroot_write_deployments (OstreeSysroot *self, GPtrArray *new_deployments, GCancellable *cancellable, GError **error) +{ + return _ostree_sysroot_write_deployments_internal (self, new_deployments, + OSTREE_SYSROOT_CLEANUP_ALL, + cancellable, error); +} + +gboolean +_ostree_sysroot_write_deployments_internal (OstreeSysroot *self, + GPtrArray *new_deployments, + OstreeSysrootCleanupFlags cleanup_flags, + GCancellable *cancellable, + GError **error) { gboolean ret = FALSE; guint i; @@ -1937,7 +1949,8 @@ ostree_sysroot_write_deployments (OstreeSysroot *self, /* And finally, cleanup of any leftover data. */ - if (!ostree_sysroot_cleanup (self, cancellable, error)) + if (!_ostree_sysroot_piecemeal_cleanup (self, cleanup_flags, + cancellable, error)) { g_prefix_error (error, "Performing final cleanup: "); goto out; diff --git a/src/libostree/ostree-sysroot-private.h b/src/libostree/ostree-sysroot-private.h index 1fa8e83c..b2def7fa 100644 --- a/src/libostree/ostree-sysroot-private.h +++ b/src/libostree/ostree-sysroot-private.h @@ -121,4 +121,10 @@ gboolean _ostree_sysroot_piecemeal_cleanup (OstreeSysroot *sysroot, GCancellable *cancellable, GError **error); +gboolean _ostree_sysroot_write_deployments_internal (OstreeSysroot *self, + GPtrArray *new_deployments, + OstreeSysrootCleanupFlags cleanup_flags, + GCancellable *cancellable, + GError **error); + G_END_DECLS diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 82f864cb..37063e28 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -1591,15 +1591,11 @@ ostree_sysroot_simple_write_deployment (OstreeSysroot *sysroot, added_new = TRUE; } - if (!ostree_sysroot_write_deployments (sysroot, new_deployments, cancellable, error)) + if (!_ostree_sysroot_write_deployments_internal (sysroot, new_deployments, + postclean ? OSTREE_SYSROOT_CLEANUP_ALL : 0, + cancellable, error)) goto out; - if (postclean) - { - if (!ostree_sysroot_cleanup (sysroot, cancellable, error)) - goto out; - } - ret = TRUE; out: return ret;