From d4d5654b3ba513947ee7b2414bf3191c95b39ae4 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 11 Jul 2023 15:49:10 +0200 Subject: [PATCH] packagekit: Prepare for update should skip to be obsoleted and removed packages Do not ask to download packages which are marked as to be obsoleted and removed, because there's nothing to be downloaded for them. Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/2232 The change suggested by ximion at: https://github.com/PackageKit/PackageKit/issues/642#issuecomment-1629482950 --- plugins/packagekit/gs-plugin-packagekit.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c index 9502c114f..4151338ee 100644 --- a/plugins/packagekit/gs-plugin-packagekit.c +++ b/plugins/packagekit/gs-plugin-packagekit.c @@ -3803,6 +3803,14 @@ download_schedule_cb (GObject *source_object, g_steal_pointer (&task)); } +static gboolean +update_system_filter_cb (PkPackage *package, + gpointer user_data) +{ + PkInfoEnum info = pk_package_get_info (package); + return info != PK_INFO_ENUM_OBSOLETING && info != PK_INFO_ENUM_REMOVING; +} + static void download_get_updates_cb (GObject *source_object, GAsyncResult *result, @@ -3831,6 +3839,10 @@ download_get_updates_cb (GObject *source_object, return; } + /* Include only packages which are not to be obsoleted nor removed, + because these can cause failure due to unmet dependencies. */ + pk_package_sack_remove_by_filter (sack, update_system_filter_cb, NULL); + package_ids = pk_package_sack_get_ids (sack); for (guint i = 0; i < gs_app_list_length (data->download_list); i++) { GsApp *app = gs_app_list_index (data->download_list, i); -- GitLab