From 4da80361990fb39119587cb3640c24c3556a12b5 Mon Sep 17 00:00:00 2001 From: "Rafael G. Ruiz" Date: Thu, 12 Aug 2021 20:35:47 +0200 Subject: [PATCH] upgrade: add experimental option to reset overrides experimental ex-reset-overrides option allows resetting overrides before upgrading Signed-off-by: Rafael G. Ruiz --- src/app/rpmostree-builtin-upgrade.cxx | 4 ++++ src/daemon/rpmostreed-transaction-types.cxx | 10 ++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app/rpmostree-builtin-upgrade.cxx b/src/app/rpmostree-builtin-upgrade.cxx index 6360cbcfc3..75580a2d59 100644 --- a/src/app/rpmostree-builtin-upgrade.cxx +++ b/src/app/rpmostree-builtin-upgrade.cxx @@ -43,6 +43,7 @@ static gboolean opt_download_only; static char *opt_automatic; static gboolean opt_lock_finalization; static gboolean opt_bypass_driver; +static gboolean opt_ex_reset_overrides; /* "check-diff" is deprecated, replaced by "preview" */ static GOptionEntry option_entries[] @@ -72,6 +73,8 @@ static GOptionEntry option_entries[] "Prevent automatic deployment finalization on shutdown", NULL }, { "bypass-driver", 0, 0, G_OPTION_ARG_NONE, &opt_bypass_driver, "Force an upgrade even if an updates driver is registered", NULL }, + { "ex-reset-overrides", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, + &opt_ex_reset_overrides, "Reset overrides before upgrade", NULL }, { NULL } }; gboolean @@ -171,6 +174,7 @@ rpmostree_builtin_upgrade (int argc, char **argv, RpmOstreeCommandInvocation *in g_variant_dict_insert (&dict, "download-only", "b", opt_download_only); g_variant_dict_insert (&dict, "lock-finalization", "b", opt_lock_finalization); g_variant_dict_insert (&dict, "initiating-command-line", "s", invocation->command_line); + g_variant_dict_insert (&dict, "ex-reset-overrides", "b", opt_ex_reset_overrides); g_autoptr (GVariant) options = g_variant_ref_sink (g_variant_dict_end (&dict)); /* Use newer D-Bus API only if we have to. */ diff --git a/src/daemon/rpmostreed-transaction-types.cxx b/src/daemon/rpmostreed-transaction-types.cxx index 033a97a4bc..aae3047393 100644 --- a/src/daemon/rpmostreed-transaction-types.cxx +++ b/src/daemon/rpmostreed-transaction-types.cxx @@ -1301,8 +1301,8 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, GCancellable *ca return FALSE; } } - - if (no_overrides) + const gboolean ex_reset_overrides = vardict_lookup_bool (self->options, "ex-reset-overrides", FALSE); + if (no_overrides || (is_upgrade && ex_reset_overrides)) { if (rpmostree_origin_remove_all_overrides (origin)) changed = TRUE; @@ -1407,9 +1407,15 @@ deploy_transaction_execute (RpmostreedTransaction *transaction, GCancellable *ca if (override_replace_local_pkgs) { +<<<<<<< HEAD g_autoptr (GPtrArray) pkgs = NULL; if (!import_many_local_rpms (repo, override_replace_local_pkgs, &pkgs, cancellable, error)) +======= + g_autoptr(GPtrArray) pkgs = NULL; + if (!import_many_local_rpms (repo, override_replace_local_pkgs, &pkgs, + cancellable, error)) +>>>>>>> 1808734c (upgrade: add experimental option to reset overrides) return FALSE; for (guint i = 0; i < pkgs->len; i++)