From 2098f75c2f0c11620ab1072548f805f02d4c45cb Mon Sep 17 00:00:00 2001 From: William Manley Date: Mon, 15 Jan 2018 20:53:54 +0000 Subject: [PATCH] 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 --- src/ostree/ot-admin-builtin-deploy.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c index 68d17e95..a4aa3c33 100644 --- a/src/ostree/ot-admin-builtin-deploy.c +++ b/src/ostree/ot-admin-builtin-deploy.c @@ -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; }