Skip to content

Commit

Permalink
Print more helpful error message when reinstalling non-installed pkg
Browse files Browse the repository at this point in the history
Print "Package for argument foo available, but not installed" when
attempting to reinstall a package that is not yet installed. Previously,
the error was not as descriptive ("No match for argument: foo").

For https://issues.redhat.com/browse/RHEL-53430
  • Loading branch information
evan-goode committed Aug 30, 2024
1 parent 4e82be8 commit 10d44f7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions dnf/plugins/reinstall/dnf-command-reinstall.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,21 @@ dnf_command_reinstall_arg (DnfContext *ctx, const char *arg, GError **error)
hy_query_filter (query_installed, HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME);
g_autoptr(GPtrArray) installed_pkgs = hy_query_run (query_installed);

hy_query_filter (query, HY_PKG_REPONAME, HY_NEQ, HY_SYSTEM_REPO_NAME);
g_autoptr(GPtrArray) available_pkgs = hy_query_run (query);

if (installed_pkgs->len == 0)
{
g_print ("No match for argument: %s\n", arg);
if (available_pkgs->len == 0)
{
g_print ("No match for argument: %s\n", arg);
}
else
{
g_print ("Package for argument %s available, but not installed.\n", arg);
}
return TRUE;
}

hy_query_filter (query, HY_PKG_REPONAME, HY_NEQ, HY_SYSTEM_REPO_NAME);
g_autoptr(GPtrArray) available_pkgs = hy_query_run (query);

g_autoptr(GTree) available_nevra2pkg_set = g_tree_new_full (compare_nevra, NULL,
g_free, packageset_free);
Expand Down

0 comments on commit 10d44f7

Please sign in to comment.