From 4b91cfcc5b20fd05e8ddd7bfe83126db7724b879 Mon Sep 17 00:00:00 2001 From: Jaroslav Rohel Date: Sat, 4 Jan 2020 22:09:43 +0100 Subject: [PATCH] Call dnf_context_set_install_weak_deps() later The dnf_context_set_install_weak_deps() must not be called before dnf_context_set_config_file_path(). --- dnf/dnf-main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dnf/dnf-main.c b/dnf/dnf-main.c index d86998a..d1a2c2a 100644 --- a/dnf/dnf-main.c +++ b/dnf/dnf-main.c @@ -3,7 +3,7 @@ * Copyright © 2010-2015 Richard Hughes * Copyright © 2016 Colin Walters * Copyright © 2016-2017 Igor Gnatenko - * Copyright © 2017 Jaroslav Rohel + * Copyright © 2017-2020 Jaroslav Rohel * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,9 @@ #include #include "dnf-command.h" +typedef enum { ARG_DEFAULT, ARG_FALSE, ARG_TRUE } BoolArgs; + +static BoolArgs opt_install_weak_deps = ARG_DEFAULT; static gboolean opt_yes = TRUE; static gboolean opt_nodocs = FALSE; static gboolean opt_best = FALSE; @@ -94,9 +97,9 @@ process_global_option (const gchar *option_name, { const char *setopt_val = setopt[1]; if (setopt_val[0] == '1' && setopt_val[1] == '\0') - dnf_context_set_install_weak_deps (TRUE); + opt_install_weak_deps = ARG_TRUE; else if (setopt_val[0] == '0' && setopt_val[1] == '\0') - dnf_context_set_install_weak_deps (FALSE); + opt_install_weak_deps = ARG_FALSE; else { local_error = g_error_new (G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, @@ -349,6 +352,11 @@ main (int argc, * The calling is done with hardcoded parameters. We dont want it. */ dnf_transaction_set_dont_solve_goal(txn, TRUE); + if (opt_install_weak_deps == ARG_TRUE) + dnf_context_set_install_weak_deps (TRUE); + else if (opt_install_weak_deps == ARG_FALSE) + dnf_context_set_install_weak_deps (FALSE); + if (opt_best && opt_nobest) { error = g_error_new_literal(G_OPTION_ERROR,