Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions libdnf/dnf-context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ typedef struct
gchar *install_root;
gchar *source_root;
gchar *rpm_verbosity;
gchar **native_arches;
gchar **native_arches{NULL};
gchar *http_proxy;
gchar *user_agent;
gchar *arch;
Expand Down Expand Up @@ -2177,13 +2177,15 @@ dnf_context_setup(DnfContext *context,
(void) dnf_context_get_base_arch(context);

/* find all the native archs */
priv->native_arches = g_new0(gchar *, MAX_NATIVE_ARCHES);
for (i = 0; arch_map[i].base != NULL; i++) {
if (g_strcmp0(arch_map[i].base, priv->base_arch) == 0) {
for (j = 0; arch_map[i].native[j] != NULL; j++)
priv->native_arches[j] = g_strdup(arch_map[i].native[j]);
priv->native_arches[j++] = g_strdup("noarch");
break;
if (!priv->native_arches) {
priv->native_arches = g_new0(gchar *, MAX_NATIVE_ARCHES);
for (i = 0; arch_map[i].base != NULL; i++) {
if (g_strcmp0(arch_map[i].base, priv->base_arch) == 0) {
for (j = 0; arch_map[i].native[j] != NULL; j++)
priv->native_arches[j] = g_strdup(arch_map[i].native[j]);
priv->native_arches[j++] = g_strdup("noarch");
break;
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions libdnf/dnf-repo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ dnf_repo_get_public_keys(DnfRepo *repo)
for (char **iter = priv->gpgkeys; iter && *iter; iter++) {
const char *key = *iter;
g_autofree gchar *key_bn = g_path_get_basename(key);
g_ptr_array_add(ret, g_build_filename(priv->location, key_bn, NULL));
g_autofree gchar *key_filename = g_build_filename(priv->location, key_bn, NULL);
g_ptr_array_add(ret, key_filename);
}
g_ptr_array_add(ret, NULL);
return (gchar**)g_ptr_array_free(static_cast<GPtrArray *>(g_steal_pointer(&ret)), FALSE);
Expand Down Expand Up @@ -1044,7 +1045,8 @@ dnf_repo_set_keyfile_data(DnfRepo *repo, GError **error)

cache_path = g_build_filename(dnf_context_get_cache_dir(priv->context), cache_file_name, NULL);
if (priv->packages == NULL) {
dnf_repo_set_packages(repo, g_build_filename(cache_path, "packages", NULL));
g_autofree gchar *packages_path = g_build_filename(cache_path, "packages", NULL);
dnf_repo_set_packages(repo, packages_path);
}
if (priv->location == NULL) {
dnf_repo_set_location(repo, cache_path);
Expand Down