Skip to content

Commit

Permalink
upgrade: add experimental option to reset overrides
Browse files Browse the repository at this point in the history
experimental ex-reset-overrides option allows resetting overrides before upgrading

Signed-off-by: Rafael G. Ruiz <[email protected]>
  • Loading branch information
Razaloc committed Dec 22, 2022
1 parent a25ded6 commit 4da8036
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/app/rpmostree-builtin-upgrade.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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. */
Expand Down
10 changes: 8 additions & 2 deletions src/daemon/rpmostreed-transaction-types.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++)
Expand Down

0 comments on commit 4da8036

Please sign in to comment.