app/main: Tell libdnf not to look for dnf.conf upfront

We don't support `/etc/dnf/dnf.conf`, so tell libdnf to not look for it.
This squashes warnings from libdnf (which turn into hard errors when
hacking locally with `G_DEBUG=fatal-warnings`).

As mentioned in the comment, the reason for putting this in `main.c` is
that it controls a global variable, which is used in a few places in
libdnf. So rather than duplicating this across callsites, just set it
upfront. And yeah... we should improve that API.
This commit is contained in:
Jonathan Lebon 2020-02-26 11:14:47 -05:00 committed by OpenShift Merge Robot
parent 69e3af4331
commit 21bf9ec96c

View File

@ -443,6 +443,13 @@ main (int argc,
setlocale (LC_ALL, "");
/* We don't support /etc/dnf/dnf.conf, so tell libdnf to not look for it. The function
* name here is misleading; it's not attached to a `DnfContext` object, but instead
* controls a global var. And it's not just the `DnfContext` that uses it, but e.g.
* `DnfSack` and Repo too. So just do this upfront. XXX: Clean up that API so it's always
* attached to a context object. */
dnf_context_set_config_file_path("");
GCancellable *cancellable = g_cancellable_new ();
g_autofree char *command_line = rebuild_command_line (argc, argv);