Skip to content

Commit 60597b7

Browse files
fhbashevan-goode
authored andcommitted
Suggest allow_vendor_change=true when solver blocks vendor update
- When the solver blocks an update due to a vendor change restriction, print a hint suggesting `--setopt=allow_vendor_change=true` (rpm-software-management#750) A previous attempt to change this default was reverted because solver errors gave no indication that vendor locking was the cause. The new hint in `print_resolve_hints()` addresses that by detecting `RULE_UPDATE` problems and telling the user how to override the restriction. Closes: rpm-software-management#750 SWMBZBUGSM-153 BZ#2219624 CI Tests: rpm-software-management/ci-dnf-stack#1839 Signed-off-by: Fellipe Henrique <me@fhbash.com>
1 parent 2ea2099 commit 60597b7

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

dnf5/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,7 @@ static void print_resolve_hints(dnf5::Context & context) {
11071107
bool conflict = false;
11081108
bool broken_file_dep = false;
11091109
bool best = false;
1110+
bool vendor_change = false;
11101111
// walk through all solver problem to detect a conflict, missing file dependency and best
11111112
for (const auto & resolve_log : context.get_transaction()->get_resolve_logs()) {
11121113
if (resolve_log.get_problem() == libdnf5::GoalProblem::SOLVER_ERROR) {
@@ -1129,6 +1130,9 @@ static void print_resolve_hints(dnf5::Context & context) {
11291130
case libdnf5::ProblemRules::RULE_BEST_2:
11301131
best = true;
11311132
break;
1133+
case libdnf5::ProblemRules::RULE_UPDATE:
1134+
vendor_change = true;
1135+
break;
11321136
default:
11331137
break;
11341138
}
@@ -1151,6 +1155,11 @@ static void print_resolve_hints(dnf5::Context & context) {
11511155
}
11521156
}
11531157

1158+
if (!conf.get_allow_vendor_change_option().get_value() && vendor_change) {
1159+
const std::string_view arg{"--setopt=allow_vendor_change=true"};
1160+
hints.emplace_back(libdnf5::utils::sformat(_("{} to allow changing package vendors"), arg));
1161+
}
1162+
11541163
if (broken_file_dep) {
11551164
const std::string_view arg{"--setopt=optional_metadata_types=filelists"};
11561165
auto optional_metadata = conf.get_optional_metadata_types_option().get_value();

0 commit comments

Comments
 (0)