Skip to content

Commit ac28ca3

Browse files
committed
Change allow_vendor_change default to false with descriptive hint
- Change the default value of `allow_vendor_change` from `true` to `false` so packages stick to their original vendor during upgrades (rpm-software-management#712) - 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#712 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 ebd2dbc commit ac28ca3

4 files changed

Lines changed: 12 additions & 3 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();

doc/dnf5.conf.5.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ repository configuration file should aside from repo ID consists of baseurl, met
6060
If disabled, DNF5 will stick to the original vendor during RPM upgrades or downgrades.
6161
This preference, however, can be fine-tuned using :ref:`Vendor change policies <dnf5_vendor_change_policy-label>`.
6262

63-
Default: ``True``.
63+
Default: ``False``.
6464

6565
.. WARNING:: This option is currently not supported for `downgrade` and `distro-sync` commands
6666

libdnf5/conf/config_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class ConfigMain::Impl {
165165
OptionBool gpgkey_dns_verification{false};
166166
OptionBool obsoletes{true};
167167
OptionBool exit_on_lock{false};
168-
OptionBool allow_vendor_change{true};
168+
OptionBool allow_vendor_change{false};
169169
OptionSeconds metadata_timer_sync{60 * 60 * 3}; // 3 hours
170170
OptionStringList disable_excludes{std::vector<std::string>{}};
171171
OptionEnum multilib_policy{"best", {"best", "all"}}; // :api

libdnf5/rpm/solv/goal_private.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class GoalPrivate {
205205

206206
bool allow_downgrade{true};
207207
bool allow_erasing{false};
208-
bool allow_vendor_change{true};
208+
bool allow_vendor_change{false};
209209
bool install_weak_deps{true};
210210
// Remove SOLVER_WEAK and add SOLVER_BEST to all jobs
211211
bool run_in_strict_mode{false};

0 commit comments

Comments
 (0)