Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Lachu:SystemServices
PackageKit
n-0022-dnf-backend-honor-install_weak_deps-Fals...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File n-0022-dnf-backend-honor-install_weak_deps-False-if-it-is-t.patch of Package PackageKit
From ecd4a969939855350930511516ae20584bda7fa7 Mon Sep 17 00:00:00 2001 From: Dario Faggioli <dfaggioli@suse.com> Date: Fri, 11 Jun 2021 18:53:18 +0200 Subject: [PATCH 022/102] dnf-backend: honor install_weak_deps=False if it is there Currently, even if we have "install_weak_deps=False" in /etc/dnf/dnf.conf, `pkcon install` still tries to install all the recommended packages. For avoiding that, we need to inform libdnf that we will solve the goal of the transaction ourselves (by means of the dnf_transaction_set_dont_solve_goal() API) and then explicitly set the flag for ignoring the weak dependencies. This fixes issue #486 and also solve https://bugzilla.redhat.com/show_bug.cgi?id=1955484 diff --git a/backends/dnf/pk-backend-dnf.c b/backends/dnf/pk-backend-dnf.c index 4ff4cdb8c..b48a3e280 100644 --- a/backends/dnf/pk-backend-dnf.c +++ b/backends/dnf/pk-backend-dnf.c @@ -933,6 +933,7 @@ pk_backend_search_thread (PkBackendJob *job, GVariant *params, gpointer user_dat gboolean ret; DnfDb *db; DnfState *state_local; + DnfGoalActions flags; GPtrArray *installs = NULL; GPtrArray *pkglist = NULL; HyQuery query = NULL; @@ -1029,7 +1030,10 @@ pk_backend_search_thread (PkBackendJob *job, GVariant *params, gpointer user_dat } else { hy_goal_upgrade_all (job_data->goal); } - ret = dnf_goal_depsolve (job_data->goal, DNF_ALLOW_UNINSTALL, &error); + flags = DNF_ALLOW_UNINSTALL; + if (!dnf_context_get_install_weak_deps ()) + flags |= DNF_IGNORE_WEAK_DEPS; + ret = dnf_goal_depsolve (job_data->goal, flags, &error); if (!ret) { pk_backend_job_error_code (job, error->code, "%s", error->message); goto out; @@ -2545,6 +2549,7 @@ pk_backend_transaction_run (PkBackendJob *job, GError **error) { DnfState *state_local; + DnfGoalActions dnf_flags = DNF_ALLOW_UNINSTALL; PkBackendDnfJobData *job_data = pk_backend_job_get_user_data (job); gboolean ret = TRUE; /* allow downgrades for all transaction types */ @@ -2573,6 +2578,15 @@ pk_backend_transaction_run (PkBackendJob *job, dnf_transaction_set_flags (job_data->transaction, flags); state_local = dnf_state_get_child (state); + + /* we solve the goal ourselves, so we can deal with flags */ + dnf_transaction_set_dont_solve_goal (job_data->transaction, TRUE); + if (!dnf_context_get_install_weak_deps ()) + dnf_flags |= DNF_IGNORE_WEAK_DEPS; + ret = dnf_goal_depsolve (job_data->goal, dnf_flags, error); + if (!ret) + return FALSE; + ret = dnf_transaction_depsolve (job_data->transaction, job_data->goal, state_local, -- 2.35.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor