From a0175cb9f497b5145d5d0b95ebb9830f637358e1 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 15 Aug 2022 13:37:14 +0200 Subject: [PATCH] Add patch for install-queue (RH bug #2118265) --- 0002-install-queue.patch | 112 +++++++++++++++++++++++++++++++++++++++ gnome-software.spec | 6 ++- 2 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 0002-install-queue.patch diff --git a/0002-install-queue.patch b/0002-install-queue.patch new file mode 100644 index 0000000..698d1d0 --- /dev/null +++ b/0002-install-queue.patch @@ -0,0 +1,112 @@ +From d9e28b8cb59c805f2df8954637f2056467ff1be3 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 10 Aug 2022 13:41:46 +0200 +Subject: [PATCH 1/2] packagekit: Allow install of apps in the "queued for + install" state + +Treat the "queued for install" state the same as if "available/updatable" +state is set. Without that trying to install anything using PackageKit +plugin leads to an "Unsupported" error. +--- + plugins/packagekit/gs-plugin-packagekit.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c +index 58d627276..85f941648 100644 +--- a/plugins/packagekit/gs-plugin-packagekit.c ++++ b/plugins/packagekit/gs-plugin-packagekit.c +@@ -519,6 +519,7 @@ gs_plugin_app_install (GsPlugin *plugin, + switch (gs_app_get_state (app)) { + case GS_APP_STATE_AVAILABLE: + case GS_APP_STATE_UPDATABLE: ++ case GS_APP_STATE_QUEUED_FOR_INSTALL: + source_ids = gs_app_get_source_ids (app); + if (source_ids->len == 0) { + g_set_error_literal (error, +-- +GitLab + + +From 71ce53a21373670f32b936194d46ab073df77a63 Mon Sep 17 00:00:00 2001 +From: Milan Crha +Date: Wed, 10 Aug 2022 14:24:51 +0200 +Subject: [PATCH 2/2] gs-plugin-loader: Add not removed from the install-queue + file + +The plugin loader has two places, which maintain the pending queue, +but they do not agree on the update of the install-queue file. Let +the functions be re-used, to avoid the problem. +--- + lib/gs-plugin-loader.c | 27 +++++++++++++++++---------- + 1 file changed, 17 insertions(+), 10 deletions(-) + +diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c +index 073008d55..e3f48666a 100644 +--- a/lib/gs-plugin-loader.c ++++ b/lib/gs-plugin-loader.c +@@ -88,6 +88,7 @@ struct _GsPluginLoader + + static void gs_plugin_loader_monitor_network (GsPluginLoader *plugin_loader); + static void add_app_to_install_queue (GsPluginLoader *plugin_loader, GsApp *app); ++static gboolean remove_app_from_install_queue (GsPluginLoader *plugin_loader, GsApp *app); + static void gs_plugin_loader_process_in_thread_pool_cb (gpointer data, gpointer user_data); + static void gs_plugin_loader_status_changed_cb (GsPlugin *plugin, + GsApp *app, +@@ -1078,17 +1079,22 @@ gs_plugin_loader_pending_apps_add (GsPluginLoader *plugin_loader, + GsPluginLoaderHelper *helper) + { + GsAppList *list = gs_plugin_job_get_list (helper->plugin_job); +- g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&plugin_loader->pending_apps_mutex); +- +- if (plugin_loader->pending_apps == NULL) +- plugin_loader->pending_apps = gs_app_list_new (); + + g_assert (gs_app_list_length (list) > 0); + for (guint i = 0; i < gs_app_list_length (list); i++) { + GsApp *app = gs_app_list_index (list, i); +- gs_app_list_add (plugin_loader->pending_apps, app); +- /* make sure the progress is properly initialized */ +- gs_app_set_progress (app, GS_APP_PROGRESS_UNKNOWN); ++ switch (gs_plugin_job_get_action (helper->plugin_job)) { ++ case GS_PLUGIN_ACTION_INSTALL: ++ add_app_to_install_queue (plugin_loader, app); ++ /* make sure the progress is properly initialized */ ++ gs_app_set_progress (app, GS_APP_PROGRESS_UNKNOWN); ++ break; ++ case GS_PLUGIN_ACTION_REMOVE: ++ remove_app_from_install_queue (plugin_loader, app); ++ break; ++ default: ++ break; ++ } + } + g_idle_add (emit_pending_apps_idle, g_object_ref (plugin_loader)); + } +@@ -1098,13 +1104,11 @@ gs_plugin_loader_pending_apps_remove (GsPluginLoader *plugin_loader, + GsPluginLoaderHelper *helper) + { + GsAppList *list = gs_plugin_job_get_list (helper->plugin_job); +- g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&plugin_loader->pending_apps_mutex); + + g_assert (gs_app_list_length (list) > 0); + for (guint i = 0; i < gs_app_list_length (list); i++) { + GsApp *app = gs_app_list_index (list, i); +- if (plugin_loader->pending_apps != NULL) +- gs_app_list_remove (plugin_loader->pending_apps, app); ++ remove_app_from_install_queue (plugin_loader, app); + + /* check the app is not still in an action helper */ + switch (gs_app_get_state (app)) { +@@ -1272,6 +1276,9 @@ remove_app_from_install_queue (GsPluginLoader *plugin_loader, GsApp *app) + g_mutex_unlock (&plugin_loader->pending_apps_mutex); + + if (ret) { ++ if (gs_app_get_state (app) == GS_APP_STATE_QUEUED_FOR_INSTALL) ++ gs_app_set_state (app, GS_APP_STATE_UNKNOWN); ++ + id = g_idle_add (emit_pending_apps_idle, g_object_ref (plugin_loader)); + g_source_set_name_by_id (id, "[gnome-software] emit_pending_apps_idle"); + save_install_queue (plugin_loader); +-- +GitLab + diff --git a/gnome-software.spec b/gnome-software.spec index 59d9ebe..e141c89 100644 --- a/gnome-software.spec +++ b/gnome-software.spec @@ -18,7 +18,7 @@ Name: gnome-software Version: 43.beta -Release: 1%{?dist} +Release: 2%{?dist} Summary: A software center for GNOME License: GPLv2+ @@ -26,6 +26,7 @@ URL: https://wiki.gnome.org/Apps/Software Source0: https://download.gnome.org/sources/gnome-software/43/%{name}-%{tarball_version}.tar.xz Patch01: 0001-crash-with-broken-theme.patch +Patch02: 0002-install-queue.patch BuildRequires: docbook-style-xsl BuildRequires: desktop-file-utils @@ -212,6 +213,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop %{_datadir}/gtk-doc/html/gnome-software/ %changelog +* Mon Aug 15 2022 Milan Crha - 43.beta-2 +- Add patch for install-queue + * Fri Aug 05 2022 Milan Crha - 43.beta-1 - Update to 43.beta