ostree admin deploy: Refactor bringing cleaning into `main`
authorWilliam Manley <will@williammanley.net>
Sat, 13 Jan 2018 15:30:17 +0000 (15:30 +0000)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 16 Jan 2018 18:59:06 +0000 (18:59 +0000)
In the next commit I will add --no-prune which will affect cleaning.  By
doing this refactor we avoid having to add a NO_PRUNE flag.

Closes: #1418
Approved by: cgwalters

src/ostree/ot-admin-builtin-deploy.c

index 8da9dbc3eb74b5c847e6c590314d350ffec91c74..68d17e954a53f0ad1bf212877493d99ed0c57337 100644 (file)
@@ -162,7 +162,7 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat
                                    kargs_strv, &new_deployment, cancellable, error))
     return FALSE;
 
-  OstreeSysrootSimpleWriteDeploymentFlags flags = 0;
+  OstreeSysrootSimpleWriteDeploymentFlags flags = OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN;
   if (opt_retain)
     flags |= OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN;
   else
@@ -180,5 +180,10 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat
                                                merge_deployment, flags, cancellable, error))
     return FALSE;
 
+  /* And finally, cleanup of any leftover data.
+   */
+  if (!ostree_sysroot_cleanup (self, cancellable, error))
+    return FALSE;
+
   return TRUE;
 }