ostree admin deploy: Add --no-prune option

If you want cleanup, but don't want to prune the repo.  Pruning can
be quite expensive so ostree admin deploy can be much faster without
pruning.

Closes: #1418
Approved by: cgwalters
This commit is contained in:
William Manley 2018-01-15 20:53:54 +00:00 committed by Atomic Bot
parent c5d6725d91
commit 2098f75c2f

View File

@ -35,6 +35,7 @@ static gboolean opt_retain;
static gboolean opt_retain_pending;
static gboolean opt_retain_rollback;
static gboolean opt_not_as_default;
static gboolean opt_no_prune;
static char **opt_kernel_argv;
static char **opt_kernel_argv_append;
static gboolean opt_kernel_proc_cmdline;
@ -50,6 +51,7 @@ static gboolean opt_kernel_arg_none;
static GOptionEntry options[] = {
{ "os", 0, 0, G_OPTION_ARG_STRING, &opt_osname, "Use a different operating system root than the current one", "OSNAME" },
{ "origin-file", 0, 0, G_OPTION_ARG_FILENAME, &opt_origin_path, "Specify origin file", "FILENAME" },
{ "no-prune", 0, 0, G_OPTION_ARG_NONE, &opt_no_prune, "Don't prune the repo when done", NULL},
{ "retain", 0, 0, G_OPTION_ARG_NONE, &opt_retain, "Do not delete previous deployments", NULL },
{ "retain-pending", 0, 0, G_OPTION_ARG_NONE, &opt_retain_pending, "Do not delete pending deployments", NULL },
{ "retain-rollback", 0, 0, G_OPTION_ARG_NONE, &opt_retain_rollback, "Do not delete rollback deployments", NULL },
@ -182,8 +184,16 @@ ot_admin_builtin_deploy (int argc, char **argv, OstreeCommandInvocation *invocat
/* And finally, cleanup of any leftover data.
*/
if (!ostree_sysroot_cleanup (self, cancellable, error))
return FALSE;
if (opt_no_prune)
{
if (!ostree_sysroot_prepare_cleanup (sysroot, cancellable, error))
return FALSE;
}
else
{
if (!ostree_sysroot_cleanup (sysroot, cancellable, error))
return FALSE;
}
return TRUE;
}