diff options
author | Colin Walters <walters@verbum.org> | 2016-08-28 22:22:59 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2016-08-29 07:45:24 +0000 |
commit | 8ece4d6d51bdbe3e41ab318259276bb83e553aa0 (patch) | |
tree | 18bd352b19541ed2d6f4c7424671574a0de5046e | |
parent | cfc3934e81bd1cd083f089c9711d1324b2612c9f (diff) | |
download | ostree-8ece4d6d51bdbe3e41ab318259276bb83e553aa0.tar.gz |
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
-rw-r--r-- | src/libostree/ostree-sysroot.c | 8 | ||||
-rw-r--r-- | src/libostree/ostree-sysroot.h | 3 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index 227fdd24..82f864cb 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -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 (!ostree_sysroot_cleanup (sysroot, cancellable, error)) - goto out; + if (postclean) + { + if (!ostree_sysroot_cleanup (sysroot, cancellable, error)) + goto out; + } ret = TRUE; out: diff --git a/src/libostree/ostree-sysroot.h b/src/libostree/ostree-sysroot.h index 1e60ddbe..1e98cc10 100644 --- a/src/libostree/ostree-sysroot.h +++ b/src/libostree/ostree-sysroot.h @@ -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 |