Skip to content

Commit

Permalink
Add hints for --ignore-installed and --ignore-extras
Browse files Browse the repository at this point in the history
  • Loading branch information
kontura committed May 31, 2024
1 parent 5814b83 commit 1ad810b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions dnf5/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,6 +974,30 @@ static void print_resolve_hints(dnf5::Context & context) {
}
}

// hint --ignore-extras if there are unexpected extra packages in the transaction
if ((transaction_problems & libdnf5::GoalProblem::EXTRA) == libdnf5::GoalProblem::EXTRA) {
const std::string_view arg{"--ignore-extras"};
if (has_named_arg(command, arg.substr(2))) {
hints.emplace_back(libdnf5::utils::sformat(_("{} to allow extra packages in the transaction"), arg));
}
}

// hint --ignore-installed if there are mismatches between installed and stored transaction packages in replay
if ((transaction_problems & libdnf5::GoalProblem::NOT_INSTALLED) == libdnf5::GoalProblem::NOT_INSTALLED ||
(transaction_problems & libdnf5::GoalProblem::INSTALLED_IN_DIFFERENT_VERSION) ==
libdnf5::GoalProblem::INSTALLED_IN_DIFFERENT_VERSION) {
for (const auto & resolve_log : context.get_transaction()->get_resolve_logs()) {
if (resolve_log.get_action() == libdnf5::GoalAction::REPLAY) {
const std::string_view arg{"--ignore-installed"};
if (has_named_arg(command, arg.substr(2))) {
hints.emplace_back(libdnf5::utils::sformat(
_("{} to allow mismatches between installed and stored transaction packages."), arg));
break;
}
}
}
}

if ((transaction_problems & libdnf5::GoalProblem::SOLVER_ERROR) == libdnf5::GoalProblem::SOLVER_ERROR) {
bool conflict = false;
bool broken_file_dep = false;
Expand Down

0 comments on commit 1ad810b

Please sign in to comment.